Miłosz Kucharski18 downloadsBuild RPG dice roll commands with d20 syntax for Discord and Roll20. Create formulas visually with advantage/disadvantage support.
An Obsidian plugin for building RPG dice roll commands with d20 syntax. Create dice formulas visually with advantage/disadvantage support for Discord and Roll20.
ROLL[formula] syntaxThere are three ways to open the dice roller:
The dice roller will open in the right sidebar.
Add dice - Click the buttons next to each die type (d4, d6, d8, d10, d12, d20, d100)
+ to add dice with a positive modifier- to subtract dice (rare, but supported)Add modifiers - Enter a number in the modifier input
+ to add a positive modifier- to subtract a modifierSet advantage/disadvantage - Click "Advantage" or "Disadvantage" buttons
Advanced operations - You can add d20 grammar operations manually
2d6kh1 (keep highest), 1d20ro<5 (reroll once if less than 5)Once you've built your formula, you have several options:
.r 2d6 + 1d4 + 3)`ROLL[2d6+3]`)You can embed dice formulas in your notes using the ROLL[...] syntax:
Attack the goblin: `ROLL[1d20+5]`
Deal damage: `ROLL[2d6+3]`
Fireball damage: `ROLL[8d6]`
In reading mode, these become clickable. When clicked:
The dice roller automatically scans your open notes for:
ROLL[formula] instancesFound formulas appear in the "Suggestions" section:
This plugin supports the full d20 dice rolling grammar. Add operations directly after dice notation:
2d20kh1 - Keep highest 1 (advantage)2d20kl1 - Keep lowest 1 (disadvantage)4d6kh3 - Keep highest 3 (ability score generation)4d6p1 - Drop lowest 1 (same as above, different syntax)1d20ro<5 - Reroll once if less than 51d6rr<3 - Reroll repeatedly until not less than 31d20ra=1 - Reroll and add if exactly 1 (critical fumble recovery)1d6e=6 - Explode on 6 (roll additional die when you roll max)2d10e>8 - Explode on 9 or 101d20mi10 - Minimum value is 10 (can't roll below 10)1d20ma15 - Maximum value is 15 (can't roll above 15)2d20kh1+5 # Advantage with +5 modifier
4d6kh3 # Standard ability score generation
8d6ro<2 # 8d6 but reroll any 1s once
1d20+2d6e=6+3 # Attack with exploding damage dice
Access settings via Settings → RPG Dice Roller
Choose whether commands are formatted for Discord or Roll20 by default.
The prefix used for Discord bot commands.
.r!roll, /roll, !rThe prefix used for Roll20 commands.
/roll/r1d20 + 5.r 1d20 + 5/roll 1d20 + 51d20 + 5 adv.r 1d20 + 5 adv2d6 + 1d4 + 3.r 2d6 + 1d4 + 38d6kh7 (8d6 but ignore lowest die).r 8d6kh74d6kh3 (roll 4d6, keep highest 3).r 4d6kh3main.js, manifest.json, and styles.css to your vault's plugins folder:<vault>/.obsidian/plugins/rpg-dice-roller/
# Clone the repository
git clone https://github.com/Butterski/obsidian-dnd-dice-auto-command.git
cd obsidian-dnd-dice-auto-command
# Install dependencies
npm install
# Build for development (with watch mode)
npm run dev
# Build for production
npm run build
src/
main.ts # Plugin entry point, lifecycle management
settings.ts # Settings interface and tab
types.ts # TypeScript interfaces
parser.ts # Dice formula parser and validator
processor.ts # Markdown post-processor for ROLL syntax
view.ts # Dice builder UI view
ui/ # UI components
utils/ # Utility functions
manifest.json # Plugin metadata
styles.css # Plugin styles
esbuild.config.mjs # Build configuration
For manual testing, copy the built files to your vault:
cp main.js manifest.json styles.css <vault>/.obsidian/plugins/rpg-dice-roller/
Then reload Obsidian and enable the plugin.
| Syntax | Name | Description |
|---|---|---|
| k | keep | Keeps all matched values |
| p | drop | Drops all matched values |
| rr | reroll | Rerolls all matched values until none match |
| ro | reroll once | Rerolls all matched values once |
| ra | reroll and add | Rerolls up to one matched value once, keeping the original |
| e | explode on | Rolls another die for each matched value |
| mi | minimum | Sets the minimum value of each die |
| ma | maximum | Sets the maximum value of each die |
| Syntax | Name | Description |
|---|---|---|
| X | literal | All values literally equal to X |
| hX | highest X | The highest X values |
| lX | lowest X | The lowest X values |
| >X | greater than X | All values greater than X |
| <X | less than X | All values less than X |
| Syntax | Operation |
|---|---|
| X * Y | multiplication |
| X / Y | division |
| X // Y | integer division |
| X % Y | modulo |
| X + Y | addition |
| X - Y | subtraction |
MIT License - see LICENSE file for details.