StatusFX operates by receiving events about tokens' status markers being changed. The way that the API is set up though, events aren't fired if the status is changed programmatically. I imagine that this is done in part to avoid infinite event loops in the API. To get around this, I've exposed an updateTokenState method in StatusFX that you can call from your script sort of like this: (function() {
function updateFort(token) {
if(token.get("bar1_max") === "" || !token.get('represents'))
return;
if(token.get("bar1_value") <= token.get("bar1_max") / 2)
token.set({ status_green: true });
else
token.set({ status_green: false });
updateSidelined(token);
StatusFX.updateTokenState(token); // Apply the bleeding FX if the green marker is on.
}
function updateWill(token) {
if(token.get("bar2_max") === "" || !token.get('represents'))
return;
if(token.get("bar2_value") <= token.get("bar2_max") / 2)
token.set({ status_blue: true });
else
token.set({ status_blue: false });
updateSidelined(token);
StatusFX.updateTokenState(token); // Apply the fear FX if the blue marker is on.
}
function updateSidelined(token) {
if(token.get("bar1_value") <= 0 || token.get("bar2_value") <= 0)
token.set({ status_dead: true });
else
token.set({ status_dead: false });
}
on('change:graphic:bar1_value', updateFort);
on('change:graphic:bar1_max', updateFort);
on('change:graphic:bar2_value', updateWill);
on('change:graphic:bar2_max', updateWill);
})();
You'll need to manually edit your script to stick StatusFX.updateTokenState(token); in there somewhere after you update your red and dead marker status.