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

Problem with conditionals in ability button.

I'm not sure what I'm doing wrong with the conditionals here: &{template:DnD35Attack} {{pcflag=true }} {{name=@{character_name} }} {{subtags=attacks @{target|character_name} with a @{weapon1name} }} {{fullattackflag= [[ ?{Full Attack?|No, 0d1|Yes, 1d1} ]] }} {{fumbleroll=Fumble: [[ @{weapon1attackcalc} ]] }} {{attack1=BA1: [[ @{weapon1attackcalc} +?{Rapid Shot?} ]] }} {{attack2=BA2: [[ {{@{bab},0}> 6}*( @{weapon1attackcalc} +?{Rapid Shot?} - 5 ) ]] }} {{attack3=BA3: [[ {{@{bab},0}>11}*( @{weapon1attackcalc} +?{Rapid Shot?} -10 ) ]] }} {{attack4=BA4: [[ {{@{bab},0}>16}*( @{weapon1attackcalc} +?{Rapid Shot?} -15 ) ]] }} {{damage1=D1: [[ @{weapon1damage} ]] @{weapon1type} dmg }} {{damage2=D2: [[ @{weapon1damage} ]] @{weapon1type} dmg }} {{damage3=D3: [[ @{weapon1damage} ]] @{weapon1type} dmg }} {{damage4=D4: [[ @{weapon1damage} ]] @{weapon1type} dmg }} {{critconfirm1=Crit?: [[ @{weapon1attackcalc} ]] }} {{critconfirm2=Crit?: [[ @{weapon1attackcalc} - 5 ]] }} {{critconfirm3=Crit?: [[ @{weapon1attackcalc} -10 ]] }} {{critconfirm4=Crit?: [[ @{weapon1attackcalc} -15 ]] }} {{critdmg1=+ [[ @{weapon1crit} ]] }} {{critdmg2=+ [[ @{weapon1crit} ]] }} {{critdmg3=+ [[ @{weapon1crit} ]] }} {{critdmg4=+ [[ @{weapon1crit} ]] }} The goal is that if the character's BAB is not high enough to support an additional attack, then the result is 0. Alternatively, having the lines just not show up on the resulting output in chat would be even better. Unfortunately, there's an error somewhere that causes the ability macro to fail. Removing the conditional from BA2, BA3, and BA4 to make them like BA1 works just fine. Any help would be greatly appreciated. Thanks!
1602465499

Edited 1602483408
Oosh
Sheet Author
API Scripter
edit - brain required more coffee... you can use the success operator like that just fine, so ignore below I don't think the successes are stored as simple integers that you can multiply with. You'll probably need to do something like this instead: [[ ceil({@{bab}-6,0}k1/100)*(@{weapon1attackcalc} +?{Rapid Shot?}) ]] which will return a 1 if @{bab} is higher than 6, and a 0 otherwise. You'll probably need to tweak it if you need equal to 6 to be a 1, it's currently a 0.
1602475688
GiGs
Pro
Sheet Author
API Scripter
I suspect your macro is breaking because of the space you inserted after the > in this one: {{attack2=BA2: [[ {{@{bab},0}> 6}*( @{weapon1attackcalc} +?{Rapid Shot?} - 5 ) ]] }} Change it to something like: {{attack2=BA2: [[ {{@{bab},0}>6} *( @{weapon1attackcalc} +?{Rapid Shot?} - 5 ) ]] }} There are plenty of places you can put a space, but either side of an > will not work.
The space after > is what did it. Thank you very much! Now, is there a way to essentially do: If <value> = 0, use "NA"? I don't think so, but just checking.
1602541662
Oosh
Sheet Author
API Scripter
What exactly do you mean? "NA" would break the roll and the template as it isn't an integer. Or you want to stop the entire section from displaying if the @{bab} check is a failure?
I was thinking that if a value evaluates to 0 (such as @{bab}), instead display the string "NA" or not displaying the entire key/value pair at all would be more optimal.
1603760809
GiGs
Pro
Sheet Author
API Scripter
Unfortunately you cant do that with macros. Roll20 dice rolls dont support conditionals, such as "if this result is 0, display NA" You can do this with the API, but that would mean creating a custom script and replacing every roll in the game, and you wouldnt be able to use the buttons on the sheet, so its not usually worth it.
1603805707

Edited 1603805745
Oosh
Sheet Author
API Scripter
Well... there's a clever way you could do this with Stylus, but it would only change the roll for you, not for other players (unless they also use Stylus and you give them the same script). It would also destroy the tooltip roll information. But it's possible.... if you really hate zeroes.