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's and IF rolls

I'm looking to create a macro, I've delved the wiki and forums but either it doesn't exist or I simply can't get it to work. Basically I'm trying to get a varying text (or number, between 0-4) dependant on one dice roll. So Basically, 1-4 = 0 of this 5-8 = 1 of this 9-12 = 2 of this 13-16 = 3 of this 17-20 = 4 of this The only thing I can find that really comes close is the Success/Failure rolls, but from my limited understanding doesn't allow me to either quantify multiple successes on one roll or have a text based output.
1462838321
The Aaron
Roll20 Production Team
API Scripter
So, you want to roll a d20 and as a result get a number followed by text? &nbsp;This is exactly the use case for rollable tables. &nbsp; <a href="https://wiki.roll20.net/Card_Decks_and_Rollable_Ta" rel="nofollow">https://wiki.roll20.net/Card_Decks_and_Rollable_Ta</a>... You simply setup the table with 5 rows, each with a weight of 4. Alternatively, since the values in your list are evenly distributed, you could use a bit of math: [[ (1d20/4)-1 ]] of this
1462845033

Edited 1462845064
Rollable tables seems to be the best case, formula unfortunately doesn't round correctly (and can end up as -1). However, thank you, you beautiful beautiful man.
[[ ceil(1d20 / 4) - 1 ]] Added a Rounding Function .
1462845773
The Aaron
Roll20 Production Team
API Scripter
Ah, rounding! &nbsp;Thanks Silvyre. &nbsp;Rollable tables are great for this sort of thing as you can include the text right in the table and the distribution doesn't have to be uniform. &nbsp;You can also include an empty result instead of "0 of this" if you just want output when a value is actually present.