attachments

From SmartBots Developers Docs
Jump to: navigation, search

Returns a list of the bot's attachments (including HUD objects).

Variables

The following table shows input values (you send them with the API call) and returned output values.

Variable Required Description
Input basic parameters:
action yes = attachments
apikey yes Your personal developer's API key.
botname yes Your bot's SL login.
secret yes Bot access code of your bot.
dataType optional Set to "json" to get JSON reply instead of URL-encoded string
custom optional The custom data (string) to be passed back to caller script. This value will be returned back to the caller in HTTP response.
Input:
skipnames optional Skip attachment (do not return) if its name contains this substring (case insensitive)
matchnames optional Return only attachment those which name contain this substring (case insensitive)
matchuuid optional Return attachment with this UUID only
Output:
(to be received in http_response LSL event, see docs for details)
result OK - command completed successfully
FAIL - command failed
resulttext Detailed reason for the failure.
custom The value from input "custom" parameter. See above.
total The total number of attachments (regardless of any filters, see below).
attachments The list of all bot's attachments, object UUIDs and names.

May be affected by skip* and match* paratemers. See the "Return value" section below.

Comments

Please note that bot loads all nearby prims within 10-20 seconds after startup. Thus, wait a bit after logging in your bot to issue this command.

Working with lot of attachments

LSL llHttpRequest() function has a limitation on reply size (it is being cut to 2048 bytes, or 1024 Unicode characters). If your bot has a lot of attachments, they may not fit to the http reply.

There are several solutions for this problem. Use the following parameters:

  • skipnames - ignore attachments which contains some substring
  • matchnames - list only attachments which names contains specific substring
  • matchuuid - return specific attachment by UUID

Return value

total - variable contains the total number of bot's attachments. It is not affected by skip* or match* parameters.

attachments - the list of attachments (filtered by corresponding parameters) is being returned as a string which contains both object UUIDs and names separated by newline ("\n"):

UUID1 name of the object 1
UUID2 name of the object 2
...

Examples

Example request to the bot who wears shoes, jeans, hair and some accessories:

https://www.mysmartbots.com/api/bot.html?action=attachments&botname=BarKeeeper%20Resident

Response from the bot:

9a203028-452d-95b2-5b98-db6daa8c0a70 RASL - MHair D (Brown)
e70e0cbc-ebb5-38ba-bcf3-535af83f9884 Vintage_Glass_White GLASSES SET
bcc100b6-acdf-0a63-c713-db557c5e8c64 Mesh Shoes - Slip-ons: Left
764e0715-4bcb-d1f3-b3fa-21868f7e9635 Mesh Shoes - Slip-ons: Right
25e99b08-10b3-0a6b-bbdf-a42778d9033e Male Party Sunglasses
c402435d-d159-98a1-8149-caa3fcf9df01 -SG-TearOffShirtCuffRGreen
e245e78e-01d8-9b31-c74f-bf8c259ad296 -SG-TearOffShirtCuffLGreen
b2f0643d-df29-4479-fa8e-8ef4ee467c9a -SG-JeansCapriCuffLeft
4fae83f3-ba2f-146f-fc4d-3c2d03e86d43 -SG-JeansCapriCuffRight

The same bot, attachments filtered by name (only those which contain "shoe"):

https://www.mysmartbots.com/api/bot.html?action=attachments&botname=BarKeeeper%20Resident&matchnames=shoes

Response from the bot:

bcc100b6-acdf-0a63-c713-db557c5e8c64 Mesh Shoes - Slip-ons: Left
764e0715-4bcb-d1f3-b3fa-21868f7e9635 Mesh Shoes - Slip-ons: Right


<< return back to Bot commands

(Miss an API call or parameter? Submit your request in forum)