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

Reverse conditional sum with checkbox

I have a character sheet that I'm playing around with and would like to have the weight of armour ignored by the encumbrance calculation when a checkbox is ticked. In the wiki I found that code that includes it when ticked, but how do I do the opposite? The same checkbox is used for armour class calculations, so I don't want to break that. Code from wiki: on ( 'change:repeating_armour remove:repeating_armour' , function () { repeatingSum ( "armour_weight" , "armour" ,[ "armour_piece" ,"armour_worn"]); });
1645200120
GiGs
Pro
Sheet Author
API Scripter
It's not as clear as it could be, I really need to rework the syntax, but you need to use the second, bigger, function on the repeatingSum page, and scroll down to Subtractions. Which is the checkbox ticked? armour_worn? I think this might work. on ( 'change:repeating_armour:armour_piece change:repeating_armour:armour_worn remove:repeating_armour' , function () { repeatingSum ('armour_weight', 'armour' , [ 'armour_piece' ,'armour_worn'], multiply:armour_worn | - 1 ); });
Thanks for the pointer, I just can't get it to work properly, which is probably more about my skills than anything else! I think the easiest route is to ensure that if the armour is worn, the weight value is manually set to zero.