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

How to report success / failure vs variable target?

1385691308
GiGs
Pro
Sheet Author
API Scripter
I have what should be a very simple macro. Roll d10, if it is equal or less than the Stat, report success; if over, report failure. I have tried /roll {1d10)<@{Stat} /roll 1d10<(@{Stat}) and other variations, and I keep getting an error. What is wrong with my syntax?
1385693410
GiGs
Pro
Sheet Author
API Scripter
Okay, I figured out one solution and found a new problem. This works: /roll 1d20<@{Stat} It wasn't working before, but i think it was because i hadn't saved changes to the journal and so it wasn't recognising that the stat existed. Now I want to do this: /roll 1d20<(@{Stat}+@{modifier}) and it's not working.
1385696631

Edited 1385697442
Sam
Sheet Author
Okay I fixed my errors, I was able to come up with a solution for you but I am not entirely satisfied since I was unable to come up with an inline roll option. You were very close with what you had but you just had a few problems. You should change your macro to look like this /roll {1d20}<[[@{Stat}+@{modifier}]] The location of the braces and the brackets are important. That is the only way I got it working. If some knows a better way or knows of a way to allow it to be used in inline rolls, please post.
1385697537
GiGs
Pro
Sheet Author
API Scripter
Actually that double square brackets trick does work. Thanks! I am finding that when doing a lot of edits of a macro, without clicking the big blue save changes button, sometimes it gets glitchy, not doing the autofill after pressing @ for instance and not recognising variables. But after I saved the sheet and clicked Edit again, it started working.
1385704997

Edited 1385705016
Gauss
Forum Champion
Another way to do this is to move one of the attributes to the other side of the inequality. Example: /roll {1d20-@{modifier}}<@{stat}
1385731112
GiGs
Pro
Sheet Author
API Scripter
Interesting. I had wondered if you could nest curly brackets. I think the square brackets approach produces clearer output, though.
1385773750

Edited 1385773768
Gauss
Forum Champion
True, but not everyone wants inline sections in their rolls so I was providing another option. :)
1385775283
GiGs
Pro
Sheet Author
API Scripter
That's a good thing :) I've learned most of what I know about macros from reading your replies to people in so many threads, you are an amazing contributor.
1385777089
Gauss
Forum Champion
Thats why they made me a Moderator. :)