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('')}`);
}
});
}
});