Difference between revisions of "TotalControl for LSL/Events"

From SmartBots Developers Docs
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE: Events}} 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 ...")
 
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE: Events}}
+
{{DISPLAYTITLE: TotalControl Events}}
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 for Bots/Examples|AdminBot Examples]] for usage patterns).
+
TotalControl library raises events to inform your script about errors, chat IMs and other things happened. To catch them, use the LSL ''link_message'' event (see [[TotalControl for LSL/Examples|TotalControl Examples]] for usage patterns).
  
 
== Parsing Events ==
 
== Parsing Events ==
Line 6: Line 6:
  
 
<syntaxhighlight lang="lsl">
 
<syntaxhighlight lang="lsl">
link_message( integer sender_num, integer num, string str, key id )
+
link_message(integer sender_num, integer num, string str, key id) { ... }
 
</syntaxhighlight>
 
</syntaxhighlight>
  
For AdminBot, '''num''' will contain the event code (see below). '''str''' and '''id''' value depend on the event.
+
For TotalControl, '''num''' will contain the event code (see below). '''str''' and '''id''' values depend on the event.
  
 
== Events List ==
 
== Events List ==
  
The following events can be raised by AdminBot for Bots gateway:
+
The following events can be raised by TotalControl:
  
{| width=100%
+
{{API_Table_start|Command|Description}}
! Event / Description
+
! width=200 | str
+
! width=150 | id
+
|-
+
| colspan="3" |
+
=== Status events ===
+
|- class="row-b"
+
| colspan="3" | BOT_COMMAND_FAILED
+
|-
+
| Raised when command error occurs.
+
| class="row-a" | first line - [[AdminBot_for_Bots/Documentation/Status_Codes|command status code]]<br>second line - text explaination
+
| class="row-a" | ---
+
|- class="row-b"
+
| colspan="3" | BOT_SETUP_SUCCESS
+
|-
+
| Raised when bot has been set '''successfully''' (bot exists and not expired)
+
| class="row-a" | Bot name
+
| class="row-a" | ---
+
|- class="row-b"
+
| colspan="3" | BOT_SETUP_FAILED
+
|-
+
| Raised when there was an error setting the bot (bot does not exist, expired etc)
+
| class="row-a" | first line - [[AdminBot_for_Bots/Documentation/Status_Codes|bots status code]]<br>second life - bot expiration date
+
| class="row-a" | ---
+
|- class="row-b"
+
  
| colspan="3" |
+
{{API_Group|Status}}
 +
{{API_Entry|HTTP Bot Command|BOT_SETUP_SUCCESS}}
 +
{{API_Entry|HTTP Bot Command|BOT_SETUP_FAILED}}
 +
{{API_Entry|HTTP Bot Command|BOT_COMMAND_FAILED}}
 +
{{API_Entry|HTTP Bot Command|BOT_EVENT_STATUS_REPLY}}
  
=== Bot status request events ===
+
{{API_Group|Listeners}}
|- class="row-b"
+
{{API_Entry|HTTP Bot Command|BOT_EVENT_LISTEN_SUCCESS}}
| colspan="3" | BOT_EVENT_STATUS_REPLY
+
{{API_Entry|HTTP Bot Command|BOT_EVENT_LISTEN_LOCAL_CHAT}}
|-
+
{{API_Entry|HTTP Bot Command|BOT_EVENT_LISTEN_IM}}
| Reply when you request the bot status using [[AdminBot_for_Bots/Commands|BOT_STATUS_QUERY]]
+
{{API_Entry|HTTP Bot Command|BOT_EVENT_LISTEN_INVENTORY}}
| class="row-a" | first line - [[AdminBot_for_Bots/Documentation/Status_Codes|botts status code]]<br>second line - bot expiration date
+
{{API_Entry|HTTP Bot Command|BOT_EVENT_LISTEN_MONEY}}
| class="row-a" | ---
+
{{API_Entry|HTTP Bot Command|BOT_EVENT_LISTEN_DIALOG}}
  
|-
 
| colspan="3" |
 
  
=== Avatar status request events ===
+
{{API_Group|Request Responses}}
|- class="row-b"
+
{{API_Entry|HTTP Bot Command|BOT_LIST_GROUPS_REPLY}}
| colspan="3" | SB_GROUP_CHECKED
+
{{API_Entry|HTTP Bot Command|BOT_LIST_GROUP_ROLES_REPLY}}
|-
+
{{API_Entry|HTTP Bot Command|BOT_GET_BALANCE_REPLY}}
| The reply to a [[AdminBot_for_Groups/Commands/SB_AVATAR_GROUP|SB_AVATAR_GROUP]] command.
+
{{API_Entry|HTTP Bot Command|BOT_ATTACHMENTS_REPLY}}
| class="row-a" | 0 - avatar is not in the group
+
{{API_Entry|HTTP Bot Command|BOT_LOCATION_REPLY}}
1 - avatar is in the group
+
{{API_Entry|HTTP Bot Command|BOT_NOTECARD_CREATE_REPLY}}
| class="row-a" | avatar UUID
+
{{API_Entry|HTTP Bot Command|BOT_NOTECARD_READ_REPLY}}
  
|-
+
{{API_Table_end}}
| colspan="3" |
+
 
+
=== Group chat events ===
+
|- class="row-b"
+
| colspan="3" | BOT_EVENT_LISTEN_SUCCESS
+
|-
+
| Raised when bot successfully connects to the group chat (see [[AdminBot_for_Groups/Commands/SB CHAT LISTEN|SB_CHAT_LISTEN]])
+
| class="row-a" | ---
+
| class="row-a" | Group UUID
+
|- class="row-b"
+
| colspan="3" | SB_CHAT_MESSAGE
+
|-
+
| Raised when bot receives the group chat message.
+
'''*Group chat saving must be enabled.'''
+
| class="row-a" | Resident name: Message
+
| class="row-a" | Resident UUID
+
|}
+
 
