
i'm trying to find a way to whisper the output of a script to a selected player. I found this script (written by The Aaron) on an older forum post that displays the portrait from an character's bio page to the chat. This works great when I want to display the image to everyone, but I'd like a way to whisper the output to a particular player character (or characters). Currently, with this script, I select a token, then type !Art (actually, click a macro button that contains that), then the portrait in the Bio page appears in chat. What I'd like to do is: Create a macro that prompts me to select the token of the character whose portrait I want to display, then, after that token is selected, ask me to select the tokens of the characters to which I want to whisper the output. If this can't be done in a macro, I could use help in editing the script to do this natively. (And by help, I mean tell me exactly what I need to change since I don't know how to code 😁 ) Original MOD, by The Aaron: on('ready',()=>{
on('chat:message', (msg) => {
if('api'===msg.type && /^!art(\b\s|$)/i.test(msg.content) ){
let c = [...(new Set((msg.selected || [])
.map(o=>getObj('graphic',o._id))
.filter(g=>undefined !== g)
.map(g=>getObj('character',g.get('represents')))
.filter(c=>undefined !== c)
.map(c=>c.get('avatar'))
.map(u=>`<div><img src="${u.replace(/\?.*$/,'')}"></div>`)
))]
.join('')
;
if(c){
sendChat(msg.who, c);
}
}
});
});