Roll different colored dice

I want to roll one red d10, one blue d10, and one green d10 at the same time. Is there a way to do this? The color of the dice are needed for the rules of my game. I’m using Realm VTT Basic (if that helps).

Hi there!

There is actually a way to designate dice color via the Ruleset API.

It is done by setting “diceColors” in the metadata of a roll and assigning a color by type. Here is an example of how I am doing it an upcoming Ruleset implementation, where a die type of “expertise” has a specific color:

const modifiers = [];
const EXPERTISE_DICE_COLORS2 = {
  "expertise": { "diceColor": "#ff0000", "textColor": "#ffbb00" }
};

const metadata = {
  "diceColors": EXPERTISE_DICE_COLORS2
};

const diceRoll = "1d20 default + 1d4 expertise";

api.promptRoll("Attack", diceRoll, modifiers, metadata, "attack");

(Edit: Fixed macro typos.)

I should also mention, if you’re doing this in Realm VTT Basic (and not the Ruleset Editor) you’ll want to do it in a custom Macro (and then add the macro either to the chat, hot bar, or in a rich text field of a character sheet.)

If you need custom handling for the rolls or custom roll types — such as logic/code that runs when rolling for an attack, or some other type of roll, you’d have to build that out in a custom ruleset.

Is there a way to do this in a macro, without having the Attack box open up? i.e. have it just roll the three different colored d10? I don’t need it attached to any Attribute, Skill, etc roll.

Also, is there a way to have the blue d10 “explode”? (roll over if the result is a 10, and keep adding to the blue total, as long as a 10 keeps getting rolled). I don’t want the red or green to “explode”

Sorry, I’m not great at writing code.

No worries!
You can certainly have it roll without the prompt using something like this, to do d10s:

const modifiers = [];
const DICE_COLORS = {
  "red": { "diceColor": "#ff0000", "textColor": "#ffffff" },
  "blue": { "diceColor": "#0000ff", "textColor": "#ffffff" },

};

const metadata = {
  "diceColors":DICE_COLORS
};

const diceRoll = "1d10 red + 1d10 blue";

api.roll(diceRoll, metadata, "chat")

Exploding dice rolls are currently only possible in the Ruleset API using the roll handlers, though, so that’s a bit more complicated! We can look into adding it as a macro feature as well in the future though.

Thank you so much! I’m really enjoying what I’m seeing with Realm VTT so far!

No problem! Glad to hear it :blush:

We now have an easier way to do exploding dice (and recoloring of dice) in macros or in the /roll command!

This command will get you I think what you’re looking for in the chat:

/roll 1d10![#0000ff]+1d10[#ff0000]+1d10[#00ff00]

And a very simple way to do it from a macro:

api.roll("1d10![#0000ff]+1d10[#ff0000]+1d10[#00ff00]");

Swap the hex codes for whatever shades you like — [#bg] with 1 hex code works if you want to just change the die color and keep use configured font color and [#bg,#text] with two hex codes also works if you want to set the number color separately from the die color.

Also, we finally updated our API docs here:

So cool! This is perfect, and exactly what I was looking for. Thank you for all your work!

1 Like