Difference between revisions of "Usage/Status Codes"
From SmartBots Developers Docs
m |
|||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE: Status Codes}} | {{DISPLAYTITLE: Status Codes}} | ||
− | "Command status | + | "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 | + | 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 | + | | 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 53: | Line 53: | ||
|- class="row-a" | |- class="row-a" | ||
| BOT_SETUP_FAILED | | BOT_SETUP_FAILED | ||
− | | | + | | BOT_WRONGCODE |
| You have specified the wrong [http://www.mysmartbots.com/docs/Bot_access_code Access Code] while setting the bot using BOT_SETUP_SETBOT. | | You have specified the wrong [http://www.mysmartbots.com/docs/Bot_access_code Access Code] while setting the bot using BOT_SETUP_SETBOT. | ||
|- class="row-b" | |- class="row-b" | ||
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 | + | 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"> | ||
link_message(integer sender,integer cmd, string data, key id) { | link_message(integer sender,integer cmd, string data, key id) { | ||
− | /////////////////// | + | /////////////////// Bot setup failed event |
if(cmd==BOT_SETUP_FAILED) { | if(cmd==BOT_SETUP_FAILED) { | ||
// We split the string parameter to the lines | // We split the string parameter to the lines | ||
Line 88: | Line 88: | ||
// Inform user | // Inform user | ||
− | llOwnerSay(" | + | 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. |
ExampleThe 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);
}
}
|