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 .
×
Advertisement Create a free account

[HELP] TempHPandStatus Script giving strange results in DCC

1522332058
Hello, I'm trying to use The Aaron's TempHPandStatus script to handle temporary HP with the tabbed DCC character sheet (although slightly modified). From here: <a href="https://github.com/shdwjk/Roll20API/blob/master/Te" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/Te</a>... It gives very strange results; there is an attribute for temp_HP, but when I subtract HP from token's main HP, it takes much more off the temp_HP attribute. For instance, if I put "-1" in the HP status bubble to indicate a point of damage and remove 1 HP, the main HP status bubble goes back up to where it is supposed to be, but the temp_HP attribute goes down by 8. It's like it's looping 8 times.&nbsp; As far&nbsp; as I know, the only changes I made to this script were: HP.bloodied = Math.floor(HP.max/3) || 0;&nbsp;&nbsp; {instead of HP.max/2} HP.dead = 0;&nbsp;&nbsp; {instead of -HP.bloodied, since in DCC you die at 0 HP} HitPointBarNum was left as 3, and TempHitPointsIn was left as temp_HP. I really have no idea why the script is behaving this way, or how to resolve.&nbsp; Assistance is appreciated; thanks.
1522332570
The Aaron
Forum Champion
API Scripter
That's super strange!&nbsp; If you want to PM me an invite to the game and GM me, I'll come take a look for you.
1522343308
Invitation sent.
1522345827
The Aaron
Forum Champion
API Scripter
Note : This appears to be an issue with the API server issuing change:token events multiple times for a single action.&nbsp; If anyone else is seeing this sort of behavior with the API, let me know.
1522346206

Edited 1522346221
GiGs
Pro
Sheet Author
API Scripter
I think i saw that happen last night while testing a script, just after they rolled back the last update. I'll keep an eye out for it happening again and properly document it if it happens.
1522346443
The Aaron
Forum Champion
API Scripter
Steve thinks that multiple API instances have gotten started for this game, and that exiting the game and waiting until the API server shuts down will resolve the issue.&nbsp; I'm waiting on that now.
Off topic but anyway to make this temp HP script work for HP in bar 1?
1523483615
Dana Lexa
Pro
Sheet Author
Anthony V. said: Off topic but anyway to make this temp HP script work for HP in bar 1? At a glance, you should just need to change this line: HitPointBarNum = 3, to HitPointBarNum = 1,
1523536917

Edited 1523538858
I editet the script to provide a workaround, but since I believe that I cannot reproduce the issue in my game I had no way to test this reliably. TempHPandStatus-Debounced What it does is basically debounce the function like you would do with an electrical circuit. It will ignore repeated calls to the function when they're within 500ms. The actual function will only be called once there are no more calls in the specified window of time. I do not know if this a good idea, but it might help.
1523663439
Thanks, but the revised script does not appear to work.&nbsp; Now, no HP are taken off the temp_HP attribute at all.&nbsp; They're just taken off the bar3 linked attribute (HP) like they would if there were no temporary HP.
For me its also not working as intended, but the issue you are describing - I cannot reproduce. Best thing would be to hope this API issue is fixed soon.