Command function

From StealthBot Wiki Backup
Jump to: navigation, search

The Command() Script Support Class subroutine allows you to execute internal commands.

Development

The command subroutine was added with the script system. Attempts have been made to make it return a string of what it sent. In version 2.7, IsLocal was made optional and Whispered was created as an optional parameter.

Documentation

'// COMMAND
'// Calls StealthBot's command processor
'// Messages passed to the processor will be evaluated as commands
'// Public Function Commands(ByRef dbAccess As udtGetAccessResponse, Username As String, _
'//     Message As String, InBot As Boolean) As String

'// RETURNS: The response string, or an empty string if there is no response

'// Detailed description of each variable:
'// dbAccess    is assembled below. It consists of the speaker username's access within the bot.
'//             For scripting purposes, this module will assemble dbAccess by calling GetAccess() on
'//             the username you specify.
'// Username    is the speaker's username (the username of the person using the command.)
'// Message     is the raw command message from Battle.net. If the user says ".say test", the raw
'//             command message is ".say test". This is the method by which you should call the commands.
'// InBot       defines whether or not the command has been issued from inside the bot. If it has,
'//             the trigger is temporarily changed to "/". Basically, for scripting purposes you can
'//             use it to control whether or not your command responses display publicly.
Public Sub Command(ByVal Username As String, ByVal Message As String, Optional ByVal IsLocal As Boolean = _
    False, Optional ByVal Whispered As Boolean = False)
    
    ' execute command
    Call ProcessCommand(Username, Message, IsLocal, Whispered)
End Sub

Summary

This subroutine is called to process a message to execute a bot command.

After calling, the bot will send the response directly to Battle.net if there is one. Instead use CommandEx() to intercept the command response.

Syntax

Command Username, Message, [IsLocal], [Whispered]

Arguments

  • Username is the name of the user who is executing the command.
  • Message is the message that is being processed.
  • IsLocal is an optional boolean that if set will process the command as if from in-bot.
  • Whispered is an optional boolean that if set will process the command as if from a whisper.

Examples

  • Add people to the database.
  • Command BotVars.Username, "/add " & Username & " 60 S", True
    

See also