I've created a roller for Eclipse Phase. It has Margin of Success/Failure count, checks for possible Moxie usages (and even shows what would happen after flip-flop). Here you go: // !eclipseroll TargetNumber HiddenType Title(SingleWord) // hidden 0 - public // hidden 1 - only GM // hidden 2 - private function EclipsePhaseDice(char, player, target, hidden, title) {     var addTitle = false;     if (title != null)     {         if (title != "")         {             addTitle = true;         }     }     var targetNumber = Number(target);     if (targetNumber > 98) targetNumber = 98;     if (targetNumber < 1) targetNumber = 1;     var text = "";     if (addTitle == true)     {         text = text + "<table border='1' style='width:100%'><tr><td align='center'><h3>" + title + " Roll</h3></tr></td><tr><td>";     }     else     {         text = text + "<table border='1' style='width:100%'><tr><td align='center'><h3>Roll</h3></tr></td><tr><td>";     }     text = text + "<b>Rolling for target:</b> " + target;    var rollOne = randomInteger(10) - 1; var rollTwo = randomInteger(10) - 1; var sum = (rollOne * 10) + rollTwo; var succ = false; var color = "red"; if (sum <= targetNumber) { succ = true; color = "green"; } var zeroText = ""; if (sum < 10) { zeroText = "0"; } var critical = false; if (rollOne == rollTwo) { critical = true; }     text = text + "<br><b>Rolled:</b> " + "<span style='color:" + color + "'>" + zeroText + sum + "</span>"; //00 or crit success if ((rollOne == 0 && rollTwo == 0) || (critical == true && succ == true)) { text = text + "<br><span style='color:green'><b>Critical Success!</b></span>"; } //99 or crit failure else if ((rollOne == 9 && rollTwo == 9) || (critical == true && succ == false)) { text = text + "<br><span style='color:red'><b>Critical Failure!</b></span>"; } var MoS = 0; if (sum > targetNumber) { MoS = sum - targetNumber; } else { MoS = targetNumber - sum; } if (succ == true) { text = text + "<br><b>MoS:</b> " + MoS; if (MoS >= 30) { text = text + "<br><span style='color:green'><b>Excellent Success!</b></span>"; } } else { text = text + "<br><b>MoF:</b> " + MoS; if (MoS >= 30) { text = text + "<br><span style='color:red'><b>Servere Failure!</b></span>"; } } if (critical == false) { var moxie = (rollTwo * 10) + rollOne; var addedMoxie = false; var moxieText = "<br><span style='color:green'>Moxie Usage</span>"; if (critical == true && succ == false) { if (addedMoxie == false) { text = text + moxieText; addedMoxie = true; } text = text + "<br>- Reject Critical on Failure"; } if (critical == false && succ == true) { if (addedMoxie == false) { text = text + moxieText; addedMoxie = true; } text = text + "<br>- Turn Success to Critical"; } if (critical == false) { if (moxie <= targetNumber) { if (addedMoxie == false) { text = text + moxieText; addedMoxie = true; } text = text + "<br>- Flip flop the roll! Result:"; var result = ""; var moxieMoS = targetNumber - moxie; if (moxieMoS >= 30) { result = "Excellent "; } var zeroMoxieText = ""; if (moxie < 10) { zeroMoxieText = "0"; } text = text + "<br>Roll: " + zeroMoxieText + moxie + " is a " + result + "Success. MoS: " + moxieMoS; } } }     text = text + "</td></tr></table>"        if (hidden==2)     {         var tempText = "/w " + whoSent + " "+text;         if (player==1) sendChat("player|"+char, tempText);         else sendChat("character|"+char, tempText);     }     if (hidden >= 1) text = "/w gm " + text;     if (player==1) sendChat("player|"+char, text);     else sendChat("character|"+char, text); }; on("chat:message", function(msg) {     if ( msg.type != 'api' ) return;     var cmd = msg.content.toLowerCase().split(' ');     if ( cmd[0] == "!eclipseroll" )  {         var inputName = msg.who;         var list = findObjs( { _type: "character", name: inputName         });         if (list.length == 0)         {             EclipsePhaseDice( msg.playerid, 1, cmd[1], cmd[2], cmd[3]);         }         else         {             EclipsePhaseDice( list[0].id, 0, cmd[1], cmd[2], cmd[3]);         }     } });