
I got this DeathTracker script located here: <a href="https://github.com/Roll20/roll20-api-scripts/tree/master/DeathTracker" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree/master/DeathTracker</a> And when I use my macro to call an API function to change the value in bar3 (HP) Death Tracker doesn't pick up on it. This is my script: //By Kastion
//<a href="https://app.roll20.net/users/3173313/kastion" rel="nofollow">https://app.roll20.net/users/3173313/kastion</a>
//version: 1.0
//use !change-hp <damage|healing> @{selected|character_id} to update character HP.
on('ready', function() {
log("-=> Change HP Tool Loaded <-= [Last Edited by Kastion May 17th 2018]")
on('chat:message', function(msg) {
if (msg.type == "api" && msg.content.indexOf("!change-hp") !== -1) {
let args = msg.content.split(/\s+/);
var c = getObj('character', args[3].trim());
var t = findObjs({
_type: 'graphic',
represents: args[3].trim()
});
var i = 0, changed = 0;
for (i = 0; i < t.length; i++)
{
if(t[i] && !isNaN(args[2]))
{
var bar_value = parseInt(t[i].get("bar3_value"));
var hp_dif = parseInt(args[2])
var old_hp = bar_value;
if (args[1] == "damage")
var new_hp = bar_value - hp_dif;
else if (args[1] == "healing")
var new_hp = bar_value + hp_dif;
else {
log("Type of HP change not specified!");
return;
}
t[i].set({ bar3_value: new_hp });
changed = 1;
}
}
if (changed)
{
if (new_hp < old_hp)
sendChat('', "/desc " + c.get("name") + " takes " + hp_dif + " points of damage.");
else
sendChat('', "/desc " + c.get("name") + " heals " + hp_dif + " points of damage.");
}
};
});
}); Is there any way to get this script to work with DeathTracker? Is there an API command / code to force a "change" on a graphic so the "on change" event triggers DeathTracker?