inkcpp
Loading...
Searching...
No Matches
UInkThread Class Reference

Base class for all ink threads. More...

#include <InkThread.h>

Inheritance diagram for UInkThread:

Public Member Functions

void Yield ()
 Yields the thread immediately.
bool IsYielding ()
 Checks if the thread is stopped.
void Resume ()
 Resumes yielded thread.
void Stop ()
 Kills thread at next possible moment.
AInkRuntimeGetRuntime () const
 Access runtime the thread belongs to.
void OnStartup ()
 triggered after initializing the runner
void OnLineWritten (const FString &line, const UTagList *tags)
 triggered if a new line of context is available
void OnKnotEntered (const UTagList *global_tags, const UTagList *knot_tags)
 triggered if a knew knot/stitch is entered (tunneling is ignored).
void OnTag (const FString &tag_name)
 triggered when a tag is encountered
void OnChoice (const TArray< UInkChoice * > &choices)
 triggered when reached a choice point.
void OnShutdown ()
 triggered when the thread reached the end of context
bool PickChoice (int index)
 picks a choice to continue with
FInkHandle RegisterTagFunction (FName functionName, const FTagFunctionDelegate &function)
 Register a callback for a named "tag function".
FInkHandle RegisterExternalFunction (const FString &functionName, const FExternalFunctionDelegate &function, bool lookaheadSafe=false)
 Register an external function that returns a value.
FInkHandle RegisterExternalEvent (const FString &functionName, const FExternalFunctionVoidDelegate &function, bool lookaheadSafe=false)
 Register an external event (void return).
void Unregister (const FInkHandle &handle)
 Unregister a previously registered external function, event, or tag function.
void ClearExternalFunctions ()
 Unregister all external functions and events bound to this thread.
const UTagListGetKnotTags ()
 get knots assoziated with current knot.
const UTagListGetGlobalTags ()
 get global tags.
const TArray< UInkChoice * > & GetCurrentChoices () const
 Get choices from the last OnChoice event.

Friends

class AInkRuntime
friend FInkVar::FInkVar (UInkList &)
friend FInkVar::FInkVar (ink::runtime::value)

Detailed Description

Base class for all ink threads.

Member Function Documentation

◆ ClearExternalFunctions()

void UInkThread::ClearExternalFunctions ( )

Unregister all external functions and events bound to this thread.

Useful when reusing a thread via StartExisting() to ensure no stale bindings remain.

Clear External Functions
Target

◆ GetCurrentChoices()

const TArray< UInkChoice * > & UInkThread::GetCurrentChoices ( ) const
inline

Get choices from the last OnChoice event.

Returns
array of choices available at the current choice point, empty if not at a choice

◆ GetGlobalTags()

const UTagList * UInkThread::GetGlobalTags ( )

get global tags.

global tags are tags listed at the top of the file before the first line of content

Get Global Tags
Target
Return Value

◆ GetKnotTags()

const UTagList * UInkThread::GetKnotTags ( )

get knots assoziated with current knot.

knot tags are tags listed behind a knot == knot name == before the first line of content

Get Knot Tags
Target
Return Value

◆ GetRuntime()

AInkRuntime * UInkThread::GetRuntime ( ) const
inline

Access runtime the thread belongs to.

Returns
runtime of the thread

Get Runtime
Target
Return Value

◆ IsYielding()

bool UInkThread::IsYielding ( )

Checks if the thread is stopped.

Return values
trueif the thread currently waiting to resume
See also
Yield() Resume()

Is Yielding
Target
Return Value

◆ OnChoice()

void UInkThread::OnChoice ( const TArray< UInkChoice * > & choices)

triggered when reached a choice point.

Parameters
choicespossible branches to choose from, in order to continue
See also
PickChoice()

Event OnChoice
Choices

◆ OnKnotEntered()

void UInkThread::OnKnotEntered ( const UTagList * global_tags,
const UTagList * knot_tags )

triggered if a knew knot/stitch is entered (tunneling is ignored).

Triggers before the first line of a knot/stitch is written

Parameters
global_tagstags assoziated with global file
knot_tagstags assoziated with the current knot/stitch

Event OnKnotEntered
Global tags
Knot tags

◆ OnLineWritten()

void UInkThread::OnLineWritten ( const FString & line,
const UTagList * tags )

triggered if a new line of context is available

Parameters
linetext of new line
tagstags associated with this line

Event OnLineWritten
Line
Tags

◆ OnShutdown()

void UInkThread::OnShutdown ( )

triggered when the thread reached the end of context

See also
AInkRuntime::StartExisting()

Event OnShutdown

◆ OnStartup()

void UInkThread::OnStartup ( )

triggered after initializing the runner

Event OnStartup

◆ OnTag()

void UInkThread::OnTag ( const FString & tag_name)

triggered when a tag is encountered

Parameters
tag_namethe tag found

Event OnTag
Tag name

◆ PickChoice()

bool UInkThread::PickChoice ( int index)

picks a choice to continue with

See also
UInkChoice::GetIndex()
Return values
falseif the index is out of range

Pick Choice
Target
Index
0
Return Value

◆ RegisterExternalEvent()

FInkHandle UInkThread::RegisterExternalEvent ( const FString & functionName,
const FExternalFunctionVoidDelegate & function,
bool lookaheadSafe = false )

Register an external event (void return).

Returns
handle — call Cancel() to remove this binding (or pass to Unregister() from Blueprint)
See also
If you want to return a value use RegisterExternalFunction()

Register External Event
Target
Function Name
Function
Lookahead Safe
Return Value

◆ RegisterExternalFunction()

FInkHandle UInkThread::RegisterExternalFunction ( const FString & functionName,
const FExternalFunctionDelegate & function,
bool lookaheadSafe = false )

Register an external function that returns a value.

Returns
handle — call Cancel() to remove this binding (or pass to Unregister() from Blueprint)
See also
if you do not want to return something RegisterExternalEvent()

Register External Function
Target
Function Name
Function
Lookahead Safe
Return Value

◆ RegisterTagFunction()

FInkHandle UInkThread::RegisterTagFunction ( FName functionName,
const FTagFunctionDelegate & function )

Register a callback for a named "tag function".

Returns
handle — call Cancel() to remove this binding (or pass to Unregister() from Blueprint)

Register Tag Function
Target
Function Name
Function
Return Value

◆ Resume()

void UInkThread::Resume ( )

Resumes yielded thread.

See also
Yield()

Resume
Target

◆ Stop()

void UInkThread::Stop ( )

Kills thread at next possible moment.

Stop
Target

◆ Unregister()

void UInkThread::Unregister ( const FInkHandle & handle)
inline

Unregister a previously registered external function, event, or tag function.

Prefer calling FInkHandle::Cancel() directly — that does not require the thread.

Parameters
handlethe handle returned by RegisterExternalFunction() / RegisterExternalEvent() / RegisterTagFunction()

Unregister
Target
Handle

◆ Yield()

void UInkThread::Yield ( )

Yields the thread immediately.

This will stop the execution (after finishing the current line). until Resume() is called.

Yield() and Resume() working with a reference counter. therefore a thread can be yield multiple times, and must then be resumed the same amount.

Yield
Target


The documentation for this class was generated from the following file: