attachments
Returns a list of the bot’s attachments, including HUD objects.
// See "LSL Helper Functions" page for this function
smartbotsAPI("attachments", []);Variables
The following table shows input values (you send them with the API call) and returned output values.
Input basic parameters
Variable | Required | Description |
|---|---|---|
action | yes | = attachments |
apikey | yes | Your personal developer's API key |
botname | yes | Your bot's SL login |
secret | yes | Bot API token 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
Variable | Required | Description |
|---|---|---|
skipnames | optional | Skip attachments whose names contain this substring (case-insensitive) |
matchnames | optional | Return only attachments whose names contain this substring (case-insensitive) |
matchuuid | optional | Return only attachment with this UUID |
Output
(To be received in http_response LSL event, see docs for details)
Variable | Description |
|---|---|
result | OK - command completed successfully |
resulttext | Detailed reason for the failure |
custom | The value from input "custom" parameter. See above |
total | The total number of attachments (not affected by filters) |
attachments | List of attachments (possibly filtered), with UUIDs and object names separated by newline ( |
Example Output Format
UUID1 name of the object 1
UUID2 name of the object 2
...Comments
The bot takes about 10–20 seconds after login to fully load all nearby prims and attachments.
Wait a short time before running this command after login.This command returns HUDs and worn attachments.
Working with many attachments
The LSL **llHTTPRequest()** function limits reply size to 2048 bytes (1024 Unicode characters).
If your bot has many attachments, use filters to reduce output size:
skipnames— ignore attachments whose name contains a substringmatchnames— list only attachments whose name contains a specific substringmatchuuid— return a specific attachment by UUID
Return Value
total— total number of attachments (not affected by filters)attachments— newline-separated list of UUIDs and attachment names
Examples
Example 1 — Get all attachments
https://www.mysmartbots.com/api/bot.html?action=attachments&botname=BarKeeeper%20ResidentResponse:
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-JeansCapriCuffRightExample 2 — Filter by name (“shoes”)
https://www.mysmartbots.com/api/bot.html?action=attachments&botname=BarKeeeper%20Resident&matchnames=shoesResponse:
bcc100b6-acdf-0a63-c713-db557c5e8c64 Mesh Shoes - Slip-ons: Left
764e0715-4bcb-d1f3-b3fa-21868f7e9635 Mesh Shoes - Slip-ons: Right