Skip to main content

Token Service

Description​

Resolves {prefix.key} tokens in dialogue text at runtime. Parses text for token patterns, looks up the appropriate resolver by prefix, and returns the resolved string. Unresolved tokens remain in the text unchanged and produce a warning log.

ITextTokenService​

Interface​

Type
ITextTokenService

Public Methods​

NameParametersReturn TypeDescription
Resolvestring text, TokenResolutionContext contextstringResolves all tokens in the text and returns the result.

ITokenResolver​

Interface​

Type
ITokenResolver

Properties​

NameTypeDescription
PrefixstringThe namespace prefix this resolver owns.

Public Methods​

NameParametersReturn TypeDescription
TryResolvestring key, TokenResolutionContext context, out string valueboolAttempts to resolve the key. Returns true if successful.

Built-in Resolvers​

ResolverPrefixKeys
BlackboardTokenResolverbbAny blackboard key; prefix with conversation. for conversation scope
ParticipantTokenResolverspeakername
ParticipantTokenResolverothername
WorldTokenResolverworldtime, day, period

TokenResolutionContext​

NameTypeDescription
ParticipantsDialogueParticipantsThe current speaker and listener.
NodeIdstringThe ID of the current dialogue node.