4. Use numbers for scores and counters
Number stores an amount. Use it for points, attempts, money, time remaining or a puzzle dial. Whole numbers and decimal numbers use the same Value Type.
1. Add a variable with ID score, Name Score and Value Type Number.
2. Keep Leave Blank At Start off and set Initial Number Value to 0.
3. Put it in a Progress folder and apply the record.
4. Add attempts, Name Wind Attempts, type Number, initial value 0, in Workshop. Apply and save the project.
Figure 4. A Number starting at zero. Zero is a useful starting amount; it does not mean the value is missing.
Set an amount or change an amount?#
Set Variable with a value of 10 replaces the current score with 10. Change Variable with Operation add and Value 10 adds ten to whatever the score is now. For a reward, you usually want the second one.
| Before | Action | After |
|---|---|---|
| score = 7 | Set Variable → 10 | score = 10 |
| score = 7 | Change Variable → add 10 | score = 17 |
| attempts = 0 | Change Variable → add 1 | attempts = 1 |
Arithmetic actions may display a whole amount as 10.0. It is still the number ten. A display-formatting choice is separate from the value’s type. Typing the quoted text "10" in a JSON value field makes a String instead.
