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
- CurrentHour: hour of the day, 0-23.
- CurrentMinute: minute of the hour, 0-59.
- CurrentTimeBucket: the active time-of-day bucket (e.g. ‘morning’).
- AbsoluteMinutes: total minutes elapsed since the run started.
- TimeSinceSceneStart: minutes since this scene visit began.
- Day: day number, 1-indexed, increments at midnight.
- DaysSinceStart:
Day() - 1, for arithmetic. - AbsoluteDay: alias of
Day(). - IsTimeBefore: strictly before a clock time.
- IsTimeAfter: at or after a clock time.
- IsTimeBetween: inside a half-open clock-time window.
- MinutesUntil: minutes until the next occurrence of a clock time.
- FromMinutes: duration constructor, identity.
- FromHours: duration constructor, hours to minutes.
- FromDays: duration constructor, days to minutes.
- MinutesPart: minutes component of a duration.
- HoursPart: hours component of a duration.
- DaysPart: days component of a duration.
- TotalHours: whole hours in a duration.
- TotalDays: whole days in a duration.
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.
- AbsoluteDay Alias of Day(); naming symmetry with AbsoluteMinutes().
- AbsoluteMinutes Total minutes elapsed since session start (monotonic; not clock-of-day).
- 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.
- CurrentHour Hour of the day, 0-23.
- CurrentMinute Minute of the hour, 0-59.
- CurrentTimeBucket Returns the current time-of-day bucket (e.g. 'morning', 'evening').
- Cycle Cycle(slotKey, list) — advances through the list each call (stateful, persisted in saves).
- Day Day number, 1-indexed; increments when the clock crosses midnight.
- DaysPart Days component of a duration (d / 1440); preserves sign.
- DaysSinceStart Day() - 1 — 0-indexed day count for arithmetic.
- EndsWith Suffix check (case-sensitive).
- EndsWithI Suffix check (case-insensitive).
- Floor Floor to integer.
- FromDays Duration constructor: days to minutes (n * 1440).
- FromHours Duration constructor: hours to minutes (n * 60).
- FromMinutes Duration constructor: identity, kept for readability.
- Has List membership — Has(list, value).
- HasTag True if the named node carries the given tag.
- HoursPart Hours component of a duration ((d mod 1440) / 60); preserves sign.
- 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.
- IsTimeBetween True in the half-open window [start, end); crosses midnight when end is earlier than start.
- 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.
- MinutesPart Minutes component of a duration (d mod 60); preserves sign.
- MinutesUntil Minutes until the next occurrence of the given clock time; 0 when exactly now.
- 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.
- 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.
- TimeSinceSceneStart Minutes since the current visit of the active scene began; int.MaxValue when no scene is active.
- TotalDays Whole days in a duration (d / 1440).
- TotalHours Whole hours in a duration (d / 60) — floor of the larger unit, for arithmetic.
- 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).