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

[Script]Help with applying Custom Status Markers with Api

1609887911
Michael I.
Pro
Sheet Author
updating a older script from before Custom Status Markers This works if the Status marker is from the default set // MISERABLE     // this initiates the attribute 'miserable' not only the value of it     var miserable_attribute = findObjs({         _characterid: characterid,         _type: 'attribute',         name: 'miserable'     })[0] || createObj('attribute',{characterid: characterid, name: 'miserable'});     if (         // hope is below or equal shadow, but not if shadow is 0         (parseInt(hope, 10) <= parseInt(total_shadow, 10) && parseInt(total_shadow, 10) != 0) ||         // in case it has been set manually by the player, e.g. as result of a hazard         (miserable === '1')     ) {         // optional: send a message to everyone         // but send the message only on state changes         if (miserable === '0') {             sendChat('character|'+characterid, '/me is miserable!');                          miserable_attribute.set('current', '1');         }         tokens.forEach(function(token) {             // #98000             token.set('status_bleeding-eye', '0');         }, this);         }     else if (             (miserable === '0') ||             (parseInt(hope, 10) > parseInt(total_shadow, 10))         ) {                         miserable_attribute.set('current', '0');                          tokens.forEach(function(token) {                 // transparent                 token.set('status_bleeding-eye', false);             }, this);         }      else {         return;     }     } However if I change the bleeding-eye to my-status-marker (my-status-marker is the name of the custom status marker image) the image is on a custom status marker set yes its in my library and set in game but does not work. so the question is do we have to add something to the call, to be able to use custom status marker sets from the API, I couldn't find any documentation on this. any help would be appreciated
1609892169

Edited 1609892183
The Aaron
Roll20 Production Team
API Scripter
You need to use the Tag name of the Token Marker.  You can see them in the help for TokenMod, or here's a little script that will whisper you a list of them (requires libTokenMarkers from the 1-click): !list-sm /* global libTokenMarkers */ on('ready', ()=>{ // Make sure libTokenMarkers exists, and has the functions that are expected if('undefined' === typeof libTokenMarkers || (['getStatus','getStatuses','getOrderedList'].find(k=> !libTokenMarkers.hasOwnProperty(k) || 'function' !== typeof libTokenMarkers[k] )) ) { // notify of the missing library sendChat('',`/w gm <div style="color:red;font-weight:bold;border:2px solid red;background-color:black;border-radius:1em;padding:1em;">Missing dependency: libTokenMarkers</div>`); } else { const c = (()=>{ let last = '#eeeeff'; return () => { last = ('#eeeeff' === last ? '#eeffee' : '#eeeeff'); return last; }; })(); const fmtMarker = (m)=>`<div style="background-color: ${c()}; border: 1px solid #aaa; padding: .1em;">${m.getHTML(3,"float:left;")}<div style="float:left"><b>${m.getName()}</b><br><code>${m.getTag()}</code></div><div style="clear:both;"></div></div>`; // Watch for chat messages on('chat:message',(msg) => { // when `!set-sm` occurs, do something if('api'===msg.type && /^!list-sm(\b\s|$)/i.test(msg.content)){ let who = (getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname'); // get all the markers that match the first argument let markers = libTokenMarkers .getOrderedList() .map(fmtMarker) .join(''); sendChat('All TokenMarkers',`/w "${who}" <div style="background-color:#ccc;">${markers}</div>`); } }); } }); Tag name is in red:
1609926480
Michael I.
Pro
Sheet Author
Thank You Aaron as always Your the best