Don't click here unless you want to be banned.

LSL Wiki : llSetTexture

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
llSetTexture(string texture, integer side)

Sets the texture on side. texture can be the name of a texture in the prim's inventory, or the key of a texture. A side of ALL_SIDES sets all sides of the prim in one call.

The string texture can be replaced by the UUID key of the texture in quotes. This makes it very easy to have less inventory clutter within an object and allows you to just drop a script into a prim.

Specifiying an empty string or NULL_KEY for texture will not set the object to 100% alpha, or the "Blank" texture. The script will say the error message "Couldn't find texture" on the debug channel.

Note: This function delays the script for 0.2 seconds.

Remember, llSetTexture only applies to the current prim, not the entire linked object. If you need to set the texture of a different prim in your linkset, you'll either need to use a separate script in that prim and communicate between the two via link messages or use llSetLinkPrimitiveParams.

The current texture can be read by llGetTexture.

// applies the texture named "asphalt" (in the object's inventory, clicking the "Content" tab while editing the object) to all sides of the prim
llSetTexture("asphalt", ALL_SIDES); 
// sets the texture with the specified key on side 0
llSetTexture("f54a0c32-3cd1-d49a-5b4f-7b792bebc204", 0);

Q: How do I determine which side of an object this applies to?
A: See side.

Useful textures:
If you want a side (or ALL_SIDES) to be 100% alpha, it's probably best to use llSetAlpha. Remember, this will still render -- it's not like a NODRAW texture in a game editor.

Under RC 1.20.7, constants have been added for several of these useful textures, it remains to be confirmed that these changes are in fact functional as Linden Lab described them in the release notes:

Five texture constants to reference in llSetLinkTexture (and confirmed to work also in llSetTexture):

* TEXTURE_BLANK is the non-transparent blank texture, equivalent to UUID "5748decc-f629-461c-9a36-a35a221fe21f"
* TEXTURE_DEFAULT is the default plywood texture, equivalent to UUID "89556747-24cb-43ed-920b-47caed15465f"
* TEXTURE_PLYWOOD is the default plywood texture, equivalent to UUID "89556747-24cb-43ed-920b-47caed15465f"
* TEXTURE_TRANSPARENT is a fully transparent texture, equivalent to UUID "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"
* TEXTURE_MEDIA is the default Media texture, equivalent to UUID "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361" (this does not really exist as of 1.21.6)


* Note: Scripts using these constants will run smoothly in all Second Life viewers, however previous versions of the viewer (those predating RC 1.20.7) will NOT be able to edit and recompile scripts using the new constants. Older versions (1.19.1 and below) will report “(XX,YY) : ERROR : Name not defined within scope” when trying to compile such a script.

See ClientAssetKeys for many other textures.

To set the color or alpha of a prim, use llSetColor and llSetAlpha respectively. Also see llSetPrimitiveParams to set texture, color, alpha and other settings at once.

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Texture
There is no comment on this page. [Display comments/form]