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

Instantiated story with global variable storage and access, used to instantiate new threads. More...

#include <InkRuntime.h>

Inheritance diagram for AInkRuntime:

Public Member Functions

UInkThreadStart (TSubclassOf< UInkThread > type, FString path="", bool runImmediately=true)
 Create a new Thread.
UInkThreadStartExisting (UInkThread *thread, FString path="", bool runImmediately=true)
 Create a new Thread in existing memory, for more details.
FInkSnapshot Snapshot ()
 creates a snapshot of the current runtime state.
TFuture< FInkSnapshotMigratableSnapshot ()
 creates a snapshot the next time the story is in a stable state.
void LoadSnapshot (const FInkSnapshot &snapshot)
 Loads a snapshot file, therefore deletes globals and invalidate all current Threads After this Start and StartExisting will load the corresponding Threads (on at a time).
void PushExclusiveThread (UInkThread *Thread)
 Marks a thread as "exclusive".
void PopExclusiveThread (UInkThread *Thread)
 Removes a thread from the exclusive stack.
FInkHandle RegisterTagFunction (FName functionName, const FTagFunctionDelegate &function)
 register a "tag function" This function is executed if context or a tag in a special format appears.
void Unregister (const FInkHandle &handle)
 Stop receiving variable-change notifications or unregister a tag function.
FInkVar GetGlobalVariable (const FString &name)
 Access a variable from the ink runtime.
void SetGlobalVariable (const FString &name, const FInkVar &value)
 Sets a global variable inside the ink runtime.
FInkHandle ObserverVariable (const FString &variableName, const FVariableCallbackDelegate &callback)
 Gets a ping if variable changes.
FInkHandle ObserverVariableEvent (const FString &variableName, const FVariableCallbackDelegateNewValue &callback)
 On variable change provides new value.
FInkHandle ObserverVariableChange (const FString &variableName, const FVariableCallbackDelegateNewOldValue &callback)
 On variable change provides old and new value.

Protected Member Functions

virtual void BeginPlay () override
 Called when the game starts or when spawned.
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason) override
 Called when the actor is being removed from play.

Detailed Description

Instantiated story with global variable storage and access, used to instantiate new threads.

Member Function Documentation

◆ GetGlobalVariable()

FInkVar AInkRuntime::GetGlobalVariable ( const FString & name)

Access a variable from the ink runtime.

variables are shared between all threads in the same runtime.

Parameters
nameof variable in ink script

Get Global Variable
Target
Name
Return Value

◆ LoadSnapshot()

void AInkRuntime::LoadSnapshot ( const FInkSnapshot & snapshot)

Loads a snapshot file, therefore deletes globals and invalidate all current Threads After this Start and StartExisting will load the corresponding Threads (on at a time).

Load Snapshot
Target
Snapshot

◆ MigratableSnapshot()

TFuture< FInkSnapshot > AInkRuntime::MigratableSnapshot ( )

creates a snapshot the next time the story is in a stable state.

for Blueprints please use snapshotAsync::UInkMigratableSnapshotAsync() This snapshot can be loaded with a new version of the same story. can be loaded with LoadSnapshot()

Attention
typical this snapshot will be created after the next choice is taken. To archive this each active runner will yield after the next choice and only continue after the snapshot is taken.

◆ ObserverVariable()

FInkHandle AInkRuntime::ObserverVariable ( const FString & variableName,
const FVariableCallbackDelegate & callback )

Gets a ping if variable changes.

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

Observer Variable
Target
Variable Name
Callback
Return Value

◆ ObserverVariableChange()

FInkHandle AInkRuntime::ObserverVariableChange ( const FString & variableName,
const FVariableCallbackDelegateNewOldValue & callback )

On variable change provides old and new value.

Returns
handle — call Cancel() to remove this binding (or pass to Unregister() from Blueprint)
Attention
if the variable set for the first time, the old value has value type EInkVarType::None
See also
ObserverVariableEvent() ObserverVariable()

Observer Variable Change
Target
Variable Name
Callback
Return Value

◆ ObserverVariableEvent()

FInkHandle AInkRuntime::ObserverVariableEvent ( const FString & variableName,
const FVariableCallbackDelegateNewValue & callback )

On variable change provides new value.

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

Observer Variable Event
Target
Variable Name
Callback
Return Value

◆ PopExclusiveThread()

void AInkRuntime::PopExclusiveThread ( UInkThread * Thread)

Removes a thread from the exclusive stack.

See also
PushExclusiveThread()

Pop Exclusive Thread
Target
Thread

◆ PushExclusiveThread()

void AInkRuntime::PushExclusiveThread ( UInkThread * Thread)

Marks a thread as "exclusive".

As long as it is running, no other threads will update.

See also
PopExclusiveThread()

Push Exclusive Thread
Target
Thread

◆ RegisterTagFunction()

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

register a "tag function" This function is executed if context or a tag in a special format appears.

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

Register Tag Function
Target
Function Name
Function
Return Value

◆ SetGlobalVariable()

void AInkRuntime::SetGlobalVariable ( const FString & name,
const FInkVar & value )

Sets a global variable inside the ink runtime.

Parameters
nameof variable in ink script
valuenew value for the variable

Set Global Variable
Target
Name
Value

◆ Snapshot()

FInkSnapshot AInkRuntime::Snapshot ( )

creates a snapshot of the current runtime state.

can be loaded with LoadSnapshot()

Attention
this snapshot can only be loaded with the same story, for migratable snapshots please use UInkMigratableSnapshotAsync::UInkMigratableSnapshotAsync()

make snapshot, if save? Return every time a thread chooses something yield this thread try to make snapshot, if save? fullfill promise and resume all threads

Snapshot
Target
Return Value

◆ Start()

UInkThread * AInkRuntime::Start ( TSubclassOf< UInkThread > type,
FString path = "",
bool runImmediately = true )

Create a new Thread.

If a Snapshot is set/loaded create Threads like there was before if you want to create a fresh Thread despite an existing LoadedSnapshot enter the starting path

Start
Target
Type
Path
Run Immediately
Return Value

◆ StartExisting()

UInkThread * AInkRuntime::StartExisting ( UInkThread * thread,
FString path = "",
bool runImmediately = true )

Create a new Thread in existing memory, for more details.

See also
AInkRuntime::Start()

Start Existing
Target
Thread
Path
Run Immediately
Return Value

◆ Unregister()

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

Stop receiving variable-change notifications or unregister a tag function.

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

Parameters
handlethe handle returned by ObserverVariable / ObserverVariableEvent / ObserverVariableChange / RegisterTagFunction

Unregister
Target
Handle


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