Dice Functions for Mocha


integer dice_val.roll;
Rolls the dice described by dice_val and returns the result.

integer dice_val.number;
Returns the number of dice (e.g., 3D8+4 uses 3 dice).

integer dice_val.type;
Returns the type of dice (e.g., 3D8+4 uses 8-sided dice).

integer dice_val.add;
Returns the modifier to the base dice (e.g., 3D8+4 adds 4 to the roll of 3D8).

integer dice_val.average;
Returns the average roll for a set of dice. Since the function returns an integer, fractional averages are discarded--use the power function below to return fractional averages.

integer dice_val.power;
Returns twice the average roll for a set of dice (a value which is always an integer).

dice make_dice (integer number, integer type, integer add);
Make a dice value given the number and type of dice and the modifier for the roll. The number of dice must be in the range 0 to 127; the type of dice must be in the range 1 to 127; the modifier must be in the range -128 to 127.


Return to Mocha's Main Page