Rolling Dices by Johan Paz begins here.
"This extension allows express set of dices as a value and rolling them"
A roll is a kind of value. 99d99+99 specifies a roll with parts dices, sides and pluses (optional, preamble optional).
To decide which number is the roll of (dices - a roll):
let numPart be the dices part of dices;
let sidePart be the sides part of dices;
let randomPart be 0;
repeat with index running from 1 to numPart:
increase randomPart by a random number from 1 to sidePart;
increase randomPart by the pluses part of dices;
decide on randomPart.
To decide which number is the roll of d%:
decide on a random number from 1 to 100.
Rolling Dices ends here.
---- DOCUMENTATION ----
This extension allows express set of dices as a value and rolling them.
For defining a roll just use:
3d4+3
For instance, in:
say "You roll the six faced dice obtaining [roll of 1d6]."
Example: * Rolling dices - a very simple example of rolling dices
Take and roll the dices
*: "Dices"
Include Rolling Dices by Johan Paz.
Rolling site is a room.
A dice (m) is a kind of thing. A dice has a roll called dice roll.
A four sided dice is a dice in rolling site. The dice roll of four sided dice is 1d4.
A six sided dice is a dice in rolling site. The dice roll of six sided dice is 1d6.
A eight sided dice is a dice in rolling site. The dice roll of eight sided dice is 1d8.
Dice rolling is an action applying to nothing.
Understand "roll dices" as dice rolling.
Carry out dice rolling:
let total be 0;
repeat with dice running through dices carried by player:
let result be roll of dice roll of dice;
say "You roll the [dice]... obtaining [result].";
increase total by result;
say "The total is [total].".
Test me with "take four sided dice / roll dices / take six sided dice / roll dices / drop all / take all / roll dices".