Google Apps Scripts custom spreadsheet methods for roleplaying character sheets.
It describes a roleplaying dice throw. It is a string that is formatted like this: 3d6 + d3 + 5.
Contains zero or more dices and can include a constant.
Examples:
3d6 + d3 + 51d6d6 - 14
Current features / limitations:
- Whitespaces are removed in the parsing step.
- Supports
k,K,dandDdice markers in the parsing step. - Supports substraction.
1dXcan be shortened todX.- The first token must be positive.
Function: DICECOUNT
Input: a dice expression to evaulate.
Returns the number of dices used in a 'dice expression'.
Usage: DICECOUNT("3d6 + d3 + 5") will return 4 since there are 3 d6 dices and 1 d3 dice. 3 + 1 = 4
Function: DICESUM
Input: a list of dice expressions.
Returns the sum of multiple dice expressions.
Usage: DICESUM("3d6 + d3 + 5"; "d3 + 2"; "1") will return 3d6 + 2d3 + 8
Function: DICESUM2
Input: a dice marker, like d in 3d6. Currently only supports k, K, d and D.
Input: a list of dice expressions.
Returns the sum of multiple dice expressions.
Usage: DICESUM2("k"; "3d6 + d3 + 5"; "d3 + 2"; "1") will return 3k6 + 2k3 + 8