Difference between revisions of "TotalControl for LSL/Usage"

From SmartBots Developers Docs
Jump to: navigation, search
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE: Using TotalControl}}
 
{{DISPLAYTITLE: Using TotalControl}}
This section describes how to communicate with AdminBot gateway: manage it to login / logout your bot, talk over and listen to bot chat etc.
+
This section describes how to communicate with the TotalControl script: manage it to login / logout your bot, talk over and listen to bot chat etc.
  
 
== Interacting with TotalControl ==
 
== Interacting with TotalControl ==
 +
 
The two-way communication is performed by using commands and events:
 
The two-way communication is performed by using commands and events:
 +
 +
[[Image:Totalcontrol-scheme.jpg|link=|center]]
 +
<p></p>
  
 
{| width=100% class="niceTable"
 
{| width=100% class="niceTable"
  
! width=50% | COMMANDS (your script => library)
+
! width=50% | COMMANDS<br>your script => bot
! width=50% | EVENTS (library => your script)
+
! width=50% | EVENTS<br>bot => your script
  
 
|-
 
|-
Line 15: Line 19:
 
[[TotalControl for LSL/Commands|TotalControl Commands]] section contains the full list of the commands.
 
[[TotalControl for LSL/Commands|TotalControl Commands]] section contains the full list of the commands.
  
| Events is a notification being sent from the bot to your script (error message, group chat IM etc).
+
| Events are notifications being sent from the bot to your script (error messages, group chat IMs etc).
  
[[TotalControl for LSL/Events|TotalControl Events]] section contains all events which can be sent by AdminBot to your script.
+
[[TotalControl for LSL/Events|TotalControl Events]] section contains all events which can be sent by TotalControl to your script.
  
 
|- class=row-b
 
|- class=row-b
Line 23: Line 27:
 
=== How to send commands ===
 
=== How to send commands ===
 
Use LSL [http://wiki.secondlife.com/wiki/LlMessageLinked llMessageLinked] function to send commands to the bot.
 
Use LSL [http://wiki.secondlife.com/wiki/LlMessageLinked llMessageLinked] function to send commands to the bot.
 +
 +
<syntaxhighlight lang="lsl">
 +
llMessageLinked(LINK_SET, BOT_GET_BALANCE, "", NULL_KEY);
 +
</syntaxhighlight>
  
 
|
 
|
Line 28: Line 36:
 
Use [https://wiki.secondlife.com/wiki/Link_message link_message] LSL event to catch the events from the bot.
 
Use [https://wiki.secondlife.com/wiki/Link_message link_message] LSL event to catch the events from the bot.
  
 +
<syntaxhighlight lang="lsl">
 +
link_message(integer sender, integer cmd, string data, key id) {
 +
  if(cmd == BOT_EVENT_LISTEN_MONEY) {
 +
    debug("My balance is: " + data);
 +
  }
 +
}
 +
</syntaxhighlight>
  
 
|- class=row-a|
 
|- class=row-a|
Line 36: Line 51:
  
  
== Before Sending Any Commands ==
+
== Your script work ==
You have to set the group name before issuing the most of the commands. See [[TotalControl for LSL/Documentation/Initializing TotalControl|Initializing TotalControl]] for details.
+
 
 +
# Initialize TotalControl (set bot name): [[TotalControl for LSL/Documentation/Initializing TotalControl|Initializing TotalControl]]
 +
# Send [[TotalControl Commands|commands]]
 +
# Receive [[TotalControl Events|events]]
  
 
== Examples ==
 
== Examples ==
We've provided examples on the most important functions of TotalControl. They are available here: [[TotalControl for LSL/Examples|TotalControl Examples]].
+
 
 +
We've provided examples on the most important functions of TotalControl. They are available here: [[TotalControl Examples]].
  
 
{{NavMenu}}
 
{{NavMenu}}
  
 
__NOTOC__
 
__NOTOC__

Latest revision as of 20:25, 1 March 2019

This section describes how to communicate with the TotalControl script: manage it to login / logout your bot, talk over and listen to bot chat etc.

Interacting with TotalControl

The two-way communication is performed by using commands and events:

Totalcontrol-scheme.jpg

COMMANDS
your script => bot
EVENTS
bot => your script
These are the commands you send to the bot (initialization, group invitation etc).

TotalControl Commands section contains the full list of the commands.

Events are notifications being sent from the bot to your script (error messages, group chat IMs etc).

TotalControl Events section contains all events which can be sent by TotalControl to your script.

How to send commands

Use LSL llMessageLinked function to send commands to the bot.

llMessageLinked(LINK_SET, BOT_GET_BALANCE, "", NULL_KEY);

How to receive events

Use link_message LSL event to catch the events from the bot.

link_message(integer sender, integer cmd, string data, key id) {
  if(cmd == BOT_EVENT_LISTEN_MONEY) {
    debug("My balance is: " + data);
  } 
}

Was the command successful?

TotalControl invokes events to send you the command result.


Your script work

  1. Initialize TotalControl (set bot name): Initializing TotalControl
  2. Send commands
  3. Receive events

Examples

We've provided examples on the most important functions of TotalControl. They are available here: TotalControl Examples.