New Plugin: Dice Roller - inline dice rolling

Hello! I use Obsidian to run my Dungeons and Dragons campaign, and thought it would be nice to be able to define dice formulas in edit view, that are calculated in preview view:

`dice: 2d4` becomes image

Clicking on the result in preview view will then re-roll it.

Pretty simple, but it supports full order of operations and combination of dice/static numbers, so you can do basically anything you want:

`dice: 3d20 + 2d7 - (3d4 * 1d4) - 2^(2d4 - 2)`

Check it out here:


Incredible what ideas you come up with! :grin: A dice roller within Obsidian! I may have to scrap good ole Linux rolldice now …

Thanks :slight_smile:

I just released an update that adds a tooltip with the formula and the individual dice rolls.


I’m going to also add support for conditional parameters on the dice formula, but wanted to open a discussion on how to format them. I’m thinking:

  • dice: 1d6|<3 or dice: 1d6|>4 → pass (green) or fail (red) class added to result in preview
  • dice: 6d6|l2 → roll 6d6 but drop lowest 2
  • dice: 6d6|h2 → roll 6d6 but drop highest 2
  • Any others?

These would be chainable by just adding more pipes, and I think it would be ideal if you could specify them globally or per-dice (perhaps the pass/fail conditionals would just add 0 if the result fails).

1 Like

How do you roll a d%?
I’d love to see what other tools are available. I’ve added all the dice to a template for quick access.

What other ideas do you have?

You can just roll a 1d100. I haven’t limited the dice you can roll; it will do anything you tell it to.

1 Like

Thanks for the response. :slight_smile:

Do you have an example of a note taking method, templates or system that you use for DM’ing or campaign structure?

First, I write out a 3-4 sentence campaign description to get the overall plot of the campaign, then generate a three act structure with 3-4 sentence act descriptions.

Then I make an adventure plot table to create high-level overviews of adventures that will take place in the acts. This lets me keep a goal in mind while not spending much time building anything specific.

I use the overviews to create the actual adventures in a nearly just-in-time method. Usually I’m working one adventure ahead, although sometimes I’ll work on the adventure they’re currently running, just depends on how much free time I have. I like these adventures to take anywhere from 2-3 sessions, so I try to plan for that. I start out with a 3 Step Plan for whatever the big bad of the adventure is, and then I think about what the players need to do to disrupt each step of the plan. Example from the current adventure my players are on, which I’m still working on:

Step Plan
Start: A Rakshasa, Rabar is in Q’Barra trying to free Masrivik and needs a sacrifice
Step 1: Blackscale Lizardfolk are patrolling the Adder River to kidnap travelers
Step 2: Kidnapped travelers are taken to Haka’Torvhak
Step 3: A sacrificial ritual is conducted, led by Rabar
End: Rhashaak awakens Haka’Torvhak and releases its destruction

These adventures are mostly just layered 5 room dungeons, unless I want a dungeon crawl or skill challenge or whatever. I use this 5 room dungeon approach to build a session story structure, but in-session I actually mostly improv, but doing all the previous work lets me improv towards a specific goal.

Hope that helps!

1 Like

Typically, most dice bots use k or kh for keep highest, and kl for keep lowest.
4d6kh3 / 4d6k3 would let you keep the highest three dice of four rolled, whereas rolling 2d20kl1 would be rolling twice and taking the lowest.

1 Like

I think kh or kl would be easiest to use as well.
@valentine.195 I like the pipe method as well.

Do you have a plugin for creating random tables that a user can fill? Perhaps something like your dice roller where you can click a button and the results change? Just a thought. Thank you.

Not yet, but that’s on my list too.

1 Like

Great! I’m really enjoying the Dice roller. I’m going to try it in my upcoming game.

For this vault, I’m imagining a customizable DM screen that’s like a Control panel full of useful information and interactive tables and menus.

I need to figure out your maps leaflet plugin next.

I wonder if anyone has made any generic PC Sheets too.

Thanks for the great plugin. I’ll keep looking for more updates.

2.0.0 released!

Added several dice modifiers. More are planned, including conditional modifiers / pass & fail conditions.

If a modifier has a parameter, it will default to 1 if not provided.

Available modifiers at the moment:
Min/Max: Xd[Y, Z] - Roll a dice with minimum Y, maximum Z.
Keep Highest:k{n}/kh{n} - Keep highest {n} dice.
Keep Lowest: kl{n} - Keep lowest {n} dice.
Drop Lowest: d{n}/dl{n} - Drop lowest {n} dice.
Drop Highest: dh{n} - Drop highest {n} dice.
Explode - !{n}, !i - Explode dice {n} times. If i is provided, will explode “infinitely”
Explode & Combine: !!{n}, !!i - Exploded dice are summed in the display
Re-roll: r{n}, ri - Re-roll a minimum dice {n} times. If i is provided, will re-roll “infinitely” (capped at 100).


Nice. This is a pretty amazing plugin.

I haven’t had the need to use dice like this for a good many years. This plugin is so awesome I had to install it just for fun!

It’s amazing to see what kinds of things people come up with. Well done @valentine.195 !!

@Erisred, I’m using this plugin for the sessions I’m running, for prep and play.

Also, there’s a type of play option called solo play for ttrpgs (table top rpgs). Look it up. There’s two main reddits devoted to it. It’s pretty cool. I’ve actually been using the solo play tools in my games and to test my homebrew ruleset and adventures.

You might like it if you have any systems you enjoy playing, but not a gaming group.

@valentine.195 Keep up the good work. Thanks for the 2.0 update. It’s working pretty well.

1 Like

Is there a way for this plugin to work on the obsidian publish site via web?

It works in obsidian desktop and mobile, but not when I publish it and view it on obsidian publish.

Thank you!

Not sure–I don’t have Obsidian publish. Do other plugins work on publish?

Hello! I just released 3.0.0, which added support for the following:

  1. Fudge/fate dice (XdF)
  2. Percentile dice (Xd%)
  3. Negative dice (Xd-Y or Xd[-Y, Z])
  4. Chainable conditions on explode and re-roll modifiers:
    • This allows you to change what is exploded or re-rolled. For example, instead of re-rolling minimum values, you can use 1d2r=2 to re-roll rolls equal to 2.
    • Supports =, != (or =!), <, >, <=, and >=

The last few features I’m currently thinking about adding are a way to add pass/fail states to both the dice-roll results and the overall total, and a side-bar dice roller or command so you don’t have to put everything in the text of a note to roll it.

Let me know if there’s any other features you’d like to see added!

1 Like

Hi Valentine, thank you for this plugin! I’m having fun playing with it.

I think there may be a bug. I have a page with the content:

`dice: 3d4 + 3`

and rendering the page crashes with the following error:

Error: Unexpected character at index 4: 3
    at Lexer.defunct (eval at <anonymous> (app.js:1), <anonymous>:53:11)
    at Lexer.lex (eval at <anonymous> (app.js:1), <anonymous>:135:41)
    at DiceRoller.parse (eval at <anonymous> (app.js:1), <anonymous>:1628:36)
    at DiceRoller.parseDice (eval at <anonymous> (app.js:1), <anonymous>:1548:14)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:1352:53)
    at NodeList.forEach (<anonymous>)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:1345:26)
    at Function.t.postProcess (app.js:1)
    at t.postProcess (app.js:1)
    at p (app.js:1)

A dice phrase without addition works fine, e.g. dice: 3d4