Difference between revisions of "HTTP API/Bot Commands/texture upload"

From SmartBots Developers Docs
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE: texture_upload}} <onlyinclude>Uploads and creates a new texture in inventory</onlyinclude> <syntaxhighlight lang="lsl"> // See "LSL Helper Functions" page for...")
 
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
 
<syntaxhighlight lang="lsl">
 
<syntaxhighlight lang="lsl">
 
// See "LSL Helper Functions" page for this function
 
// See "LSL Helper Functions" page for this function
smartbotsAPI("parcel_buy", [
+
smartbotsAPI("texture_upload", [
   "x", 30,
+
   "name", "My texture",
   "y", 60
+
   "data", "............",
 +
  "folder", "e96293b1-1529-40d2-b1d9-21190c2916df"
 
]);
 
]);
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 12: Line 13:
 
{{API Variables Table}}
 
{{API Variables Table}}
  
{{API HTTP Required Vars|parcel_info_update}}
+
{{API HTTP Required Vars|texture_upload}}
  
 
{{API Variable Group|Input}}
 
{{API Variable Group|Input}}

Latest revision as of 14:01, 8 January 2022

Uploads and creates a new texture in inventory

// See "LSL Helper Functions" page for this function
smartbotsAPI("texture_upload", [
  "name", "My texture",
  "data", "............",
  "folder", "e96293b1-1529-40d2-b1d9-21190c2916df"
]);

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 = texture_upload
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:
name yes the name of the new texture
data yes the texture data, Base64-encoded.

The image format is JPG, PNG or TIFF.

folder optional the folder UUID. If not specified, the texture will be created in "Textures" folder
loseless optional "1" - tell Second Life to use loseless compression for this texture
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.

Comments

The command creates a new inventory texture and returns its inventory item UUID and asset UUID. The difference is that "inventory UUID" is being used to manipulate the inventory, while "asset UUID" can be used to put the texture on a prim.

It is unlikely to call this command from LSL script because of the image data.

Return values

The command returns

result=OK
uuid=the new inventory item UUID
asset_uuid=the texture asset UUID

if texture has been successfully created.


<< return back to Bot commands

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