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 Dice Roll not working?

1597978950

Edited 1597979582
Steve
Pro
Sheet Author
Hi all, I'm trying to get this macro to work: Roll 1d20, you succeed of a result of 13+rank-spell level or less. /roll 1d20<={13+@{selected|rank}-?{Spell Level}} Every time I test it though, it doesn't roll a dice and just gives me a result of '1'. In the screenshot below, you can see that the attack roll macro works fine, but the Psychic Fatigue roll does not.
1597984528

Edited 1597984753
Oosh
Sheet Author
API Scripter
The Less Than operator needs an integer to compare to, so you need to wrap the right hand side in [[ ]] roll brackets. Roll20 also uses < and > as "less than or equal to" and "greater than or equal to", so you don't need the = sign. So: /roll 1d20<[[13+@{selected|rank}-?{Spell Level}]] should work. Basically, it's expecting a die roll on the left and an integer on the right. There are some tricks to get around this limitation if needed.
1598012401
Steve
Pro
Sheet Author
Thanks Oosh, I'd never have figured that out on my own. I've never heard of a roll bracket before... The more I use Roll20, the more I feel like you need a degree in computer code.
1598017719
Oosh
Sheet Author
API Scripter
I probably should have said " inline roll brackets ", just to avoid any confusion.