MARS Client Scripting Library - MarsCommand

From Multiverse

Jump to: navigation, search

MarsCommand is a module in the Mars Client Scripting API used for handling commands entered on the client.




Contents

Methods

HandleCommand

HandleCommand(command_line)

This is the standard implementation of the function for handling commands that the user types. If the command does not start with a '/', HandleCommand treats it as if it were preceded with '/say ', that is, as chat text.

The function splits the entered command on whitespace, and looks up the first token (the command name) in the dictionary of local command handlers. If one is found, it invokes the command handler with the rest of the arguments from the command line. If it does not find a local command handler, it sends a message to the server with the command line and the current target.

Returns

None

Parameters

Parameter Datatype Default Value Description
command_line string None The command line entered by the client.

RegisterCommandHandler

RegisterCommandHandler(command, function)

Register a local command handler, so that when a client types a command line starting with the specified command, it is dispatched to the handler.

Returns

None

Parameters

Parameter Datatype Default Value Description
command string None The name of the command to register.
function function None A method that will be invoked with an array of strings as the argument.

Events

The MarsCommand module does not generates any UI events.

Messages

The MarsCommand module does not register for any message types

Personal tools