Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Rolling different numbers of dice depending on the min of two values.

July 04 (10 years ago)

Edited July 04 (10 years ago)
So I have two problems.

1. I want to roll X number of dice, where the macro decides what X is. So I would have Xd6 or something equivalent. EDIT: I've figured out how to do this one.
2. I want to determine X by taking the minimum of a variable and a constant. Something like min(@{LVL}, 5)

Putting them together, I would want something like [[min(@{LVL},5)d6]] which would be read as [[3d6]] if LVL were 3, and 5d6 if LVL were greater than 5.

Can I do this with basic macros, or do I need the API?
July 04 (10 years ago)
Yeah, that's totally doable in a macro, but you need to use KL1 instead, inside a nested inline roll.

[[ [[{@{Lvl}, 5}KL1]]d6 ]]
July 04 (10 years ago)

Edited July 04 (10 years ago)
I'm very new to macros, Can you explain what KL1 is, or where I might look to find documentation on it?

July 04 (10 years ago)
KL = Keep Lowest and there is also KH for Keep Highest. You can use it to keep one or more of the lowest or highest dice. It shouldn't break your macro at all.
July 04 (10 years ago)
Gen Kitty
Forum Champion
Here's your documentation on dice rolling formulas, and specifically keep lowest/hghest (More complicated information)
Thank you very much.
How old are the dice docs you referenced? I typed in several examples and they didn't work as explained in the associated text.
For example:
/roll 1d20cs>10

merely is
/r 1d20

This is related to a similar problem I am having with Success rolls.
_Falsoon
July 09 (10 years ago)
Ziechael
Forum Champion
Sheet Author
API Scripter
/roll 1d20cs>10 is exactly 1d20, that is because the roll you are asking to display is rolling a d20 and highlighting if the result is higher than the critical success range (11-20 in that example).

All of the examples in the dice reference are applicable and up to date, however you'll find most people use them as inline rolls for a cleaner output these days.

What issue are you having with success rolls?