Sequencer (Flowgraph Node)
- **Node Name:** `Sequencer`
Overview
- Node Name:
Sequencer - Category:
logic - File:
extensions/flowgraph/nodes/logic/sequencer.lua
Sequences flow across multiple output pins using configurable modes (loop, random, once, pingpong) and increment strategies (auto, manual, select).
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Inflow for this node |
In manual mode, additional pins appear:
next(flow),reset(flow),count(number). In select mode:index(number).
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Outflow for this node |
currentIndex | number | Current index in the sequence (hidden) |
maxIndex | number | Maximum index (hidden) |
totalIndex | number | Total unrestrained index (hidden) |
value_1 | flow | Flow output for index 1 |
Additional
value_Noutput pins are created via the Count property.
Sequence Modes
| Mode | Description |
|---|---|
loop | Wraps around: 1 + ((index-1) % count) |
random | Random index each step |
once | Plays through once without wrapping |
pingpong | Bounces back and forth: 1→2→3→2→1→... |
Increment Modes
| Mode | Description |
|---|---|
auto | Index increments every frame automatically |
manual | Index advances via next pin, resets via reset pin |
select | Index is directly set from the index input pin |
Behavior
init()- Sets count=1, mode=loop, incMode=auto, index=1._executionStarted()- Resets index to 0.work()- Increments index based on increment mode, applies sequence mode function, and activates the matching output pin. Only onevalue_Npin is true at a time.updatePins(old, new)- Adds/removesvalue_Noutput pins.updateMode(m)- Adds/removes mode-specific input pins (next, reset, count, index).
How It Works
Each frame (or manual trigger), the index advances. The sequence mode function maps the raw index to an output slot number. Only the matching value_N pin outputs true. The currentIndex output shows which slot is active, while totalIndex shows the raw counter.
Example Usage
-- Cycle through 3 camera angles every frame:
-- count = 3, mode = loop, incMode = auto
-- value_1, value_2, value_3 fire in sequence: 1,2,3,1,2,3,...
-- Random dialogue selection:
-- count = 4, mode = random, incMode = manual
-- Connect "next" to a button press
-- Each press randomly selects one of 4 dialogue outputsAdditional Methods
C:_onDeserialized(res)
Called after the node is deserialized (loaded from file). Restores runtime state from saved data.
Parameters:
res
C:_onSerialize(res)
Called when the node is serialized (saved to file). Returns data to persist.
Parameters:
res
C:drawCustomProperties()
Custom ImGui drawing for the node's properties panel in the editor.
C:drawMiddle(builder, style)
Custom ImGui drawing in the middle section of the node in the editor.
Parameters:
builderstyle
See Also
- And (Flowgraph Node) - Related reference
- Boolean Expression (Flowgraph Node) - Related reference
- Branch (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide