Change a number
Add to, subtract from, multiply, divide or set a number variable.
data.math changes a number variable by an amount, which can be a number or an equation.
Settings
| Setting | What it does |
|---|---|
| Variable | The number variable to change. |
| Operation | Add, Subtract, Multiply by, Divide by or Set to. The default is Add. |
| Amount | A number, or an equation such as {var.level} * 10 (see Work out an equation). The default is 1. |
Ways out
out. Turn on If it fails for a red way out, which is also taken when the amount isn't a number or divides by zero.
Notes
- Adding and subtracting are atomic: two runs adding at once both count. Multiplying, dividing and setting read the value and write it back, so put One run at a time first if runs could clash.
- The canvas shows the change, such as
{var.score} + 1. - This node replaces Run equation on variable: Set to with an equation does the same. Flows that have the older node keep working.
Example
Add 1 to a member variable named messages each time they send a message.