Difference between revisions of "TotalControl for LSL/Commands/BOT STATUS QUERY"
From SmartBots Developers Docs
(17 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:BOT_STATUS_QUERY}} | {{DISPLAYTITLE:BOT_STATUS_QUERY}} | ||
− | <onlyinclude>Queries the | + | <onlyinclude>Queries the selected bot status (useful to determine the subscription length).</onlyinclude> Result is being returned using [[TotalControl for LSL/Events/BOT_EVENT_STATUS_REPLY|BOT_EVENT_STATUS_REPLY]] event |
<syntaxhighlight lang="lsl"> | <syntaxhighlight lang="lsl"> | ||
Line 8: | Line 8: | ||
{{API Variables Table}} | {{API Variables Table}} | ||
− | {{AdminBot Required Vars| | + | {{AdminBot Required Vars|BOT_STATUS_QUERY}} |
{{API Variable|str|yes}} --- | {{API Variable|str|yes}} --- | ||
{{API Variable|id|yes}} --- | {{API Variable|id|yes}} --- | ||
Line 14: | Line 14: | ||
{{API Variables Table End}} | {{API Variables Table End}} | ||
− | {{AdminBot Event after Command| | + | {{AdminBot Event after Bot Command|BOT_EVENT_STATUS_REPLY|BOT_EVENT_STATUS_REPLY}} |
− | {{AdminBot Event after Command Entry|str}} first line - bot status code (see all codes [[ | + | {{AdminBot Event after Command Entry|str}}String representing the bot's status: |
− | second line - bot expiration date | + | |
+ | # first line - bot status code (see all codes [[Usage/Status_Codes|here]])<br> | ||
+ | # second line - bot expiration date<br> | ||
+ | # third line - bot online status | ||
+ | |||
+ | Online statuses: | ||
+ | * ONLINE - Bot is online | ||
+ | * LOGGED OUT - Bot was logged out by gracefully | ||
+ | * CONNECTING - The bot is logging in | ||
+ | * OFFLINE - Bot is expired or has an error | ||
+ | |||
+ | Example: | ||
+ | |||
+ | OK | ||
+ | 2019-03-10 00:00 | ||
+ | LOGGED OUT | ||
+ | |||
{{AdminBot Event after Command Entry|id}} Bot UUID | {{AdminBot Event after Command Entry|id}} Bot UUID | ||
{{AdminBot Event after Command End}} | {{AdminBot Event after Command End}} | ||
+ | |||
+ | == Example == | ||
+ | |||
+ | <syntaxhighlight lang="lsl"> | ||
+ | integer BOT_SETUP_SETBOT = 280101; | ||
+ | integer BOT_STATUS_QUERY = 280106; | ||
+ | |||
+ | integer READY = FALSE; | ||
+ | |||
+ | string name = "SmartBots Resident"; | ||
+ | string accesscode = "f7dheb7fba9"; | ||
+ | |||
+ | default | ||
+ | { | ||
+ | state_entry() | ||
+ | { | ||
+ | llMessageLinked(LINK_SET,BOT_SETUP_SETBOT,name,accesscode); | ||
+ | } | ||
+ | |||
+ | touch_start(integer total_number) | ||
+ | { | ||
+ | if (READY) { | ||
+ | llMessageLinked(LINK_SET,BOT_STATUS_QUERY,"",""); | ||
+ | } else { | ||
+ | llOwnerSay("The bot is not ready. If you received a Setup Failed message then please check your access code is correct, otherwise please try again in a moment."); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | link_message(integer sender, integer cmd, string data, key idk) { | ||
+ | string id = (string)idk; | ||
+ | if(cmd == BOT_SETUP_SUCCESS) { | ||
+ | READY = TRUE; | ||
+ | llOwnerSay("Setup Success: data=" + data + "\nkey= " + id); | ||
+ | } else if(cmd == BOT_SETUP_FAILED ) { | ||
+ | READY = FALSE; | ||
+ | llOwnerSay("Setup Failed: data=" + data + "\nkey= " + id); | ||
+ | } else if(cmd == BOT_EVENT_STATUS_REPLY ) { | ||
+ | llOwnerSay("Status: data = " + data + "\nkey= " + id); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </syntaxhighlight> | ||
{{AdminBot for Bots Commands - standard footer}} | {{AdminBot for Bots Commands - standard footer}} |
Latest revision as of 23:12, 11 March 2019
Queries the selected bot status (useful to determine the subscription length). Result is being returned using BOT_EVENT_STATUS_REPLY event
llMessageLinked(LINK_SET,BOT_STATUS_QUERY,"","");
Variables
The following table shows input values (you send them with the API call) and returned output values.
Variable | Required | Description
| |
---|---|---|---|
str | yes | --- | |
id | yes | --- |
Return value
The result of this command will be returned to your script using BOT_EVENT_STATUS_REPLY event:
link_message( integer sender, integer num, string str, key id )
| |||
sender | link number of a sender prim | ||
num | BOT_EVENT_STATUS_REPLY | ||
str | String representing the bot's status:
Online statuses:
Example: OK 2019-03-10 00:00 LOGGED OUT | ||
id | Bot UUID |
Example
integer BOT_SETUP_SETBOT = 280101;
integer BOT_STATUS_QUERY = 280106;
integer READY = FALSE;
string name = "SmartBots Resident";
string accesscode = "f7dheb7fba9";
default
{
state_entry()
{
llMessageLinked(LINK_SET,BOT_SETUP_SETBOT,name,accesscode);
}
touch_start(integer total_number)
{
if (READY) {
llMessageLinked(LINK_SET,BOT_STATUS_QUERY,"","");
} else {
llOwnerSay("The bot is not ready. If you received a Setup Failed message then please check your access code is correct, otherwise please try again in a moment.");
}
}
link_message(integer sender, integer cmd, string data, key idk) {
string id = (string)idk;
if(cmd == BOT_SETUP_SUCCESS) {
READY = TRUE;
llOwnerSay("Setup Success: data=" + data + "\nkey= " + id);
} else if(cmd == BOT_SETUP_FAILED ) {
READY = FALSE;
llOwnerSay("Setup Failed: data=" + data + "\nkey= " + id);
} else if(cmd == BOT_EVENT_STATUS_REPLY ) {
llOwnerSay("Status: data = " + data + "\nkey= " + id);
}
}
}