You find both in the Steps tab of the block list. Or type their name into the block search.
Save a value
Use it when you want to put something new in the box.1
Add the block
Drag Save a value onto the board and connect it with a line.
2
Pick the variable
In the settings on the right, pick the variable to change, like
favourite_colour.3
Pick whose variable (User variables only)
If it is a User variable, Whose variable asks which member’s box to change. Usually that is the person who used the command. You can also pick someone else, for example the member chosen in a User input, so
/give-role @Alex changes Alex’s box.4
Type the new value
Type what goes in the box. You can use other variables here too, like
{user_name}.Do the maths
Use it for numbers: coins, XP, levels, counters.1
Add the block
Drag Do the maths onto the board and connect it.
2
Pick the variable
Pick a Number variable (or a User variable that stores numbers), like
coins.3
Pick whose variable
Just like Save a value, pick which member’s box to change.
4
Write the maths
Write what should happen. For example:
- add 100 coins:
+ 100 - take away 50 coins:
- 50 - double the XP:
* 2 - halve it:
/ 2
5
Rounding
If your maths can make a number with a dot (like
12.5), use Rounding to choose what happens to it, so coins stay whole numbers.The Key box (for Objects)
Both blocks have an optional Key box. It is for variables that hold an Object (a box with smaller boxes inside).- Key empty: the block changes the whole value.
- Key filled, like
coins: the block only changes that one small box inside, likeprofile.coins.
Object operation
When the variable is an Object, Save a value asks what you want to do:
The block on the board then says what it does, for example Remove shop.coins, so you can read your board at a glance.
Clearing a value
To wipe a value back to empty, use the block that deletes the value of a custom variable. Typedelete into the block search to find it. This only empties the value. The variable itself stays on the Database page.
A tiny example: a /coin-flip that pays out
- Slash command
/coin-flip - Random chance (a Check) set to 50%
- On the yes path: Do the maths on
coins,+ 10, whose variable: the person who used it. Then Reply:Heads! You won 10 coins. You now have {DBVAR_coins}. - On the else path: Reply:
Tails! Better luck next time.
A value you change in a block is saved at once. Any block after it already sees the new value.
