Difference between revisions of "TotalControl for LSL/Usage"
Line 23: | Line 23: | ||
=== 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 32: | ||
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| |
Revision as of 13:53, 12 May 2017
This section describes how to communicate with AdminBot gateway: 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:
COMMANDS (your script => library) | EVENTS (library => 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 is a notification being sent from the bot to your script (error message, group chat IM etc).
TotalControl Events section contains all events which can be sent by AdminBot to your script. |
How to send commandsUse LSL llMessageLinked function to send commands to the bot. llMessageLinked(LINK_SET, BOT_GET_BALANCE, "", NULL_KEY);
|
How to receive eventsUse 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. |
Before Sending Any Commands
You have to set the group name before issuing the most of the commands. See Initializing TotalControl for details.
Examples
We've provided examples on the most important functions of TotalControl. They are available here: TotalControl Examples.