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

Can Deathtracker API observe !token-mod changes to HP bar?

Hello, fairly new to Pro and LOVING it!  The possibilities are endless.  I have been using macros for damage and heals similar to below, but then found Deathtracker and love the options.  I notice, however, that it does not work with this macro(after taking out the /fx as Deathtracker already has that).  It only seems to "notice" when I manually change the bar value.  Is there a way to tweak it to listen for !token-mod changes as well?  Not a huge deal by any means as it is not hard to manually change the bar, but my players like the sound effects.  Thanks for any assistance! !roll20AM --audio,play,nomenu|Heal Spell SFX Roll20 by Caio Viel !token-mod --set bar1_value|[[ @{target|bar1} + [[ ?{Healing} ]] ]] --ids @{target|token_id} /fx burn-holy @{target|token_id}
1537496375
The Aaron
Pro
API Scripter
DeathTracker could be modified to react to TokenMod changes.
1537496565
The Aaron
Pro
API Scripter
You can add this to lie 284, in the registerEventHandlers function: if('undefined' !== typeof TokenMod && TokenMod.ObserveTokenChange){ TokenMod.ObserveTokenChange(handleBarValueChange); }
That worked perfectly.  My players and I thank you immensely, Aaron!!!  Also, thank you for the amazingly quick response!  You definitely live up to your reputation and are truly gifted.
1537543500
The Aaron
Pro
API Scripter
=D  Well, I'm starting a new job next week that won't allow me to be plugged into the website quite thoroughly as in the last several years.  Hopefully I can still maintain an adequate level of response speed and maintain that reputation. =D Glad that worked for you, I'll see about pushing it to the production version. =D 
1537543881

Edited 1537545301
The Aaron
Pro
API Scripter
I talked to Robin and sent a pull Request:&nbsp; <a href="https://github.com/Roll20/roll20-api-scripts/pull/707" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/pull/707</a> Should be in the main line next week or so.
Would one be able to do the same thing for ApplyDamage ? I find that the best way to do damage to groups (like Fireball), but then DeathTracker doesn't update. Also willing to hear alternatives to ApplyDamage, as maybe I'm missing other methods.&nbsp;
Followup question: WHen you say "should be in the main line", does that mean those of us using the Script Library to do installs will get it as well?&nbsp;
1537545518
GiGs
Pro
Sheet Author
API Scripter
If you use the OneClick library to install, it'll be updated automatically. If you copy and paste it into your scripts section manually, you'll need to redo that manually.
1537545655
The Aaron
Pro
API Scripter
Michael B. said: Would one be able to do the same thing for ApplyDamage ? I find that the best way to do damage to groups (like Fireball), but then DeathTracker doesn't update. Also willing to hear alternatives to ApplyDamage, as maybe I'm missing other methods.&nbsp; Yes, with the caveat that ApplyDamage would need to be observable so that DeathTracker could observer it.&nbsp; The code I added above basically does: Check if TokenMod exists Check if TokenMod has the ObserveTokenChange function Tell TokenMod to call DeathTracker's handleBarValueChange when TokenMod makes changes to a token ApplyDamage doesn't currently have a facility for that, but it could be added. Michael B. said: Followup question: WHen you say "should be in the main line", does that mean those of us using the Script Library to do installs will get it as well?&nbsp; That's precisely right.
OMG -- used this update tonight -- the combat went so much smoother,,,, Thanks for the change,,,,,many thanks... One of the guy's in my party is a GM and want it in his game now... .....shwing...Aaron -- you rock....:)
1537592688
The Aaron
Pro
API Scripter
=D
1537612777
Jakob
Sheet Author
API Scripter
ApplyDamage doesn't currently have a facility for that, but it could be added. It does now :D.
First off, thank you guys for being so responsive. Thats amazing.&nbsp; Would either of you be able to help me with the code I would need to add to DeathTracker to achieve this, now that ApplyDamage has updated its code?&nbsp;
1537640809
Jakob
Sheet Author
API Scripter
Something like this (untested): if('undefined' !== typeof ApplyDamage &amp;&amp; ApplyDamage.registerObserver){ ApplyDamage.registerObserver("change", handleBarValueChange); }
Jakob, consider it tested.&nbsp; Works like a charm.&nbsp; BTW, Thank you for ApplyDamage, just found it thanks to this thread.&nbsp; Loving it!!
1537642487
Jakob
Sheet Author
API Scripter
ShadoPanther said: Jakob, consider it tested.&nbsp; Works like a charm.&nbsp; BTW, Thank you for ApplyDamage, just found it thanks to this thread.&nbsp; Loving it!! Yeah, I should probably get it to one-click or something to increase visibility - only problem is that I haven't used it in a year or so, so I'm not motivated :D.
Awesome, I also tested this, and it worked great. How do we get this added into DeathTracker main line? Aaron, can you ask Robin like you did for the TokenMod addition?
1537827843
The Aaron
Pro
API Scripter
I can add it in. Would be especially good if Jakob gets it into the repo. :)
1537865894
Jakob
Sheet Author
API Scripter
The Aaron said: I can add it in. Would be especially good if Jakob gets it into the repo. :) The most annoying part is writing the documentation, as always &gt;&lt;.
1537871841
The Aaron
Pro
API Scripter
Definitely! &nbsp;That’s what’s keeping a bunch of mine from the 1-click...