|
ScriptCommandTemplate
ScriptCommandTemplate is a template showing how to
define an event handler for the "/script" command. The handler can
have any function name and many different handlers can be defined
for this command.
Syntax
[string] ScriptCommandTemplate(
[object] ChatWnd,
[array] Parameters
);
Parameters
- ChatWnd
- [object] The ChatWnd object
attached to the chat window that generated the event.
- Parameters
- [array] Array of parameters specified with the command.
The parameters are parsed like in a command line: each parameter
must be separated by a space character and parameters can be
enclosed in "". See example.
Return Value
A string containing the message to send. If no message should be
sent in the chat window in response to the command, return an empty
string.
Remarks
The /script command of Messenger Plus! calls a function in a
script. It is used like this:
/script
[script\]function [param1] [param2] ... [paramx]
The user can specify the name of the script where the function
is located. If no script name is specified, the function is
searched and executed in every script that defines it.
Example
The user sends the following message in a chat window:
/script TestCommand "first text"
text2
The script handles the event with the following function,
displays the parameters in the debugging window and returns an
empty string to prevent any message to be sent in the chat.
function TestCommand(Wnd, Params)
{
Debug.Trace("TestCommand has been called");
var array = VBArray(Params).toArray();
for(i = 0; i < array.length; i++)
Debug.Trace(" Parameter: " + array[i]);
return "";
}
Event Information
| Event Source |
Messenger Plus! |
| Availability |
Messenger Plus! Live 4.00 |
See Also
Messenger Plus! Events,
ChatWnd, JScript's
VBArray Object.
|