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 .
×
Advertisement Create a free account

Adding custom statuses through the API

1595815183

Edited 1595815221
Hello.- How do I set custom statuses (markers) through the obj.set(,) function? I've been trying with both "status_<markername>" and "<markername>" to no avail. Any help would be appreciated.
1595815757
The Aaron
Forum Champion
API Scripter
Custom Statuses are listed in the Campaign property _token_markers, a JSON encoded array of objects, one per custom status.  Each status has a name, and tag and a url. The name is whatever you typed, like "Arrows", the tag will have a number attached, like "Arrows::123423412".  The number is not predictable.  The url is for the tag's image, in case you want to show it in a chat message.  It cannot be used for creating tokens. The tag is what you need to set on a token, in the token's statusmarkers property.  statusmarkers is a string containing a comma delimited list of status tags for that token.  Each status tag can optionally be followed by and @ sign and a number from 0–9. You can try the setting a "status_<tag>" property.  I'm not sure they work, but give it a shot.
1595815907
The Aaron
Forum Champion
API Scripter
Here's some information about it and some example scripts:&nbsp; <a href="https://wiki.roll20.net/API:Token_Markers" rel="nofollow">https://wiki.roll20.net/API:Token_Markers</a>
1595815955
The Aaron
Forum Champion
API Scripter
Here's a library for dealing with getting the available TokenMarkers in a game:&nbsp; <a href="https://app.roll20.net/forum/post/8061179/script-library-libtokenmarkers-a-resource-for-scripts-which-simplifies-using-the-new-token-markers" rel="nofollow">https://app.roll20.net/forum/post/8061179/script-library-libtokenmarkers-a-resource-for-scripts-which-simplifies-using-the-new-token-markers</a>
Hello.- In the end it turned out to be way too complicated, so I just made a SendChat command to send the API command through TokenMod. Thanks!!
1595819430
The Aaron
Forum Champion
API Scripter
Fair enough!