### Dice Roller Example

Posted:

**Tue May 01, 2018 7:30 pm**I made some dice which you can roll to illustrate how you can use Rand(0,X) to simulate dice rolling. I store the result in an integer property on the dice which you can examine after you have rolled once. If you look in the roll dice task you will see I make use of %number1% and %number2% to capture the number of dice and how many sides they should have. Restrictions enforce realistic dice of 4, 6, 8, 12, 20, and 100 sides.

- adrift Code: Select all
`Game Parlor`

You can roll dice here using the syntax XDY, where X is the number of dice and Y is how many sides it has. I have restricted it to realistic dice of 4, 6, 8, 12, 20, and 100 sides.

For example, 'roll 3D6' would roll three six-sided dice, giving you a sum total between 3 and 18.

> roll 3d6

You rolled 3 6-sided dice and got 6.

> roll 3d6

You rolled 3 6-sided dice and got 10.

> roll 3d6

You rolled 3 6-sided dice and got 13.

> x dice

An assortment of dice with different numbers of sides used for gaming.

To use them try 'roll xDy' where x is the number of dice you want to roll and y is the number of sides each dice should have.

Your last roll result was 13.

> roll 2d100

You rolled 2 100-sided dice and got 67.

> roll 5d20

You rolled 5 20-sided dice and got 98.

> roll 3d9

You only have 4, 6, 8, 12, 20, or 100 sided dice to roll with.