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

If/Then statements in macros

1459187269

Edited 1459187416
I am trying to build a macro that states: roll 1d20 if result = 18 thru 20 then roll 2df If (2df.result) = 2 then do [[1t[Fate-Results]]] else (nul)
1459187463

Edited 1459187573
I basically want it to roll an attack, where if it crits it rolls 2 fate dice. if the result of the fate roll is 2, then it rolls from a table of different results. And if it does not pass the fate roll, no additional effects occur.
1459191939
The Aaron
Roll20 Production Team
API Scripter
This is not possible with macros. &nbsp;What most people do is perform all rolls and then use the ones that are appropriate. &nbsp;You can use the cf/cs specifiers to get more feedback about what the roll was: &{template:default}{{name=Simple Twist of Fate}}{{roll=[[1d20cs&gt;18]]}}{{fate=[[2dfcs&gt;2]]}}{{results=[[ 1t[Fate-Results] ]]}} See:&nbsp; <a href="https://wiki.roll20.net/Dice_Reference#Critical_Su" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Critical_Su</a>...
Is there a way to do it with scripts?
Yes, but you have to be a pro subscriber. You can write your own script or use something like Powercards which could handle that.
gotcha
1459212091

Edited 1459212582
[[ [[floor(2df=1 / 2)]]t[Fate-Results] ]] is probably the closest you'll get to automating this within an inline roll (while keeping 1d20cs&gt;18 visible). This also works: /r ( [Attack:] [[ 1d20cs&gt;18 ]] / 36 * [[ floor(2df=1 / 2) ]] )t[Fate-Results]
I tried the first one, and it worked closer to what I was intending. Thanks!
1459289364

Edited 1459291782
chris b.
Pro
Sheet Author
API Scripter
I thought there was a way to do it using an obscenely long macro to compare 2 values? I tried finding it on the wiki just a few days ago but couldn't. ok here i found an old one: this is "if @{acrobatic-ranks} &gt; 0, then 3, else 0" &nbsp;I don't know how to write it generically, or if there is a way to check for anything besides 1 or 0. I know this used to be in the wiki ((((3 * @{Acrobatics-ranks}) + 3) - abs((3 * @{Acrobatics-ranks}) - 3)) / 2) edit: sorry i was thinking of generic if/then