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

Help with inserting conditional

1598837456

Edited 1598841140
Edit - Solved So, I found this:&nbsp; <a href="https://wiki.roll20.net/Useful_Macros#Conditional_Statements" rel="nofollow">https://wiki.roll20.net/Useful_Macros#Conditional_Statements</a> I know it's not optimal because it seems like it was a very hacky addition, but I have one single use case and I think it will work. I'm getting a syntax error though, and I don't understand this language well enough to find it. Going to try to break this down into pieces to make it easier to read: I start with this, which I found somewhere online, and it works fine: /w gm &amp;{template:default} {{name=Saving Throws}} {{Str Save= [[1d20+@{strength_mod}]] | [[1d20+@{strength_mod}]]}} The conditional I want to add is this: [[{{@{npc_str_save_base}, 0}&gt;1}*(@{pb}-0)+0]] I think that should check if npc_str_save_base is &gt;= 1, and return @{pb} if it is, or 0 if it isn't. (I hope) I added it to the original macro by just inserting a + sign and that code in 2 spots like this (broken into a few lines for your sanity): /w gm &amp;{template:default} {{name=Saving Throws}} {{Str Save= [[1d20+@{strength_mod}+[[{{@{npc_str_save_base}, 0}&gt;1}*(@{pb}-0)+0]]]] | [[1d20+@{strength_mod}+[[{{@{npc_str_save_base}, 0}&gt;1}*(@{pb}-0)+0]]]]}} Anyone able to spot what I did wrong here? Is just +expression syntactically incorrect to add the result? Or do I need to wrap something in parens or braces? Thanks in advance for any help, been trying to crack this on my own and I'm super stuck.
1598840864
GiGs
Pro
Sheet Author
API Scripter
Have you tried this part on its own first? [[{{@{npc_str_save_base}, 0}&gt;1}*(@{pb}-0)+0]]
That actually did lead me to the answer...thanks. It was the wrapping [[ ]] that weren't needed since I guess they're inside another template or whatever the correct terminology is. [[1d20+@{strength_mod}+({{@{npc_str_save_base}, 0}&gt;1}*(@{pb}-0)+0)]] | [[1d20+@{strength_mod}+({{@{npc_str_save_base}, 0}&gt;1}*(@{pb}-0)+0)]] ^ While visually horrifying, seems to be working, though I need to test it more.
1598841643
GiGs
Pro
Sheet Author
API Scripter