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 do you display a conditional macro?

I know I've seen this on the forums around here somewhere. Or something similar at least. Can you do something like: Attack > AC ? Hit | Miss What's the syntax for something like this? Can anyone please help me out? I would greatly appreciate it.
1525870205
The Aaron
Pro
API Scripter
The closest you can come is a successes check: [[ 1d20>@{target|ac} ]] hits That will give you "0 hits" if the d20 roll is less than the target ac, and "1 hits" if it is equal or greater. Anything more complicated requires either the API, or a custom Roll Template.
Okay I'll scrap that idea then and do something with the API I suppose. Question though... Can you output the results of say a command like "!atk-vs-ac" in the roll template? As far as I know you can only run ! commands on a new line at the end of the roll template so not sure how I could display something like "Your attack hits." or "Your attack misses." in the roll template itself.
1525872873
The Aaron
Pro
API Scripter
If you want the results of an API command to show in a Roll Template, then the API command must emit the Roll Template as it's output: // some calculations ... sendChat('Roll Template Result', `&{template:someTemplate}{{name=${someVar} result}}{{roll=${someOtherVar}}}`); If you want the Roll Template to make the decision on what should be output, you have to use it's syntax: <table> <tr><th>{{rollname}}</th></tr> <tr><td><span class="tcat">Attack: </span>{{attack}}</td></tr> <tr> <td> <span class="tcat">Damage: </span>{{damage}} {{#rollWasCrit() attack}} <span class="tcat">Crit: </span>{{dmgcrit}} {{/rollWasCrit() attack}} </td> </tr> </table> Which requires editing the character sheet.
1525873079
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I don't know if this helps, but you could putt the !command into an API button. It would require an additional click to execute, though.