If you did want to do this with a script, here's one that does it... on('ready',function(){
"use strict";
let esRE = function (s) {
var escapeForRegexp = /(\\|\/|\[|\]|\(|\)|\{|\}|\?|\+|\*|\||\.|\^|\$)/g;
return s.replace(escapeForRegexp,"\\$1");
},
HE = (function(){
var entities={
//' ' : '&'+'nbsp'+';',
'<' : '&'+'lt'+';',
'>' : '&'+'gt'+';',
"'" : '&'+'#39'+';',
'@' : '&'+'#64'+';',
'{' : '&'+'#123'+';',
'|' : '&'+'#124'+';',
'}' : '&'+'#125'+';',
'[' : '&'+'#91'+';',
']' : '&'+'#93'+';',
'"' : '&'+'quot'+';'
},
re=new RegExp('('+_.map(_.keys(entities),esRE).join('|')+')','g');
return function(s){
return s.replace(re, function(c){ return entities[c] || c; });
};
}());
on('chat:message',function(msg){
var cmd,who;
if('api' !== msg.type || !playerIsGM(msg.playerid) ){
return;
}
cmd=msg.content.match(/^!roll(\d+)\s+(.*)$/);
who=(getObj('player',msg.playerid)||{get:_.noop}).get('displayname');
if(cmd){
let times=parseInt(cmd[1],10);
sendChat('',`/w "${who}" [${times} x ${HE(cmd[2])}](!${_.times(times,()=>`&${'#13;'}${cmd[2]}`).join('')})`);
}
});
});
Standard escaping rules apply: