Skip to content

State Counter Nodes

Increment a numeric state variable in place and restart it at a reset cap, with a conditional and a path variant. The variable lives in a scope like every other state variable; see State Nodes for reading, setting and unsetting it, and States for the scopes.

3 nodes.

Node Registry path
Counter State (Conditional) state/ConditionalCounterState
State Counter state/CounterState
State Counter (Path) state/CounterStatePath

Counter State (Conditional)

state/ConditionalCounterState

Counter node that increments a numeric value in the state and returns the new value.

Provides a required state input causing the node to only run when a state is provided

Inputs

Input Type Description
state any
name str (optional)
reset bool (optional)
reset_cap number (optional)

Outputs

Output Type Description
state any
name str
value any
scope str
reset_cap number
reset bool
new_cycle bool

Properties

Property Type Default Description
name str unset The name of the variable to manipulate
scope str "local" Which scope to manipulate. Choices: local, parent, shared, scene loop, game.
increment number 1 The amount to increment the value by. Min: 1.
reset bool False If true, the value will be reset to 0
reset_cap number 0 If set (> 0), the counter resets to 0 once the value reaches this cap

State Counter

state/CounterState

Counter node that increments a numeric value in the state and returns the new value.

Inputs

Input Type Description
state any required state input (conditional execution)
name str (optional) The key to the value to increment
reset bool (optional) If true, the value will be reset to 0
reset_cap number (optional) If set, the counter resets to 0 once it reaches this value

Outputs

Output Type Description
state any the state that was passed in
name str The key that was used
value any The new value
scope str The scope that was used
reset_cap number The reset cap that was used
reset bool Whether the counter was reset
new_cycle bool True if the counter was at 0 before this run

Properties

Property Type Default Description
name str unset The name of the variable to manipulate
scope str "local" Which scope to manipulate. Choices: local, parent, shared, scene loop, game.
increment number 1 The amount to increment the value by. Min: 1.
reset bool False If true, the value will be reset to 0
reset_cap number 0 If set (> 0), the counter resets to 0 once the value reaches this cap

State Counter (Path)

state/CounterStatePath

Counter node that increments a numeric value in the state using a path (e.g., 'a/b/c').

Creates intermediate dictionaries as needed (mkdir -p semantics). Mutating operation - conditional by default with required state input.

Inputs

Input Type Description
state any required state input (conditional execution)
name str (optional) The path key to the value to increment (e.g., 'a/b/c')
reset bool (optional) If true, the value will be reset to 0
reset_cap number (optional) If set, the value will be reset to 0 when it reaches this value

Outputs

Output Type Description
state any the state that was passed in
name str The key that was used
value any The new value
scope str The scope that was used
reset_cap number The reset cap value
reset bool Whether reset occurred
new_cycle bool Whether this is a new cycle (value was 0)

Properties

Property Type Default Description
name str unset The name of the variable to manipulate
scope str "local" Which scope to manipulate. Choices: local, parent, shared, scene loop, game.
increment number 1 The amount to increment the value by. Min: 1.
reset bool False If true, the value will be reset to 0
reset_cap number 0 If set (> 0), the counter resets to 0 once the value reaches this cap