7. Condition system
A Condition node connected to the output of a Function receives the result of the function and routes onto on_true / on_false. A Condition node with a condition field is instead evaluated directly.
The supported grammar is the following (no eval, no access to code):
| Element | Examples | ||
|---|---|---|---|
| Comparison operators | ==, !=, <, <=, >, >= | ||
| Logical operators | &&, `\ | \ | , !` |
| Parentheses | `(a \ | \ | b) && c` |
| Literals | true, false, integer and decimal numbers, strings in quotes | ||
| Identifiers | also dotted: quest.rescue.state | ||
| Unary minus | -1 |
Arithmetic is not supported: for counters, AddInt from the API or the quest actions are used.
The quest variables are exposed automatically (QuestVariableMirror):
quest.<id>.state available | active | completed | failed
quest.<id>.available bool
quest.<id>.active bool
quest.<id>.completed bool
quest.<id>.failed bool
quest.<id>.step.<stepId> bool
An invalid expression is logged with [324] and considered false.
8. Variables and quests
- The types are
bool,int,float,string;DialogueVariablesis a typed dictionary with the
OnChanged event.
- The declarations in
variables.yamlpopulate the catalog (DialogueVariableCatalog), used for the
validation and for the editor.
- Conditions on undeclared variables are permitted (with a warning in the validator).
IQuestServiceis the abstraction of the quests;InMemoryQuestServiceis the default
implementation. The game may supply its own (SetQuestService).
QuestVariableMirrormirrors the quest state inside the variables, so that the conditions can read
it without code.