Skip to reading
The Variable Designer

4. Use numbers for scores and counters

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView illustrations

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.

Source table from 4. Use numbers for scores and counters, page 8
BeforeActionAfter
score = 7Set Variable → 10score = 10
score = 7Change Variable → add 10score = 17
attempts = 0Change Variable → add 1attempts = 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.

Page 8 of 37Permalink
Go to page