How-to
Use random numbers
Set a number tag to a random number in a range, such as a dice roll from 1 to 6.
Before you start
- Have a number tag to hold the number, held by the adventure: Value tags, Adventure details › Tags.
- Open the logic where the roll happens, such as a line's On Tap Logic, and click Add.
Steps
In the Result window, next to Outcomes, click Add.
Click Adventure. In the Adventure column, click Tags, then your tag. Leave =.
In the second row, click Random Number. Dice Setup shows Random Range, with From and To.
In From and To, type the lowest and highest numbers, such as
1and6: in each box, click, pressCtrl+A(⌘Aon a Mac), type and pressEnter.
Click Save in the Outcome window, then in the others.
Clicking Adventure also shows a second row with its own Tags. That row belongs to another outcome, Add. Use Tags in the Adventure column.
Check it worked
The line reads Adventure → Tag '…' = 'Random(1 to 6)' with your tag. Play-test a few times: the tag holds a different number from the range. Three playthroughs showing the tag gave 1, 5 and 2.
Good to know
- To use the number, show it in a line (Show a tag's value in a line) or test it in a condition.
- A tag with a Maximum or Minimum stays within them, whatever the roll: Make a number tag with a maximum.