addCommandHandler: Difference between revisions

no edit summary
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{ScriptItem
{{ScriptItem2
|endpoint = shared
|name = addCommandHandler
|side = shared
|type = function
|type = function
|name = addCommandHandler
|games = iii vc sa iv
|usage = set a function to call when a player types the specified command in-game.
|desc = set a function to call when a player types the specified command in-game.
|notes = Command names are case-insensitive.<br>If a function is already added for the command, the function is only set for the command if '''replace''' is '''bool true'''
|arg1 = string command The command name to be typed in-game in the chat box.
|parameters = string command, function handler, [ bool replace = false ]
|arg2 = function handler The scripting function to be called when a player types the command in-game in the chat box.
|parameter1 = string command The command name to be typed in-game in the chat box.
|arg3 = [bool replace = false] Whether to replace the handler for the command if one is already bound to the command.
|parameter2 = function handler The scripting function to be called when a player types the command in-game in the chat box.
|return = bool Whether the handler was bound to the command.
|parameter3 = bool replace optional false Whether to replace the handler for the command if one is already bound to the command.
|freturn = bool false
|return1 = bool Whether the handler was bound to the command.
|note = If replace is true, the existing callback function is replaced with the new callback function specified.
|returnFail1 = bool false
|note2 = Command names are case-insensitive.<br>If a function is already added for the command, the function is only set for the command if '''replace''' is '''bool true'''
|callback2SyntaxSS = string command, string parameters, Client client
|cb2arg1SS = string command The command that was typed.
|callback2ParameterSS1 = string command The command that was typed.
|cb2arg2SS = string parameters The parameters string that was typed.
|callback2ParameterSS2 = string parameters The parameters string that was typed.
|cb2arg3SS = Client client The client that typed the command.
|callback2ParameterSS3 = Client client The client that typed the command.
|cb2arg1CS = string command The command that was typed.
|callback2SyntaxCS = string command, string parameters
|cb2arg2CS = string parameters The parameters string that was typed.
|callback2ParameterCS1 = string command The command that was typed.
|callback2ParameterCS2 = string parameters The parameters string that was typed.
|notes = If replace is true, the existing callback function is replaced with the new callback function specified.
|exampleJSSS = addCommandHandler('test', function(command, text, client)
|exampleJSSS = addCommandHandler('test', function(command, text, client)
{
{
6,833

edits