Change Broadcaster Variable
Runs on: Backend.
Adds to or subtracts from a Streamer Variable that holds a number or a degrading number. Use it for counters, points and countdowns.
Events that land at the same moment never overwrite each other's change. Reading with a Broadcaster Variable node, adding with a Math node and writing back with Set Broadcaster Variable can lose a change when two events arrive together.
Configuration
- Variable (required): The variable to change. Only Number and Degrading number variables are listed.
- Operation: Add or Subtract.
- Minimum: The lowest value allowed. Tick the box to set one.
- Maximum: The highest value allowed. Tick the box to set one.
Limits only stop movement in the direction it is going. If a value is already above the Maximum, Add won't pull it back down.
For a degrading number, the change is added to the current (already decayed) value.
Inputs
| Name | Type | Description |
|---|---|---|
Activate | pulse | Fires the effect even when every other input is typed in. |
Amount | number | How much to add or subtract. A connected input wins over the typed value. A negative amount under Add subtracts. |
Outputs
| Name | Type | Description |
|---|---|---|
Value | number | The new value of the variable. |
Then | pulse | Fires after the effect runs. Wire it into another effect's Activate to sequence them. |
The effect fails and writes nothing if the variable is missing, isn't a number or degrading number, the amount isn't a number, or the Minimum is above the Maximum.
Example
Count deaths with a deaths Number variable. Add a Chat Command trigger for death and a Change Broadcaster Variable effect set to deaths, Add, Amount 1. Wire Value into a Generate Text node and send it to chat.
To convert before changing, put an Advanced Math node in front of Amount. For example, round(a * 0.6) turns bits into whole seconds for a Countdown Timer.