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

Is there a way I can query / display all the statusmarker conditions a selected token has on them?

I use !token-mod to set the statusmarkers on to Tokens (love it!). Is there a way I can query and display all the statusmarker conditions that a selected token has? Something akin to:  /w gm &{template:info} {{item=@{target|Token|token_name} Conditions }} {{ <<Some Magical Macro/API stuff here>> }} That displays the following to Chat?
1632685813

Edited 1632709064
The Aaron
Roll20 Production Team
API Scripter
Here's a little script Snippet that does that (requires libTokenMarkers, which is in the 1-click Script Library).  You can show it to chat with: !show-info or whisper it with: !wshow-info Code: /* globals 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 getStatusesOnToken = (t) => t.get('statusmarkers') .split(/,/) .filter(s=>0!==s.length) .map(s=>{ let p = s.split(/@/); return { num: p[1]||'', marker: libTokenMarkers.getStatus(p[0]) }; }); const formatData = (d)=>`<div><b>${d.t.get('name')}</b>: ${d.s.map(s=>`${s.marker.name}${s.num.length ? `(${s.num})`:''}`).join(', ')||'[<i>None</i>]'}</div>`; on('chat:message',msg=>{ if('api'===msg.type && /^!([w]?)show-info(\b\s|$)/i.test(msg.content) ){ let who = (getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname'); let data = (msg.selected || []) .map(o=>getObj('graphic',o._id)) .filter(g=>undefined !== g) .map(t=>({t, s: getStatusesOnToken(t)})) .reduce((m,d)=>[...m,formatData(d)],[]) ; let whisper = /^!w/i.test(msg.content); sendChat('',`${ whisper ? `/w "${who}" ` : ''}${data.join('')}`); } }); } });
1632687377
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Reporter script can do it. Simple: !report --t|statusmarkers Pretty: !report --t|statusmarkers|Conditions --- ---- title|Conditions| showheader|false showfooter|false source|false It can even pull info for all characters currently on the tracker: !report --t|statusmarkers|- ---- showfooter|false showheader|false source|false title|Tracker Compact| layer|tracker compact|true hideempty|true charactersheetbutton|true
Pure gold, thank you!
1632693362
The Aaron
Roll20 Production Team
API Scripter
Ooh!  Reporter, forgot about that one!  That's a much cleaner option!
Keith -- does Reporter have some dependencies on other scripts (libTokenMarkers, perhaps) that I haven't loaded, or specific character sheet templates? I made a backup of my current campaign, and installed Reporter as the only API script in the campaign. I selected a single token, added some status markers, and then ran: !report --t|statusmarkers Chat displays: (From Reporter):  Ready But the script crashes with the following error:
1632699657
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I know exactly what this is, and I should have noticed from your screen shot. Currently, Reporter only supports two sheets: D&D 5th Edition by Roll20 Sheet and Pathfinder 2 by Roll20. There's some logic I need to find to ignore all other sheets. Until I get  a chance to update the code, The Aaron's script is a better solution.
Thanks for the tip. Footnoting Reporter in case I *ever* go back to D&D 5E, it looks really slick (and I hope to see more tutorials on your YouTube channel, Keith -- maybe exploring what's under the hood of all those macro buttons you've got up!!). I did load Aaron's script (already had libTokenMarkers loaded for something or other). It does indeed to the job, thanks, Aaron! I need to figure out how to modify it to NOT display "undefined" if a token as no status markers on them (need to get me a javascript for dummies book first). 
1632708563
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Removing the subroutines which fail when a sheet is not one of the two supported ones is definitely next on my list.
1632709094
The Aaron
Roll20 Production Team
API Scripter
JP said: I need to figure out how to modify it to NOT display "undefined" if a token as no status markers on them (need to get me a javascript for dummies book first).  Whoops!  I fixed that in the above code block.  =D