Dice language
Core rolls
These cover the bread-and-butter TTRPG rolls—use them for attacks, saves, checks, and ability generation.
- Basic:
<count>d<faces>-1d20,3d8,6d6 - Advantage / disadvantage:
adv,dis-d20 adv + 5,d20 dis - Keep / drop:
kh Nkeep highest,kl Nkeep lowestdh Ndrop highest,dl Ndrop lowest- Example:
4d6 dl 1,3d20 kh 1
- Rerolls:
rr Nreroll matching results until they changero Nreroll once- Example:
2d6 rr 1 rr 2,4d6 ro 1
Attacks and crits
Add attack when the d20 roll is an attack check; that unlocks crit awareness and the .crit flag on named rolls. Pair it with on-crit modes to describe how damage scales.
- Mark an attack: add
attackto a d20 roll. The engine preserves the natural d20 so you can reference it later. - Crit range:
critX..Y(inclusive, 1-20). Example:crit19..20for improved crit features. - On-crit damage modes (choose how to scale damage):
oncrit double_dice— roll damage dice again and add them.oncrit double_all— double the entire damage expression (dice + flat bonuses).oncrit max_second_dice— add the maximum value of the extra dice (good for swingy weapons).
Arithmetic, logic, and ternary
Use math to stack bonuses, logic to gate effects, and the ternary to model “hit-or-miss” or “save-for-half” rules.
- Arithmetic:
+,-,* - Comparisons:
>,<,>=,<=,==return1(true) or0(false). - Logic operators:
&(and),|(or),!(not). - Ternary:
condition ? then : else(else defaults to0). Great for branching damage or conditional riders. - Repeat:
^repeats and sums an expression. Example:(1d6)^3rolls 1d6 three times and adds the results.
Named rolls and properties
- Bind once:
<roll> as <name>— the left side must evaluate to a single dice (e.g.,d20 attack,1d8,3d6 kh 1). You cannot bind full expressions like(d20 + 5); bind the roll, then add math later. - Properties:
<name>.total- final total including modifiers if any<name>.roll- natural roll for that binding<name>.crit- 1 if the attack crit, else 0 (only valid on attack bindings)
Commands (type in a cell or simple mode)
let <name> = <expr>- create an alias. Example:let smite = 2d8.analyze <expr>- show a PMF for one or more comma-separated expressions.
Example:analyze 3d6, 2d20 kh 1 + 5
Need character data? Use the UI “Import from D&D Beyond” form; imports are handled outside notebook cells.
Comments
- Start a line with
#to leave a note. Comments are ignored when rolling or analyzing.