Gold said: How do we display the Tooltip text, in roll20's text chat room? API? Macro? Select tokens and issue: !show-tip or for whispered: !wshow-tip Code: on('ready',()=>{
const s = {
container: `display:inline-block;border:1px solid #999;border-radius:.2em; padding: .1em;background-color:white;width:100%;`,
img: `max-width: 5em;max-height:5em;display:block;overflow:auto;background-color:transparent;float:left;margin:.5em;`,
quote: `font-weight: bold;font-style:italic;padding:.3em;`,
clear: `clear:both;`
};
const f = {
container: (d,q) => `<div style="${s.container}">${d}${q}${f.clear()}</div>`,
item: (d)=>`<img src="${d}" style="${s.img}">`,
quote: (q)=>q?`<div style="${s.quote}">${q}</div>`:'',
clear: () => `<div style="${s.clear}"></div>`
};
on('chat:message',msg=>{
if('api'===msg.type && /^![w]?show-tip(\b\s|$)/i.test(msg.content) && playerIsGM(msg.playerid)){
let who = (getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname');
let whisper = /^!w/i.test(msg.content);
let msgs = (msg.selected || [])
.map(o=>getObj('graphic',o._id))
.filter(g=>undefined !== g)
.filter(g=>0 !== g.get('tooltip').length)
.map(t=>f.container(f.item(t.get('imgsrc')),f.quote(t.get('tooltip'))))
;
if(msgs){
sendChat('',`${whisper ? `/w "${who}" `: ''}${msgs.join('')}`);
}
}
});
});