dice-roller
This module is designed to do generic dice rolling. It exposes three functions but the most important one is the roll
function.
Basic Usage
To get access to the dice-roller function:
//es2015 imports; //commonjslet roll = ; //scriptlet roll = drroll;
Simple Rolls
Simple rolls look like this.
;//{ text: '18', value: 18 }
Addition and Subtraction
Any addition or subtraction will show you the grouped results of each set of dice.
;//{ text: '10 + 60', value: 70 } ;//{ text: '10 + 13 - 8', value: 15 } //static numbers work too;//{ text: '15 + 2', value: 17 }
Multiplication and Grouping
The "*" symbol must explicitly be used, but it logically groups the "Order of Operations" correctly.
;//{ text: '24 * 10', value: 240 } //{ text: '4 + 5 * 4', value: 24 }
Grouping works too.
;//{ text: '(16 + 12 - 9) * 2', value: 38 }