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

Setting custom status markers

February 16 (1 month ago)

Edited February 16 (1 month ago)
GM
Pro

I wrote a script that looks for all tokens with the same name, and adds a status marker to all of those tokens. Format is !setStatus —<tokenname> —status.  

For the standard set it works fine, but it will not work for the many custom status markers I use. 

How does one set a custom status via the api?

They work off ids I think?

February 16 (1 month ago)
Kurt J.
Pro
API Scripter


GM said:

I wrote a script that looks for all tokens with the same name, and adds a status marker to all of those tokens. Format is !setStatus —<tokenname> —status.  

For the standard set it works fine, but it will not work for the many custom status markers I use. 

How does one set a custom status via the api?

They work off ids I think?

Custom markers get a number appended to them, and need to be referenced that way. For example, I have custom markers in my test game. Here is the info for one of them:

"id":50296
"name":"grim-reaper38285"
"tag":"grim-reaper38285::50296"
"url":"URL HERE

The list of markers can be retrieved from the campaign object and is called token_markers. Here is a quick and dirty ScriptCard to list them all along with their image:

!script {{
  --~|array;fromstring;markers;},{;[*C:token_markers]
  --%loop|foreach;markers
    --/+Loop|[&loop]
    --~|array;fromstring;thismarker;,;[&loop]
--&CleanURL|[@thismarker(3)]
--&CleanURL|[&CleanURL(replace,"url":",)]
--&CleanURL|[&CleanURL(replaceall,",)]
    --+Marker [@thismarker(0)]| [img width=20][&CleanURL][/img] [@thismarker(2)]
  --%|
  }}

Where you would use "skull", or "strong" for standard markers you would use the item in the tag field for custom ones (ex: radioactive38951::50310). Otherwise they work the same and can be included in the statusmarkers field on tokens like the normal ones.

February 16 (1 month ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I think if you install the libTokenMarkers library script (One Click), you do not need the number?

February 16 (1 month ago)
Andrew R.
Pro
Sheet Author

I recommend using libTokenMarkers like TokenMod & MetaScriptToolbox. It makes your life easier.

February 17 (1 month ago)
timmaugh
Pro
API Scripter

I believe that's right, Keith... the library lets you translate short-form names into the actual Roll20 marker object that you then need to add. A relevant example from TokenMod would be:

!token-mod --set statusmarkers|Dying

...where the "Dying" marker is a custom marker actually named "Dying::243507"

Incidentally, you can apply this to all tokens of a given name using TokenMod + the Metascript Toolbox by adding a {&select} tag. This formation would apply the Dying marker to all tokens named something starting with "Bobo"...

!token-mod --set statusmarkers|Dying {&select Bobo*}


March 10 (3 weeks ago)
GM
Pro

i never sent my thank you. Wel... thank you!