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

Issue with dead status marker

February 02 (10 years ago)
Keith
Pro
Marketplace Creator
I have a script that allows me to set the statusmakers from macros. Everything is working well except the 'status_dead' marker. The system does set the value (I inspected the statumarkers property of the graphic object) and it shows as selected in the popup window or status markers, but it does not place the red X on the token. Any thoughts?
February 02 (10 years ago)
The Aaron
Pro
API Scripter
If you give it a value, it won't show up (well, the X won't, but you will see a space between two other markers):
dead@0
It has to have no value:
dead
You can see an example of how I handle that special case here: https://wiki.roll20.net/API:Cookbook#objectToStatu...

February 02 (10 years ago)
Keith
Pro
Marketplace Creator
I am not giving it a number.

I get the token graphic (selObj) and then call

selObj.set("status_dead");
This is working just fine for all of the other markers. I do see a @0 at the end of the marker in the list after adding, but I do not know how it got there.


February 02 (10 years ago)

Edited February 03 (10 years ago)
The Aaron
Pro
API Scripter
Have any other scripts running? It might be adding the @0 automatically as part of the set() on 'status_dead'. You might try through the statusmarkers field.
February 03 (10 years ago)
Lithl
Pro
Sheet Author
API Scripter

The set function expects a second parameter. Most likely, if that parameter isn't true or false, it gets parsed as an integer, with 0 used as a default just to avoid stuff like NaN... but that means if you don't supply the second argument at all, you're getting a value of 0 (which strictly speaking is a different result than passing true as the second parameter, even if they look the same for all markers except dead).

February 03 (10 years ago)
The Aaron
Pro
API Scripter
Ah, good spotting! I never would have thought of that as I always use the object form for .set(). (and for that matter, I pretty much always use the 'statusmarkers' instead.
February 03 (10 years ago)
Keith
Pro
Marketplace Creator
Adding a second parameter did the trick. Thanks gents