Expression functions
See Expressions for cross-cutting conventions (identifiers, boolean coercion, scene-scoped vs session-global history).
Play history
- Played: plays this scene visit (0/1 for a node, or a tag’s played count)
- Selected: direct selections this scene visit (0/1 for a node, or a tag’s selected count)
- Seen: times offered as a choice this scene visit (0/1 for a node, or a tag’s seen count)
- PlayedEver: session-global Played
- SelectedEver: session-global Selected
- SeenEver: session-global Seen
- CameFrom: true if a node is in the current jump chain
- Cooldown: minute-based throttle since last play
Graph
- HasTag: node-tag membership
List
- Has: list membership
- Add: append to a list
- Remove: remove from a list
- Count: list length, or tagged-node count
Visibility
- Visible: current visibility of a node (Visible when only)
Scene state
Visit tracking
- Visits: total pushes / arrivals for a scene or location
- TimeSinceLastVisit: minutes since last visit
Math
String
Type
Localization
- Localize: look up a custom-string translation
Time
Stateful slot functions
Each call site keeps per-slot state (a draw index, a cursor, a fired flag) that’s captured in save snapshots and replayed deterministically.
- Pick: stable random pick from a list
- Cycle: advance through a list, wrapping at the end
- Once: fire a value the first time, then an empty string
Conditional
- If: pick one of two values based on a condition, evaluating only the chosen branch
- Abs Absolute value.
- Add Append to a list (returns new list).
- Bool Coerce to bool.
- CameFrom True if the previous node played matches the argument.
- Ceil Ceiling to integer.
- Clamp Clamp(value, min, max).
- Compare Compare(a, b) — returns -1 if a<b, 0 if a==b, 1 if a>b. Same-type only.
- Completed Completed(scene_id) — true once an explicit completeScene event has fired in this run for the named scene.
- Contains Substring search (case-sensitive).
- ContainsI Substring search (case-insensitive).
- Cooldown Cooldown(name, minutes) — true if N+ minutes have passed since most recent play (or never played).
- Count List length, or number of nodes carrying the given tag.
- Cycle Cycle(slotKey, list) — advances through the list each call (stateful, persisted in saves).
- EndsWith Suffix check (case-sensitive).
- EndsWithI Suffix check (case-insensitive).
- Floor Floor to integer.
- Has List membership — Has(list, value).
- HasTag True if the named node carries the given tag.
- If If(cond, then, else) — returns `then` if cond is truthy, else `else`. Lazy in both interpreted and compiled modes.
- Int Coerce to int (truncating).
- IsTimeAfter True if the current time is at or after the given clock time.
- IsTimeBefore True if the current time is before the given clock time.
- Length String length.
- Localize Returns the localized source text for a custom string (text_*).
- Lower Lowercase a string.
- Max Maximum of the supplied numbers.
- Min Minimum of the supplied numbers.
- MinutesSinceStart Minutes elapsed since the conversation began.
- Once Once(slotKey, value) — returns value first time, empty string thereafter (stateful).
- Pick Pick(slotKey, list) — deterministic random pick (per slot + run seed).
- Played Plays of a node this scene visit (0 or 1), or for a tag argument the count of distinct tagged nodes that have played. Boolean-coerces (0 = false, nonzero = true).
- PlayedEver Plays of a node across the whole run (0 or 1), or for a tag argument the count of distinct tagged nodes that have played. Session-global; unaffected by scene push/pop. Boolean-coerces.
- Random Uniform random decimal in [0, 1). Use RandomRange for typed integer or decimal ranges.
- RandomRange RandomRange(int, int) — [min, max) integer (Unity-style, exclusive max).
- Remove Remove from a list (returns new list).
- Resolved True if the scene's resolvedWhen expression evaluates true (spec §5).
- Round Round to nearest integer (halves round away from zero).
- Seen Visibility of a node in this scene visit's choice set (0 or 1), or for a tag argument the count of distinct tagged nodes that have appeared in the visible-choice set. Boolean-coerces.
- SeenEver Visibility of a node in the choice set at any point across the run (0 or 1), or for a tag argument the count of distinct tagged nodes the player has ever seen in a choice set. Session-global. Boolean-coerces.
- Selected Player selections of a node this scene visit (0 or 1), or for a tag argument the count of distinct tagged nodes the player has selected. Boolean-coerces.
- SelectedEver Player selections of a node across the whole run (0 or 1), or for a tag argument the count of distinct tagged nodes the player has selected. Session-global. Boolean-coerces.
- StartsWith Prefix check (case-sensitive).
- StartsWithI Prefix check (case-insensitive).
- Str Coerce to string.
- TimeBucket Returns the current time-of-day bucket (e.g. 'morning', 'evening').
- TimeSinceLastVisit TimeSinceLastVisit(scene_id|location_id) — minutes since most recent push/arrival, or int.MaxValue if never visited. Pair with Visits > 0 for 'have visited AND was a while ago' semantics.
- Upper Uppercase a string.
- Visible True if the named node is currently visible.
- Visits Visits(scene_id|location_id) — total scene pushes or location arrivals (session-global, increments on push/arrival before intro fires).