I wrote one a while back, which I call AddCustomTurn: on('ready',function(){
"use strict";
on('chat:message',function(msg){
var args,cmds,who,initial,change,entry;
if('api' === msg.type && msg.content.match(/^!act\b/) && playerIsGM(msg.playerid) ){
if(_.has(msg,'inlinerolls')){
msg.content = _.chain(msg.inlinerolls)
.reduce(function(m,v,k){
var 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();
}
args = msg.content
.replace(/<br\/>\n/g, ' ')
.replace(/(\{\{(.*?)\}\})/g," $2 ")
.split(/\s+--/);
cmds=args.shift().split(/\s+/);
change=parseFloat(cmds[1])||'+1';
initial=parseFloat(cmds[2])||0;
entry=args.join(' ');
if(entry.length){
let to=JSON.parse(Campaign().get('turnorder'))||[];
to.unshift({
id: "-1",
pr: initial,
custom: entry,
formula: change
});
Campaign().set('turnorder',JSON.stringify(to));
} else {
who=getObj('player',msg.playerid).get('_displayname');
sendChat('ACT',`/w "${who}" <div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"><div style="background-color: #ffeeee;">Error: no entry name provided.</div></div>`);
}
}
});
});
The syntax is: !act [rate of change] [initial value] --<name to use> Some examples: !act --Counter gives you an entry named Counter that starts at 0 and increases by 1 each round. !act 4 --Quad Counter Same as above, but counts up by 4s. !act -1 10 --Countdown Starts at 10, decrements by 1 each round. !act {{
-[[1d4]]
[[@{selected|Intellignce}d10!]]
--Something long and interesting number [[1d6]]
}} A very complicated entry where the change is -1 to -4, the starting number is the selected token's intelligence in d10s exploding, and with a title containing a number between 1 and 6. Enjoy!