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

Comparing one roll to two numbers

Hey, so I'm trying to figure out how to take a single roll and compare it to two different numbers. I tried this [[({ #Roll ,0}>@{target|Evasion})+({ #Roll ,0}>20)]]  where #Roll is a stupid thing I wrote to gimmick a mechanic in my system, but it ends up rolling two separate numbers and comparing them to the values. Is there a way to compare the same number twice?
1599148071
GiGs
Pro
Sheet Author
API Scripter
It's hard to say without seeing the contents of #Roll.
1599148495
GiGs
Pro
Sheet Author
API Scripter
If #Roll evaluates to a single number, you can try this /roll {@{target|Evasion},20}<#Roll Though this will only work if #Roll evaluates to a number, and you might need to put [[ ]] around it. I used /roll here instead of inline roll brackets, because its easier to see what's happening. Once it's working you can replace with inline roll brackets.
Uh, that might actually work. Thank you! [[1d20+([[([[{((?{Accuracy|0})-(?{Difficulty|0})),((?{Accuracy|0})-(?{Difficulty|0}))}>0]]-1)]]*[[([[abs((?{Accuracy|0})-(?{Difficulty|0}))]])d6k1]])+(?{Modifier|0})]] That's #Roll BTW
1599234418

Edited 1599234438
GiGs
Pro
Sheet Author
API Scripter
I just tested it and it worked for me. That roll is very complex. It might be possible to simplify it. Can you describe how to make that roll, as if I was a player in your game, with no reference to roll20?
It takes your advantage and your disadvantage, finds out which one is bigger, rolls the difference in d6, takes the highest 1, and either subtracts it or adds it depending on if advantage or disadvantage was higher.
1599459214
GiGs
Pro
Sheet Author
API Scripter
I see why its such a complicated roll then! That method of getting a +1 or -1 for the multiplier is pretty clever. You can remove some of the brackets to make it slightly  easier to read and parse: [[1d20+[[([[{?{Accuracy|0}-(?{Difficulty|0}),?{Accuracy|0}-(?{Difficulty|0})}>0]]-1)]]*[[ [[abs(?{Accuracy|0}-(?{Difficulty|0}))]]d6k1]]+?{Modifier|0} ]]
Thanks for that! It's part of a thing I'm doing to make my Play By Post game work a little easier, letting us tell if we hit or not and letting us roll damage. If I could as another question, is there a way I could roll that complex thing, then put it in two places at once? #Hit is the opening code that I've now replaced with your formula. [[( #Hit * (?{NumberOfD6|0}))d6k?{NumberOfD6|0}} + ( #Hit * (?{NumberOfD3|0}))d3k?{NumberOfD3|0}}+?{DamageModifier|0}]]
1599712043
GiGs
Pro
Sheet Author
API Scripter
It includes a roll, so you can put it in multiple places, but the roll will be rerolled each time. But since its a simple multiple each time you should be able to rebuild the expression to only need it once. I was going to try, but I dont understand your expression and this part (?{NumberOfD6|0}))d6k?{NumberOfD6|0}} has an extra } so it doesnt look like its built correctly.
It was working when we rolled it so, I'll look into that. Basically, in this system, when you crit, you roll twice the number of dice and take the highest half of them. I think that might actually be an old version but we were going to multiply the Number of D6 and Number of D3 inputs by the output of the formula I posted originally.