Difference between revisions of "Usage/Status Codes"

From SmartBots Developers Docs
Jump to: navigation, search
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE: Status Codes}}
 
{{DISPLAYTITLE: Status Codes}}
"Command status code" is additional information you receive with the [[AdminBot for Bots/Events|AdminBot event]].
+
"Command status codes" are additional information you receive with the [[TotalControl for LSL/Events|TotalControl event]].
  
 
== How to get the code ==
 
== How to get the code ==
Line 9: Line 9:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
The "Command status code" is located in the '''str''' variable (while '''num''' holds the AdminBot event ID).
+
The "Command status code" is located in the '''str''' variable (while '''num''' holds the TotalControl event ID).
  
 
== Status Codes ==
 
== Status Codes ==
Line 41: Line 41:
 
| BOT_COMMAND_FAILED<br>BOT_SETUP_FAILED<br>BOT_EVENT_STATUS_REPLY
 
| BOT_COMMAND_FAILED<br>BOT_SETUP_FAILED<br>BOT_EVENT_STATUS_REPLY
 
| BOT_NOTSET
 
| BOT_NOTSET
| You are trying to issue the command, but AdminBot does not know your Bot yet (use [[AdminBot for Bots/Commands|BOT_SETUP_SETBOT]] command)
+
| You are trying to issue the command, but TotalControl does not know your Bot yet (use [[TotalControl for LSL/Commands/|BOT_SETUP_SETBOT]] command)
  
 
|-
 
|-
Line 74: Line 74:
 
The following example shows how to parse bot setup error.
 
The following example shows how to parse bot setup error.
  
In this example we receive the BOT_SETUP_FAILED event: this means that AdminBot can't use the bot you've asked. We should try to understand what's wrong with the bot (usually the bot name error, or SmartBots subscription has expired).
+
In this example we receive the BOT_SETUP_FAILED event: this means that TotalControl can't use the bot you've asked. We should try to understand what's wrong with the bot (usually bot name error, or SmartBots subscription has expired).
  
 
<syntaxhighlight lang="lsl">
 
<syntaxhighlight lang="lsl">
Line 88: Line 88:
 
              
 
              
 
     // Inform user
 
     // Inform user
     llOwnerSay("AdminBot bot setup failed:\n"+
+
     llOwnerSay("TotalControl bot setup failed:\n"+
 
       "error code: "+code+"\n"+
 
       "error code: "+code+"\n"+
 
       "expired: "+expires);
 
       "expired: "+expires);

Latest revision as of 05:27, 19 May 2017

"Command status codes" are additional information you receive with the TotalControl event.

How to get the code

Events come to your script using link_message:

link_message( integer sender_num, integer num, string str, key id )

The "Command status code" is located in the str variable (while num holds the TotalControl event ID).

Status Codes

The possible status codes are listed below:

Possible events Status code Description

Success code

BOT_EVENT_STATUS_REPLY OK Command succeed, bot subscription valid.

Command fails

BOT_COMMAND_FAILED UNKNOWN_COMMAND The command you've sent is unknown. Try upgrading to the most newest version.
BOT_COMMAND_FAILED SERVICE_UNAVAILABLE This SmartBots service is not available for you. Refer to SmartBots Services page for details.
BOT_COMMAND_FAILED
BOT_SETUP_FAILED
BOT_EVENT_STATUS_REPLY
BOT_NOTSET You are trying to issue the command, but TotalControl does not know your Bot yet (use BOT_SETUP_SETBOT command)

Bot status fails

BOT_COMMAND_FAILED
BOT_SETUP_FAILED
BOT_EVENT_STATUS_REPLY
BOT_NOTEXIST The bot you are trying to use does not exist. You have to visit http://www.smartbots2life.com and list your personal bot
BOT_SETUP_FAILED BOT_WRONGCODE You have specified the wrong Access Code while setting the bot using BOT_SETUP_SETBOT.
BOT_COMMAND_FAILED
BOT_SETUP_FAILED
BOT_EVENT_STATUS_REPLY
BOT_NOTPAID You've listed your bot with SmartBots, but did not paid your subscription yet.
BOT_COMMAND_FAILED
BOT_SETUP_FAILED
BOT_EVENT_STATUS_REPLY
BOT_EXPIRED Your SmartBots subscription has expired. The expiration date attached.
BOT_COMMAND_FAILED
BOT_SETUP_FAILED
BOT_EVENT_STATUS_REPLY
BOT_NOTSETUP Editor will process and start your order shortly. Please wait a bit.

Example

The following example shows how to parse bot setup error.

In this example we receive the BOT_SETUP_FAILED event: this means that TotalControl can't use the bot you've asked. We should try to understand what's wrong with the bot (usually bot name error, or SmartBots subscription has expired).

link_message(integer sender,integer cmd, string data, key id) {
  /////////////////// Bot setup failed event
  if(cmd==BOT_SETUP_FAILED) {
    // We split the string parameter to the lines
    list parts=llParseString2List(data,["\n"],[]);

    // The first line is a status code, and second line is the bot expiration date
    string code=llList2String(parts,0);
    string expires=llList2String(parts,1);
            
    // Inform user
    llOwnerSay("TotalControl bot setup failed:\n"+
      "error code: "+code+"\n"+
      "expired: "+expires);
  }
}