Difference between revisions of "AdminBot for LSL/Events"

From SmartBots Developers Docs
Jump to: navigation, search
Line 102: Line 102:
 
'''id''': Resident UUID
 
'''id''': Resident UUID
 
|}
 
|}
 +
 +
{{API Table start|Command|Description}}
 +
 +
{{API Group|Startup commands}}
 +
{{API Entry|AdminBot|SB_COMMAND_FAILED}}
 +
 +
{{API Table end}}
  
 
The numeric values are available here: [[AdminBot Examples: Header variables|Commands and events values]].
 
The numeric values are available here: [[AdminBot Examples: Header variables|Commands and events values]].

Revision as of 11:06, 3 November 2017

AdminBot raises events to inform your script about errors, chat IMs and other things happened. To catch it, use the LSL link_message event (see AdminBot Examples for usage patterns).

Parsing Events

LSL link_message event has the following syntax:

link_message(integer sender_num, integer num, string str, key id) {
  if(num == SB_SETUP_SUCCESS) {
    ...
  }
}

For AdminBot event, num contains the event code (see below). str and id value depend on the event. Refer to the table below for more info.

Events List

The following events can be raised by AdminBot:

Event Description & Parameters

Status events

SB_COMMAND_FAILED Raised when command error occurs.

str:
first line - command status code
second line - text explaination

SB_SETUP_SUCCESS Raised when group has been set successfully (group exists and not expired)

str: group name

id: group UUID

SB_SETUP_FAILED Raised when there was an error setting the group (group does not exist, expired etc)

str:
first line - group status code
second life - group expiration date

SB_SETUP_BOTNAME Raised after successful AdminBot initialization. Delivers the bot name and UUID serving the choosen group.

str: SL bot name

id: SL bot UUID

Group status request events

SB_STATUS_REPLY Reply when you request the group status using SB_STATUS_QUERY

str:
first line - group status code
second line - group expiration date

id: group UUID

Avatar status request events

SB_GROUP_CHECKED The reply of the SB_AVATAR_GROUP command.

str: 0 - avatar is not in the group
1 - avatar is in the group

id: avatar UUID

Group chat events

SB_CHAT_SUCCESS Raised when bot successfully connects to the group chat (see SB_CHAT_LISTEN)

id: Group UUID

SB_CHAT_MESSAGE Raised when bot receives the group chat message.

Important: Group Chat service must be activated.

str: resident-name: message

id: Resident UUID

Command Description

Startup commands

SB_COMMAND_FAILED Raised when command execution error occurs.

The numeric values are available here: Commands and events values.