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 .
×

How do I do 1d20>(3+x)?

First of all, I do know about character attributes. However, when I do [[1d20>(3+x)]] where x is a reference to a character attribute I just get 1 every time. How do I get around this? I'd prefer to not have to hardcode x
1639731306
Ziechael
Forum Champion
Sheet Author
API Scripter
Success/failure syntax can be a headache... the easiest way is to ensure that you are always comparing to a single number rather than a calculation: [[1d20>[[3+@{selected|caster_level}]] ]] Obviously, replace the attribute above with whatever you need :)
It is kinda hard to guide you as you did not describe what you actually want to happen, only what you did not want to happen (you do not want a return value of 1). So "getting around it" is hard to know where you want to land. All I can do is try and describe the underlying functionality of your expression, and that will hopefully give your some insight into your problem and guide you in the right direction You are asking a boolean question. You are basically asking, "is my 1d20 roll larger than 3+x?" The result of this roll will either be 1 or 0. If your 1d20 roll is larger than 3+x then it will return 1 If your 1d20 roll is smaller than 3+x then it will return 0 If this does not work as expected then it might be that the larger than sign, >, cannot handle an expression and must be a single number. If that is the case you could chance your expression to [[ 1d20>[[3+x]] ]] This way the 3+x will be calculated to a single number before the greater than sign is evaluated. Note if you go with this approach: You must have whitespaces between the 2 sets of double square brackets, ie "]] ]]". If you write them directly next to each other, ie. "]]]]" then Roll20 sometimes fucks up the calculation. I hope this was an answer to your question
Thank you both for your answers! I have tested the solution you guys gave me and it indeed did work. And I probably should've clarified but I did in fact want to make it so if it's true it returns 1, and if false it returns 0. I'll try to be more clear next time. Thank you!