GroupInitiative doesn't support that style of rolling (yet, I'd love it but time constraints...). I have ANOTHER script that does. I wrote it a long time ago, so it's not quite as full-featured as more recent scripts, but I'm totally up to using it as a jumping off point for something nicer, or even rolling into GroupInitiative (I'd love to add a pluggable, extensible roller system for things like this). Commands: !step <NUMBER> -- does a roll publicly with the given step number, outputs results to chat. !gstep <NUMBER> -- does a roll privately with the given step number, outputs results to GM !istep <NUMBER> -- does a roll publicly with the given step number, outputs results to chat and puts all selected tokens into the initiative order with the result. All outputs can be hovered to see what was rolled, a little rudimentarily. Here's the code: on('ready',function(){
"use strict";
var stepRolls = [
'1d4!-2' , '1d4!-1' , '1d4!' , '1d6!' ,
'1d8!' , '1d10!' , '1d12!' , '2d6!' ,
'1d8!+1d6!' , '2d8!' , '1d10!+1d8!' , '2d10!' ,
'1d12!+1d10!' , '2d12!' , '1d12!+2d6' , '1d12!+1d8!+1d6!' ,
'1d12!+2d8!' , '1d12!+1d10!+1d8!' , '1d20!+2d6!' , '1d20!+1d8!+1d6!' ,
'1d20!+2d8!' , '1d20!+1d10!+1d8!' , '1d20!+2d10!' , '1d20!+1d12!+1d10!' ,
'1d20!+2d12!' , '1d20!+1d12!+2d6!' , '1d20!+1d12!+1d8!+1d6!' , '1d20!+1d12!+2d8!' ,
'1d20!+1d12!+1d10!+1d8!' , '2d20!+2d6!' , '2d20!+1d8!+1d6!' , '2d20!+2d8!' ,
'2d20!+1d10!+1d8!' , '2d20!+2d10!' , '2d20!+1d12!+1d10!' , '2d20!+2d12!' ,
'2d20!+1d12!+2d6!' , '2d20!+1d12!+1d8!+1d6!' , '2d20!+1d12!+2d8!' , '1d20!+1d12!+1d10!+1d8!'
],
ch = function (c) {
var entities = {
'<' : 'lt',
'>' : 'gt',
"'" : '#39',
'@' : '#64',
'{' : '#123',
'|' : '#124',
'}' : '#125',
'[' : '#91',
']' : '#93',
'"' : 'quot',
'-' : 'mdash',
' ' : 'nbsp'
};
if(_.has(entities,c) ){
return ('&'+entities[c]+';');
}
return '';
},
getFormatForDice = function (dice) {
var maxroll = 0,
minroll = 0,
dicePart = _.chain(dice.results.rolls)
.map(function(r){
return '(' + _.map(r.results, function(r2) {
maxroll += ( r.sides === r2.v ? 1 : 0 );
minroll += ( 1 === r2.v ? 1 : 0 );
return r2.v;
}).join('+')+')';
})
.reject(function(r){
return '()'===r;
})
.value().join('+'),
rollOut = '<span style="text-align: center; vertical-align: text-top; display: inline-block; min-width: 1.75em; border-radius: 5px; padding: 0px 2px; border-width: 2px; border-color: ' +
( maxroll && minroll ? '#4A57ED' : ( maxroll ? '#3FB315' : (minroll ? '#B31515' : '') ) ) +
'" title="Rolling '+dice.expression+' = ' + dicePart +
'" class="a inlinerollresult showtip tipsy-n ' + ( maxroll && minroll ? 'importantroll' : ( maxroll ? 'fullcrit' : (minroll ? 'fullfail' : '') ) ) +
'">' + dice.results.total + '</span>';
return rollOut;
};
on('chat:message', function(msg){
var args = msg.content.split(/\s+/),
turnorder,
stepNum;
if('api' !== msg.type) {
return;
}
switch(args.shift()) {
case '!step':
stepNum=parseInt(args.shift(),10);
if(stepNum >= 1 && stepNum <= 40) {
sendChat(msg.who, 'Step '+ stepNum + '<br>' +' [['+stepRolls[stepNum-1]+']]');
} else {
stepNum = stepNum || '<blank>';
sendChat(msg.who, '<b>Error:</b> Step Number '+stepNum+' is not valid!');
}
break;
case '!gstep':
stepNum=parseInt(args.shift(),10);
if(stepNum >= 1 && stepNum <= 40) {
sendChat(msg.who, '/w gm Step '+ stepNum + '<br>' +' [['+stepRolls[stepNum-1]+']]');
} else {
stepNum = stepNum || '<blank>';
sendChat(msg.who, '/w gm <b>Error:</b> Step Number '+stepNum+' is not valid!');
}
break;
case '!istep':
stepNum=parseInt(args.shift(),10);
if(stepNum >= 1 && stepNum <= 40) {
sendChat('', '[['+stepRolls[stepNum-1]+']]',function(msgs) {
var msg2 = msgs.pop(),
idx = msg2.content.match(/\$\[\[(\d+)\]\]/)[1],
rolls=msg2.inlinerolls[idx];
if(rolls) {
turnorder = Campaign().get('turnorder');
turnorder = ('' === turnorder) ? [] : JSON.parse(turnorder);
Campaign().set({
turnorder: JSON.stringify(
_.chain(msg.selected)
.map(function(s){
return getObj(s._type,s._id);
})
.reject(_.isUndefined)
.map(function(s){
return {
token: s,
character: getObj('character',s.get('represents'))
};
})
.reduce(function(m,s){
let entry=_.findWhere(m,{id: s.token.id});
if(entry){
entry.pr = rolls.results.total;
} else {
m.push({
id: s.token.id,
pr: rolls.results.total,
custom: ''
});
}
return m;
},turnorder)
.value()
)
});
sendChat(msg.who, '/direct Inititative roll: '+getFormatForDice(rolls));
}
});
} else {
stepNum = stepNum || '<blank>';
sendChat(msg.who, '<b>Error:</b> Step Number '+stepNum+' is not valid!');
}
break;
}
});
});