Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Command flow

When enter, mid-line, and exit command batches run on a dialogue node. Shared idea: Command flow (concept).

{
  "id": "park",
  "text": "Hello.{@c1} Nice day.",
  "commands": [{ "type": "bg", "value": "street" }],
  "flow_commands": [[{ "type": "sfx", "value": "click" }]],
  "exit_commands": [{ "type": "char", "name": "hana", "show": false }],
  "exit_delay": 0.5,
  "next": "after"
}

Usually you need

SurfaceTypeEffect
commandsarray of commandsRun on enter (after set)
flow_commandsarray of batches{@cN} runs batch N-1 while typing
exit_commandsarray of commandsRun on leave (advance or choice)
exit_delaynumber ≥ 0Seconds after exit_commands, before next node
{@cN}text tagTrigger flow batch (1-based)

Lifecycle order

StepWhat runs
1Node set flags
2Enter commands (top → bottom)
3Line display / typing
4Each {@cN} → that flow_commands batch (typing does not pause)
5Continue / auto-advance / choice pick
6exit_commands
7exit_delay wait (if > 0)
8Enter next node (next, choice target, or end)

Leave also runs when the player picks a choice (exit, then the branch node).

Batch fields

KeyTypeDefaultEffect
commandsarray—Enter batch; omitted = no enter commands
flow_commandsarray—Each element is a command array (a batch)
exit_commandsarray—Leave batch
exit_delaynumber ≥ 00Wait after exit batch before advancing
setobject—Flags applied on enter, before commands

Related node timing (not command batches): auto / [auto N] — Node fields, Typing.

flow_commands shape

RuleDetail
Outer arraySlots indexed by {@cN}
Each slotA command array (may hold several commands)
{@c1}flow_commands[0]
Missing slotWarning; no run
Script sugarMid-line […] appends a one-command batch and inserts {@cN}
"flow_commands": [
  [{ "type": "sfx", "value": "click" }],
  [
    { "type": "char", "name": "hana", "expression": "happy" },
    { "type": "sfx", "value": "whoosh" }
  ]
]

Text: "A.{@c1} B.{@c2} C."

Script forms

ConstructMaps to
[bg …] before spoken textEnter commands
[…] after text has startedNew flow_commands slot + {@cN} in assembled text
[exit: …]Append to exit_commands
[exit_delay N]exit_delay
[flag = …]set (not a command)
-> targetnext (not a command)

Full script map: script.txt syntax.

jump and batches

RuleDetail
WhenAfter the current batch finishes
WinnerFirst jump / effective jump_if in that batch
Enter jumpLeaves before the rest of the line plays
Flow jumpStops further typing on that line; transfers immediately
Exit jumpSkips normal advance / choice target after the exit batch
Linear nextNot a command — use only outside batches

jump · jump_if · call · return.

Command meta when

FieldTypeEffect
whenexpressionSkip that command if falsy / eval error; rest of batch continues

JSON / Mode B overlay only — no [when …] in script.txt. Same expression language as next_if / expressions.

vs other conditionals

ToolJob
Choice rules.show_if / disable_ifMenu option visibility / enable
next_if / jump_ifWhere the story goes
Command whenRun or skip that side effect

Cases

Conditional chrome (mutually exclusive packs):

{ "type": "choice_style", "profile": "choice_plain", "when": "chose_skin == \"plain\"" }
{ "type": "choice_style", "profile": "choice_button", "when": "chose_skin == \"textured\"" }

Conditional SFX / character / flags:

{ "type": "sfx", "value": "alarm", "when": "bomb_armed" }
{ "type": "char", "name": "rival", "show": true, "when": "rival_present" }
{ "type": "set_flag", "values": { "hint": true }, "when": "score < 3" }

Stop a timer only if it was armed (exit_commands or enter batch):

{ "type": "timer", "id": "bomb", "action": "stop", "when": "bomb_armed" }

Pick-item commands use the same meta (after item set, before target):

{
  "text": "Take",
  "target": "NEXT",
  "commands": [
    { "type": "sfx", "value": "pickup", "when": "!quiet_mode" }
  ]
}

Mode B

Overlay commands are appended after script enter commands. Other batch keys follow normal overlay replace rules. Mode B.

Save note

During exit_delay (after exit commands, before the next node), a save uses the pre-exit snapshot so reload does not land mid-teardown. Save and session.