LSL Wiki Mirror : llSetTexture

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
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 need to use a separate script in that prim and communicate between the two via linkmessages.

The current texture can be read by llGetTexture.

Example:
// 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. However, the key for a 100% alpha (fully transparent) texture is "f54a0c32-3cd1-d49a-5b4f-7b792bebc204". Remember, this will still render -- it's not like a NODRAW texture in a game editor.

If you want to use the "Blank Texture" without having to upload your own blank image (100% white image with no alpha), use the key "5748decc-f629-461c-9a36-a35a221fe21f".

If you want to use the default plywood texture, use the key "89556747-24cb-43ed-920b-47caed15465f".

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.


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