Here's a very simple script that demonstrates the mechanics: !sendroll [[3d6]] Code: 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;
}
};
on('chat:message',msg=>{
if('api'===msg.type && /^!sendroll(\b\s|$)/i.test(msg.content) ){
let content = processInlinerolls(msg);
let who = (getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname');
let args = content.split(/\s+/);
sendChat('',`/w "${who}" You rolled ${args[1]}`);
sendChat('',`/w gm <code>${who}</code> rolled ${args[1]} which is ${parseInt(args[1])-5} when you subtract 5.`);
}
});
});
The complexity is not in how you send the data, but in how you manage what you want to send (who is cursed, which roll was affected, etc). I'm not aware of scripts that would let you do this, you'd need to come up with a plan an write one.