HI all! I'm setting up a bunch of macros and general stuff to copy/paste in all of my games and I have a huge problem. I set up a rollable table with more than 200 spell areas (like fire cones, ice spheres, etc...) and use the token created from that rollable table as the token for a general character sheet. The idea (that I stole from somebody, sorry I couldn't find who you were anymore ^^") is to give access to that sheet to all players so when they cast a spell they can just drop it on the map and, with a macro, choose the element, the kind of area and the lenght of the area, and the token will change into the right template to quickly set up areas of effect. I then set up a bunch of macros, nesting them one in the other, to creat one single macro that could call all of the others for simple use. This is how the final macro looks like /w gm &{template:npcaction} {{rname=Aree d'effetto degli incantesimi}} {{description=**Target Base**
[Target](!
#SA-Base)
**Element**
[Acid](!
#SAAcidSpellList) | [Poison](!
#SAAcidSpellList) | [Cold](!
#SAIceSpellList) | [Fire](!
#SAFireSpellList) | [Lightning](!
#SALightningSpellList) | [Thunder](!
#SALightningSpellList) | [Necrotic/Darkness](!
#SADarkSpellList) | [Radiant/Light](!
#SALightSpellList) | [Arcane](!
#SAMagicSpellList)
}} It creates a chat menu where the players can choose the element of the spell. The nested macros prompt a question about the kind of area (cone, cube, line, etc...) and then call other macros that ask the length/diameter of the spell. And it works perfectly. The big problem was that every time a player uses the macro, it appears in my chat box (me being the GM) and it's bothering. I looked online for a solution and I found this script, made (of course :D ) by The Aaron on('ready', () => {
const processInlinerolls = (msg) => {
if(_.has(msg,'inlinerolls')){
return _.chain(msg.inlinerolls)
.reduce(function(m,v,k){
let ti=_.reduce(v.results.rolls,function(m2,v2){
if(_.has(v2,'table')){
m2.push(_.reduce(v2.results,function(m3,v3){
m3.push(v3.tableItem.name);
return m3;
},[]).join(', '));
}
return m2;
},[]).join(', ');
m['$[['+k+']]']= (ti.length && ti) || v.results.total || 0;
return m;
},{})
.reduce(function(m,v,k){
return m.replace(k,v);
},msg.content)
.value();
} else {
return msg.content;
}
};
let lastPlayerId;
on('chat:message', (msg) => {
if('api' !== msg.type ){
return;
}
let args = processInlinerolls(msg).split(/\s+/);
switch(args.shift()){
case '!me': {
const who=(getObj('player',('API'===msg.playerid ? lastPlayerId : msg.playerid))||{get:()=>'API'}).get('_displayname');
let content = args.join(' ');
if(_.has(msg,'rolltemplate') && _.isString(msg.rolltemplate) && msg.rolltemplate.length){
content = content.replace(/\{\{/,'&{template:'+msg.rolltemplate+'} {{');
}
sendChat(msg.who,`/w "${who}" ${content}`);
}
break;
default:
if(/\s!me\b/.test(msg.content)){
lastPlayerId = msg.playerid;
}
break;
}
});
}); From what I understood it should send the message (in my case the chat menu) as a whisper to whomever uses it without needing to select his token or to make different macros for each different player. I installed the script and changed my chat menu macro, changing "/w gm" with "!me"... and now it doesn't work anymore. The single macros inside of it, if called by themselves, still work perfectly, but if I try to call them from the main macro, the only one working is the first one (#SA-Base). Can anyone help me understand why? I know nothing of scripting, I just copy, paste and cut stuff I find online^^ Thanks