+
The numeric values are available here: [[AdminBot Examples: Header variables|Commands and events values]].
+
  
 
{{NavMenu}}
 
{{NavMenu}}
  
 
__NOTOC__
 
__NOTOC__

Latest revision as of 16:29, 6 March 2019

TotalControl library raises events to inform your script about errors, chat IMs and other things happened. To catch them, use the LSL link_message event (see TotalControl 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) { ... }

For TotalControl, num will contain the event code (see below). str and id values depend on the event.

Events List

The following events can be raised by TotalControl:

Command Description

Status

BOT_SETUP_SUCCESS Raised when Bot has been set successfully
BOT_SETUP_FAILED Raised when there was an error setting the bot
BOT_COMMAND_FAILED Raised when command error occurs.
BOT_EVENT_STATUS_REPLY Raised when bot status is received.

Listeners

BOT_EVENT_LISTEN_SUCCESS Raised when a listener has successfully been established
BOT_EVENT_LISTEN_LOCAL_CHAT Raised when Bot sees a message in local chat
BOT_EVENT_LISTEN_IM Raised when Bot receives an instant message
BOT_EVENT_LISTEN_INVENTORY Raised when Bot receives an inventory item
BOT_EVENT_LISTEN_MONEY Raised when Bot receives a payment
BOT_EVENT_LISTEN_DIALOG Raised when Bot receives a dialog menu


Request Responses

BOT_LIST_GROUPS_REPLY Raised when Bot receives list of groups
BOT_LIST_GROUP_ROLES_REPLY Raised when Bot receives list of roles for a group
BOT_GET_BALANCE_REPLY Raised when balance is successfully requested
BOT_ATTACHMENTS_REPLY Raised when Bot receives list of attachments
BOT_LOCATION_REPLY Raised when bot returns its location
BOT_NOTECARD_CREATE_REPLY Raised when balance is successfully requested
BOT_NOTECARD_READ_REPLY Raised when when balance is successfully requested