Reacting to flags live
Lives in: story/story.json (and object / sprite packs)
Make something on screen follow what the story remembers — a meter, a lamp, a command that only runs if a condition is true.
A flag drives a picture
Set a flag in the script:
[score = 3]
HANA:
Watch the meter.
An object (or sprite part) can bind a property to that flag — position, colour, and similar — so it updates when the flag changes. The bind lives on the object file; the moment only shows the object:
{
"id": "park",
"commands": [
{
"type": "obj",
"object": "meter",
"instance_id": "score_meter",
"show": true
}
]
}
Building the meter parts and bind map: Sprites and objects. Characters can bind opacity, modulate, scale, and shader uniforms the same way — Expressions and packs. Worked examples also live under examples/.
Flags themselves: Choices and memory.
Run a command only if…
On a command in the direction file, add when with an expression:
{
"type": "sfx",
"value": "chime",
"when": "score >= 3"
}
If the expression is false (or errors), that command is skipped; the rest of the moment continues. Expressions use the same language as [if …] — Choices and memory.
when is data-only (no script sugar for it yet).
Things that stick, things that last one beat
Some commands change the stage for the whole play until you change them again. Others should apply only this moment.
| Meta | Effect |
|---|---|
omit / "apply": "persistent" | Stays until override, reset, or new game (default where supported) |
"apply": "node_local" | Reverts after this moment |
Used on surfaces such as panel look, name plate, objects, and some layouts. To clear a sticky override, send that command family again or use "reset": true where the command allows it.
For many shaders: leave the key out = keep what is there; set the key to null = clear. Check the stage / polish page for that surface when you use it.
Usually you need
| Want | Do |
|---|---|
| Meter follows a flag | Object/sprite bind + show the object on the moment |
| SFX only if helped | "when": "helped" on the command |
| Panel look for one whisper | "apply": "node_local" on that panel command |
Next
Stage pictures and sound in depth: Backgrounds. Or return to Setting up your game for project defaults.