The Aaron said: The status_* properties were broken with the Custom Token Marker update. I rewrote this real quick so it should work (but I didn't get a chance to test it...): on('ready',()=>{
// CONFIGURE
const bar = 1;
const bloodied = "red";
const dead = "dead";
// no edit below here //
const unpackSM = (stats) => stats.split(/,/).reduce((m,v) => {
let p = v.split(/@/);
let n = parseInt(p[1] || '0', 10);
if(p[0].length) {
m[p[0]] = Math.max(n, m[p[0]] || 0);
}
return m;
},{});
const packSM = (o) => Object.keys(o)
.map(k => ('dead' === k || o[k]<1 || o[k]>9) ? k : `${k}@${parseInt(o[k])}` ).join(',');
on("change:graphic:bar1_value", function(obj) {
const bv = `bar${bar}_value`;
const bm = `bar${bar}_max`;
if(obj.get(bm) === "") return;
let sm = unpackSM(obj.get('statusmarkers'));
if(obj.get(bv) <= obj.get(bm) / 2) {
sm[bloodied] = true;
}
else{
sm[bloodied] = false;
}
if(obj.get(bv) <= 0) {
sm[dead] = true;
}
else {
sm[dead] = false;
}
obj.set({
statusmarkers: packSM(sm)
});
});
});
Let me know if it doesn't work and I'll fix it... If I am using custom status markers, how would I change the default bloodied and dead markers in your script?