The last 'return "" ' should be outside the brackets, so it works for both when OldName has, and hasn't got a value
You forgot the brackets { } again, this should work:
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 Contact = e.item()
Messenger.MyName = Contact.Name;
MsgPlus.DisplayToast("Interpreter 1.0", "You are now interpretating your contact!");
return '';
}
}else if(Message.substr(0,9) == "/intoldname"){
if(OldName = ""){
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 '';
}
}