State Machine
Define named states and the transitions between them.
What it does
State Machine holds a set of named states, each with its own duration, and moves between them on cue. Advance it with a pulse, jump straight to a named or numbered state, or reset it to the start. It reports which state is current, how far along it is, and fires a one-frame pulse the instant a transition happens.
A plain step-through sequencer is a State Machine where every state leads to the next in order, so simple "step 1, step 2, step 3" progressions are covered here alongside branch-and-loop cue logic.
When to use it
Named stages for a scene, UI panel, or interactive cue (idle → active → cooldown), triggered, timed, and queried from one place.
A state that holds indefinitely until something moves it on.
Jumping to a specific stage by name or index from a button, a key, or elsewhere in the graph.
Looping a sequence, ping-ponging through it, or stopping dead on the last stage.
| Parameter | Type | Default |
|---|---|---|
advance | OneOf([Boolean, Number]) | — |
goto | OneOf([String, Number]) | — |
reset | Any | — |
states | String | "A, B, C" |
durations | String | "0, 0, 0" |
wrap_mode | String | "Loop" |
initial_state | Number | 0 |
threshold | Number | 0.500 |
Gotchas
Initial State is a plain index with no awareness of how many states are typed into States. Set it higher than the state list and there is nothing valid to land on. Keep it inside the range of the comma-separated list.
A duration of 0 means hold until triggered: that state never advances on its own, and Progress and Elapsed only carry meaning once a state has a duration greater than zero. At 0 the state waits for Advance or Goto.
Goto always wins. If Goto and Advance both fire on the same frame, the jump happens and the pulse on Advance is ignored for that frame.
Advance is edge-detected against Threshold rather than read as an on/off switch. For an analogue or noisy signal rather than a clean pulse, raise or lower Threshold so it only crosses on the intended transition.
Worked example
Add a State Machine. Set States to
idle, active, cooldownand Durations to0, 2, 1: idle waits, active runs for 2 seconds, cooldown runs for 1.Wire a button or key press into Advance to step idle → active → cooldown.
Read State and Index elsewhere in the graph to drive what is shown; use Changed as a one-frame trigger for a sound or flash on every transition.
Set Wrap Mode to Loop to cycle continuously, or to Reset to snap back to idle and stop after cooldown finishes.
See also
Step Sequencer · Timeline · Delay · Numbers, signals & audio