Here's the fixed code. See
BOLD letters for the change made.
code:
var OldName;
function OnGetScriptCommands(){
var commands = '<ScriptCommands>';
commands+='<Command>';
commands+='<Name>intstealname</Name>';
commands+='<Description>Steal your contacts name!</Description>';
commands+='<Parameters/>';
commands+='</Command>';
commands+='<Command>';
commands+='<Name>intoldname</Name>';
commands+='<Description>Change your name back to the previous name!</Description>';
commands+='<Parameters/>';
commands+='</Command>';
commands+='</ScriptCommands>';
return commands;
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if(Message.substr(0,13) == "/intstealname")
{
OldName = Messenger.MyName;
var Contacts = ChatWnd.Contacts;
var e = new Enumerator(Contacts); for(; !e.atEnd(); e.moveNext())
var Blah = e.item()
Messenger.MyName = Blah.Name;
MsgPlus.DisplayToast("Interpreter 1.0", "You are now interpretating your contact!");
return '';
}
if(Message.substr(0,11) == "/intoldname")
{
if(OldName == null){
MsgPlus.DisplayToast("Interpreter 1.0", "You dont have an old name!");
}else{
Messenger.MyName = OldName;
MsgPlus.DisplayToast("Interpreter 1.0", "Your name is back to normal!");
}
return '';
}
}