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

Conditional Statement in button Macro?

Was  wondering if anyone has example of using a "Conditional Statement (Math only)" in a button macro, which uses other values? For example, I have an weapon attack button which has a value below, but I want to add a "conditional value if check box is checked.  {{attack==[[d10cs>@{attack-crit-range}+(@{bonus}+@{global-bonus}+@{attack-bonus})]]}} So I have a checkbox attr_weapon_bonus_indicator with value of 1, and a second field, attr_weapon_bonus, that I want to add to the above macro if the checkbox is checked? The conditional I think I want is, but not sure how to add to the above button macro? [[{{@{weapon_bonus_indicator},0}>1}*(@{weapon_bonus}-0) + 0]] Thanks
1605141155
GiGs
Pro
Sheet Author
API Scripter
I assume you're referring to this technique:&nbsp; <a href="https://wiki.roll20.net/Useful_Macros#Conditional_Statements_.28Math_Only.29" rel="nofollow">https://wiki.roll20.net/Useful_Macros#Conditional_Statements_.28Math_Only.29</a> Form the above, I gather youre wanting to add weapon_bonus if weapon_bonus_indicator is checked, and if not, add 0. In that case you can probably just add that whole expression to the end, like &nbsp;{{attack==[[d10cs&gt;@{attack-crit-range}+(@{bonus}+@{global-bonus}+@{attack-bonus}) +&nbsp;[[{{@{weapon_bonus_indicator},0}&gt;1}*(@{weapon_bonus}-0) + 0]]&nbsp;]]}}