BOT_STATUS_QUERY

From SmartBots Developers Docs
TotalControl for LSLCommands
Revision as of 23:09, 11 March 2019 by Scullyuk (Talk | contribs) (Correction)

Jump to: navigation, search

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:
  1. first line - bot status code (see all codes here)
  2. second line - bot expiration date
  3. 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
id Bot UUID

Example

integer BOT_SETUP_SETBOT = 280101;
integer BOT_STATUS_QUERY = 280106;

string name = "SmartBots Resident";
string accesscode = "f7dheb7fba9";

default
{
	state_entry()
	{
		llMessageLinked(LINK_SET,BOT_SETUP_SETBOT,name,accesscode);
	}

	touch_start(integer total_number)
	{
		llMessageLinked(LINK_SET,BOT_STATUS_QUERY,"","");
	}

	link_message(integer sender, integer cmd, string data, key idk) {
		string id = (string)idk;
		if(cmd == BOT_SETUP_SUCCESS) {
			llOwnerSay("Setup Success: data=" + data + "\nkey= " + id);
		} else if(cmd == BOT_SETUP_FAILED ) {
			llOwnerSay("Setup Failed: data=" + data + "\nkey= " + id);
		} else if(cmd == BOT_EVENT_STATUS_REPLY ) {
			llOwnerSay("Status: data = " + data + "\nkey= " + id);
		}
	}
}