Counter
This node maintains a numeric count that can be increased, decreased, or reset.
The Counter node is a stateful utility for tracking numbers, scores, or iterations.
The Counter node stores a current count value. It provides simple actions to increment or decrement this value, along with optional limits (min/max) to constrain the range. It is simpler than using a Variable + Addition node loop for basic counting tasks.
Actions
| Signal | Description |
|---|
| Increase Count | Adds 1 to the current count. |
| Decrease Count | Subtracts 1 from the current count. |
| Reset To Start | Resets the count to the value specified in Start Value. |
Configuration
| Data | Description |
|---|
| Start Value | The initial value of the counter. Also used when resetting. Default: 0. |
Limits
| Data | Description |
|---|
| Limits Enabled | Boolean flag. If true, the counter will not go below Min Value or above Max Value. |
| Min Value | The minimum allowed value (inclusive) when limits are enabled. |
| Max Value | The maximum allowed value (inclusive) when limits are enabled. |
Outputs
Data
| Data | Description |
|---|
| Current Count | The current value of the counter. |
Signals
| Signal | Description |
|---|
| Count Changed | Triggered whenever the count value changes. |
Usage
Example Use Cases
- Scoreboard: Track player points.
- Connect "Point Scored" signal to Increase Count.
- Connect Current Count to a Text node.
- Inventory Quantity: Track number of items.
- Enable Limits.
- Set Min Value to 0 (cannot have negative items).
- Set Max Value to 99 (stack limit).
- Pagination: Track current page number.
- Start Value: 1.
- Increase Count: Next Page button.
- Decrease Count: Previous Page button.
Detailed Behavior
- Initialization:
- When the node loads,
Current Count is set to Start Value.
Count Changed fires immediately on initialization if Start Value is set via connection.
- Limits:
- If
Limits Enabled is true:
- Increase Count does nothing if
Current Count >= Max Value.
- Decrease Count does nothing if
Current Count <= Min Value.
- If limits are disabled, the counter can grow/shrink indefinitely (within JS number limits).
- Reset:
- Reset To Start sets
Current Count = Start Value.
- It only fires
Count Changed if the value actually changed (i.e., it wasn't already at the start value).
Troubleshooting
- Counter Stuck: Check if
Limits Enabled is true and if you have reached the Min or Max value.
- Reset Not Working: Ensure
Start Value is set to what you expect.