When utilizing the new feature for SendChat, I've noticed that on some occasions, it will re-send things that have previously been said in chat by players -- as this also includes API commands, it results in some weird stuff. Restarting sandbox due to script changes... Spinning up new sandbox... "[27/7/2015 18:16:52] 'Sandbox has been loaded.'" "[27/7/2015 18:16:52] 'Systems ready.'" "[27/7/2015 18:16:57] 'New system command by Alan ( Removed ): games,slots,start'" "[27/7/2015 18:17:02] 'New system command by Alan ( Removed ): games,slots,start' Neither of those last two lines were as a result of me typing in the R20 chat -- seem to occur by themselves on("ready", function () {
Chatlog("Sandbox has been loaded."); setTimeout(function(){ CheckInstall(); if (myState.ReadyChat) { myState.ReadyChat = false sendChat("System","/w GM "+systemText("The API has been restarted."), null, {noarchive: true}) }
// Gives the system its necessary functions. runGameStateFunctions()
Chatlog("Systems ready."); },100); setTimeout(function(){ Chatlog("System will now notify GMs of a restart.") myState.ReadyChat = true },300000); }); on("chat:message", function(msg) { if (msg.type == "api") { var isGM = playerIsGM(msg.playerid) var cleanedMsg = msg.content.substr(1,msg.content.length) cleanedMsg = cleanedMsg.split(" -/") var IDPlayer = msg.playerid var PlayerName = getObj("player",msg.playerid).get("_displayname").split(" ")[0] Chatlog("New system command by "+PlayerName+" ("+IDPlayer+"): "+cleanedMsg)
...
...
...
}
}) Tried commenting out runGameStateFunctions(), but all that happens is it seems to try and call for a function that now doesn't exist. These issues do appear to be resolved resolved, however, upon removing the fourth and third field of this line; sendChat("System","/w GM "+systemText("The API has been restarted."), null, {noarchive: true}) --> sendChat("System","/w GM "+systemText("The API has been restarted.")) EDIT: