Put this code in your js file.
code:
function OnGetScriptCommands ()
{
commands = "<ScriptCommands>";
commands += "<Command>";
commands += "<Name>Command 1</Name>"; //Dont put a "/"before the command
commands += "<Description>Description for command 1</Description>";
commands += "</Command>";
commands += "<Command>";
commands += "<Name>Command 2</Name>";
commands += "<Description>Description for command 2</Description>";
commands += "</Command>";
commands += "<Command>";
commands += "<Name>Command 3</Name>";
commands += "<Description>Description for command 3</Description>";
commands += "</Command>";
commands += "</ScriptCommands>";
return commands;
}
And to trigger a function when a command is used use -
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if(Message.substr(0, 9) == '/command1') { //"/" will be used here.
Dosomething();
return '';
}
}