I do not know what exactly is happening to cause this, but I have what I can only call as a "ghost script" running in the background. Its a previous copy of code I used for my Level of Difficulty script. I noticed this when one of my players started rolling the dice and this script ran twice. I even disabled my scripts and a "Ghost copy" of code is running in the background. So the output should just have one copy but instead I am getting this: Difficulty achieved: Zen (440) Warning: Physical actions require Zen(440+) and Inhumanity (320+) Zen (440) Warning: Physical actions require Zen(440+) and Inhumanity (320+) As you can tell from the following code, there is no reason why I should be getting two outputs. And remember: if I disable all 3 of my scripts, I still get the ouput as if something is running. //Simple level of difficulty announcer. Will look at the roll and declare
//the level of difficulty achieved. GM Rolls should be always private.
on("chat:message", function(msg){
//Optional: the ability to trigger between announcing public rolls to the GM
//and announcing to the public.
var LOD_privMsg = false;
var LOD_gmOnly = false;
if(msg.type == "rollresult" || msg.type == "gmrollresult"){
//log("Parsing the roll");
var rollMsg = JSON.parse(msg.content);
if(rollMsg.rolls[0].dice>1 || rollMsg.rolls[0].table != null || msg.content.indexOf("initiative") !== -1 || msg.content.indexOf("Initiative") !== -1 ) return; //So mass rolls and tables aren't confused.
//log("Message is a roll");
var total = rollMsg.total; //Total roll
var type = rollMsg.rolls[0].sides; //Number of sides
var out = ""; //The LoD reached
var warning = ""; //A warning on the message if there is any (like limits)
//Part 1: get roll result (Future Function)
if(type == 100){//d100
//log("Message is a d100");
//log("D100 roll: "+total);
if(total<20) out = "Failure";
else if(total<40) out = "Routine (20)";
else if(total<80) out = "Easy (40)";
else if(total<120) out = "Medium (80)";
else if(total<140) out = "Difficult (120)";
else if(total<180) out = "Very Difficult (140)";
else if(total<240) out = "Absurd (180)";
else if(total<280) out = "Almost Impossible (240)";
else if(total<320) out = "Impossible (280)";
else if(total<440){
out = "Inhuman (320)";
warning = "Warning: Physical actions require Inhumanity(320+)";
}
else{
out = "Zen (440)";
warning = "Warning: Physical actions require Zen(440+) and Inhumanity (320+)";
}
if(msg.content.indexOf("attack") !== -1 || msg.content.indexOf("Attack") !== -1
|| msg.content.indexOf("Defense") !== -1 || msg.content.indexOf("defense") !== -1)
out = ""; //These keywords used for other macros
//log("Got total");
}
else if(type == 10){//d10
//log("Message is a d10");
if(rollMsg.rolls[0].results[0].v == 10){
total = total+2;
warning = "Notice: Real total is "+total.toString()+" (a 10 counts as a 12)";
}
//log("D10 roll: "+total);
if(total<6) out = "Failure";
else if(total<10) out = "Simple Actions (6+)";
else if(total<15) out = "Normal Actions (10+)";
else if(total<20) out = "Complex Actions (15+)";
else out = "Extreme Actions (20+)";
//log("Got total");
}
else{
//log("it is a dice roll, but I am doing nothing");
return; //Do nothing
}
if (out != "") log("Output: "+out);
if (warning != "") log("Warning: "+warning);
if(msg.type == "gmrollresult" || LOD_gmOnly){
if(out != "")
out = "/w gm "+out;
if(warning != "") warning = "/w gm "+warning;
}
else if(LOD_privMsg){
if(out != "")
out = "/w "+msg.who+" "+out;
if(warning!= "") warning = "/w "+msg.who+" "+warning;
}
//Part 2: Output Result as chat message (Future function)
if(out != ""){
sendChat("Difficulty achieved", out);
}
if (warning != ""){
sendChat("Difficulty achieved",warning);
}
}
//log("Message is not a roll");
return;
});