Conditional content
Texts can contain blocks that are only shown if a condition is true. The backend evaluates them with the current variable values before the text is sent to the player app.
You have found :variable[keysFound]{numberDecimals="0"} pieces of the key so far.![if][{{d:keysFound}} >= 2]Only one piece is missing – it is near the Neptune Fountain.![elseif][{{d:keysFound}} == 1]Two pieces are still missing.![else]You have not found any piece yet.![endif]Conditions reference variables with placeholders ({{d:…}}), which the backend replaces; values are shown in the
text with the variable directive.
Each marker has to be on its own line:
| Line | Meaning |
|---|---|
![if][<condition>] |
starts a block |
![elseif][<condition>] |
optional, any number |
![else] |
optional |
![endif] |
ends the block |
Conditional blocks work in the description, publicInfo, postDescription and messages of elements, challenges and
stories, and in the messages of dynamic elements.
Conditions
Section titled “Conditions”Placeholders ({{d:…}}, {{i:…}}, {{s:…}}) are replaced first, then the condition is evaluated:
| Kind | Operators | Example |
|---|---|---|
| numbers | == != < <= > >= |
{{d:keysFound}} >= 3 |
| strings (in double quotes) | == != |
"{{i:attendeeLang}}" == "deu" |
| booleans | == !=, ! |
{{d:doorOpen}} == true, !{{d:doorOpen}} |
| combined | && ||, parentheses |
({{d:keysFound}} >= 2) && ({{s:dayOfWeek}} >= 6) |
When combining conditions, put each one in parentheses. If a condition can not be parsed, the player sees an error text instead of the block – test conditional texts by playing the story.