
I've been trying to set up some notifications and other events around changing HP in a new script, and I've noticed that with the 5e Re-Shaped sheet a token change event seems to fire four times each time a user actually changes the value. Example code:
on('change:graphic:bar1_value', function (token, prev) {
if(token.get('bar1_value') == 0 && prev.bar1_value > 0) {
sendChat("Death","OH, THAT WAS UNFORTUNATE.");
}
});
In my game using the official 5e Re-Shaped sheet, if I select a PC token and change its HP to 0, I will see the message four times. This means not only is it registering 4 change events, it is also doing so 4 times simultaneously since prev still thinks HP == 0. Anyone have any thoughts on a) what might be going on or b) how I can limit notifications to just one?