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

obj.set with custom status markers not removing?

I'm trying to use a "bloodied and dead" script with a custom token marker set and I've run into two problems. First, I can't seem to get it to identify the custom token markers by name. For instance, I have one named "Injured" but this: status_injured: true does nothing. As does: status_Injured: true I found a script that tells me the name of the status marker ( this one ) and ran it, and it said it is Injured::190335.  So, I found that this: status_190335: true Will work...but, trying to use the same thing to set it to false doesn't work. So if a creature has 50 hp and I set it to 25 it adds one injured token...then I set it to 24 and it adds a second, they take another 6 damage and drop them to 18 and it adds a third injured token. Here's the script as I have it right now. If I have it set to a default status marker, it works fine. Removing the status marker when the damage ratio isn't right but not with the custom markers. Here's what I have right now: var barValue = "bar1"; var acceptedValues = ["bar1", "bar2", "bar3"]; on('chat:message', function (msg) { if (msg.type == 'api' && msg.content.indexOf('!ChangeBar') !== -1) { var message = msg.content.split(" ")[1]; log("Message: " + message); if (acceptedValues.includes(message)) { barValue = message; log("Blood and Dead bar value changed to " + message); } } }); on("change:graphic:bar1_value", function(obj) { if(obj.get("bar1_max") === "") return; if(obj.get("bar1_value") <= obj.get("bar1_max") / 2) { obj.set({ status_190335: true }); } else{ obj.set({ status_190335: false }) } if(obj.get("bar1_value") <= 0) { obj.set({ status_dead: true }); } else { obj.set({ status_dead: false }); } });
Figured it out. I have to reference it by the whole string, and incapsulate it in apostrophes: 'status_Injured::190335': true and 'status_Injured::190335': false