Ok, I threw something together real quick. It's not a full featured script, more of a snippet but it should get the job done until I have time to write something better. Let me know if it needs any changes. Commands : !qin -- does a roll of two d10s, one black, one white and presents the results. A black background indicates black was higher, a white background indicates white was higher, a grey background indicates equality. Pointing to the roll will show what the dice were. You can add a message after the command and it will be displayed after the result. !wqin -- the same as !qin, but the result is whispered to the player !bqin -- the same as !qin, but the result is sent to the gm (blind). Examples : (note, I added the speaking as name of who issued the command toward the bottom, but all messages will have it) Source: on('ready',function(){
"use strict";
on('chat:message',function(msg){
var content,black,white,cmd,res,colors,who,src;
cmd =msg.content.match(/^!(w|b)?qin\b/);
if('api' === msg.type && cmd ){
content = _.rest(msg.content.split(/\s+/));
black=randomInteger(10);
white=randomInteger(10);
res = Math.abs(black-white);
colors = ( black > white ?
{b: '#000',f:'#fff'} :
white > black ?
{b: '#fff',f:'#000'} :
{b: '#ccc',f:'#666'} );
who = ('w' === cmd[1] ?
'/w "'+getObj('player',msg.playerid).get('displayname')+'" ' :
'b' === cmd[1] ?
'/w gm ' :
'' );
src = ' ['+msg.who+']' ;
sendChat('Qin'+src, who+'<div><span title="'+black+' [Black] | '+white+' [White]" class="showtip tipsy-n" style="display:inline-block;background-color:'+colors.b+';color:'+colors.f+';border: 2px solid '+colors.f+';padding: .1em .2em;">'+res+'</span> '+content.join(' ')+'</div>');
}
});
});