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

Macro: Roll two d10's, add if equal, else take first?

November 12 (10 years ago)
Thorin
Sheet Author
Hello,

I'm trying to write a macro for a game, and I am unsure if Roll20 can support this. The mechanic works like so:

Roll 2 different d10's, let's call them A and B. If the results are different you add A to the appropriate ability and give the result. If both A and B are equal, you add them both to the result.

Example: I roll 7 and 9 plus my Strength 5. Result: 12.

Example: I roll 7 and 7 (a matching pair!) plus my Strength 5. Result: 19

How do I write a macro to automate this roll?
November 12 (10 years ago)

Edited November 12 (10 years ago)
Pat S.
Forum Champion
Sheet Author
Got bad news and good news for you. The standard dice roller doesn't support that type of macro. You can use the api (mentor level feature) scripts to do that more then likely.
November 12 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Just to verify: you can do this with the API.
November 12 (10 years ago)
You can't do it directly as such (there's no way to make multiple references to the same roll in a formula), but you could set up a rollable table with 20 entries (ten entries of 1-10, each with weight 9, and ten entries of 2-20, each with weight 1) or you could do something like 1d10*(1+{1d10-9,0d1}kh1). Both of those give you the same probability distribution, although neither will appear the same on the table.
November 12 (10 years ago)
Thorin
Sheet Author
Thanks for letting me know!