Skip to main content

Text & Grammar

Functions relating to the grammar engine. Please consult the section on Grammar & Contexts for information on how to use the grammar engine.

Text.GetString
key
  • key (string) - string table key
  • (string) - a random string table entry.
Looks up the specified key in all loaded string tables, and returns a random entry.
Text.SetContext
name
context
  • name (string) - the name of the context, i.e. what you place in the curly braces
  • context (Creature) - value of the context
Attaches the specified object to a context, so that if the specified name is later used in a grammar tag, this object will be used to resolve the grammar tag. The context lasts until the Scene changes, or until the game restarts (i.e. it is NOT stored in save data).
Text.SetVariable
name
value
  • name (string) - variable name
  • value (string) - replacement text
Registers a replacement variable. After this function is called, any text in string tables in the form of {!name} (note the exclamation mark, to differ it from a regular grammar tag) will be replaced with value. The variable lasts until the Scene changes, or until the game restarts (i.e. it is NOT stored in save data).