#
roll() function
The roll()
function is a rpg dice roller that allows for various user inputs and responds with an object of data. For basic usage instructions of roll
check out Use the Roll function.
#
Calling the roll() function
When calling the roll
function there are two way to do it. Either by passing the function nothing, or a string. If an empty string is passed it will count as nothing as well.
roll()
roll("1d20 + 5")
#
Valid Inputs
#
Example Inputs
5 - d6 +4D10*2d2
1d20
2d6 + 5
1d20+4*2
#
Output
Calling the roll function will respond with an object with various data types. Like this one:
{
"ok": true,
"input": "1d20 + 5",
"result": "1d20 (8) + 5",
"total": 13,
"resultNoDice": "(8) + 5",
"prefab": "Input: 1d20 + 5 | Result: 1d20 (8) + 5 | Total: 13",
"inputArray": ["1d20", "+", "5"],
"resultArray": ["1d20", "(8)", "+", "5"],
"resultNoDiceArray": ["(8)", "+", "5"],
"totalCrit": 21
}
"1d20 (8) + 5"