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] Ugh... why isn't this working?

The variables are all defined properly. The math shows up in the API log correctly, but it's not setting the hit points on the bar when I use the obj.set function.     // Adjust current hit points if the token has temporary hit points and its     // previous hit points are greater than its current hit points.     if (iTempHPAmt > 0) {         if (iPreviousHP > iCurrentHP) {             var iHPChange = iPreviousHP - iCurrentHP;             if (iHPChange >= iTempHPAmt) {                 // Add temphp to currenthp, remove all temp hp.                 var iHPAdjustment = iCurrentHP + iTempHPAmt;                 log("I have " + iTempHPAmt + " temp hp.");                 log(iPreviousHP + " - " + iHPChange + " = " + iCurrentHP);                 log("Adjustment: " + iHPAdjustment);                 obj.set("bar" + barHP + "value", iHPAdjustment);             } else {                 // Add temphp-hpchange to currenthp and set temphp as temphp-hpchange             }         }     } API Log "I have 5 temp hp." "36 - 10 = 26" "Adjustment: 31"
just a thought, but on the line : obj.set("bar" + barHP + "value", iHPAdjustment); perhaps you should try: obj.set("bar" & barHP & "value", iHPAdjustment);
Actually, you helped me see what I was doing wrong. It should be: "bar" + barHP + "_value" instead of "value". Stupid mistake. Thanks! -edit- Made the change in my script and now it works perfectly! Woot!