Status Codes

From SmartBots Developers Docs
Jump to: navigation, search

"Command status code" is 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 TotalConytol 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 the 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);
  }
}