Hi there am using this script with the new char sheet of V20 with this macro ! ini ?{Dexterity|2} ?{Wits|2} ?{Celerity|0} ?{Mod|0} 0 ------------------------------------------ on("chat:message", function(msg) {
if( msg.type != 'api' ) return;
var cmd = msg.content.toLowerCase().split(' ');
if( cmd[0] == "!ini" ) {
var inputName = msg.who;
var list = findObjs({
_type: "character",
name: inputName
});
var str = "";
if (cmd[5] == 1) str = str + "/w gm ";
str = str + "<br><b>Initiative Roll</b>";
var roll = Math.floor((Math.random()*10)+1);
str = str + "<br>Dexterity: " + cmd[1];
str = str + "<br>Wits: " + cmd[2];
str = str + "<br>Celerity: " + cmd[3];
str = str + "<br>Mod: " + cmd[4];
str = str + "<br>Roll: " + roll;
var count = 0;
count = roll + parseInt(cmd[1]) + parseInt(cmd[2]) + parseInt(cmd[3]) + parseInt(cmd[4]);
str = str + "<br><b>Total: </b>" + count;
if (list.length == 0)
{
sendChat("player|"+msg.playerid, str);
}
else
{
sendChat("character|"+list[0].id, str);
}
var turnorder;
var turnorder;
if(Campaign().get("turnorder") == "") turnorder = []; //NOTE: We check to make sure that the turnorder isn't just an empty string first. If it is treat it like an empty array.
else turnorder = JSON.parse(Campaign().get("turnorder"));
//Add a new custom entry to the end of the turn order.
turnorder.push({
id: "-1",
pr: count,
custom: msg.who
});
Campaign().set("turnorder", JSON.stringify(turnorder));
}
});