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

[Sheet Workder] If/else...gah.

I am looking to make an if/else sheet worker for my health tracker.   Upon hitting the 'health_refresh' checkbox, I would like my sheet worker to look at the character's 'physique_base' attribute, and, should there be a '3' in it, change the radio buttons named 'healthbox_phy0', 'healthbox_phy1', and 'healthbox_phy3' radio buttons to value="1".   So far, I have put this together, but it is not working?  How does one fix this?     //Health Refresh on("change:health_refresh", function() {     getAttrs(["health_refresh", "physique_base", "healthbox_phy0", "healthbox_phyr1", "healthbox_phyl1", "healthbox_phyr2"], function(values) {         if (value.physique_base = 3) {             setAttrs({                 healthbox_phy0: 1, healthbox_phy1: 1, healthbox_phy2: 1 })         } if else (value.physique_base = 4) {             setAttrs({ healthbox_phy0: 1, healthbox_phy1: 1, healthbox_phy2: 1, healthbox_phy3: 1     })         }     }); });
1457556524
Lithl
Pro
Sheet Author
API Scripter
Your callback has a parameter named values  and you are trying to access an object named value . The =  operator (in your two if clauses) is for assignment. If you want comparisons, you need the ==  operator or the ===  operator. Attributes, even if they're numeric, are usually (always?) going to come through as strings. You should call parseInt  on your physique_base. It's "else if" not "if else" =)
Thank you for such a quick reply.  I shall try this out.  Thanks again! 
It works!  Thankthankthankthankyou! ...noI'mfinwhydoyouaskwouldlikeacupofcoffeeIthinkIwillhaveanother