Your OnEvent_ChatWndSendMessage function is wrong. For starters the main if-then-statement will never return true since you change everything to lowercase and compare it with a mixed case string. Second, you must(!) return the original message if it isn't a command of your command.
corrected:
js code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
>>> if (Message.substr(0,6).toLowerCase() == "/awayi"){<<<
var param = Message.substr(7);
switch(param){
case "enable":
AI.State = true;
return "";
case "disable":
AI.State = false;
return "";
case "commands":
var WindowOptions=MsgPlus.CreateWnd("Commands.xml","CommandsWND");
return "";
/*default:
alert("Invalid Command! Type \"/AwayI Commands\" to see a list of valid commands");
break;
*/
}
>>> } else {<<<
>>> return Message;<<<
}
}
---------
In the OnEvent_ChatWndReceiveMessage function you first must check if you actually can send a message. See point 3 in my previous post.
And also, just as in OnEvent_ChatWndSendMessage, you must(!) return the original message if you're not going to change it.