Jump to content

Texture Change Script


Lexitus
 Share

You are about to reply to a thread that has been inactive for 2861 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have an object that I want to change the texture on touch

if I use  llSetTexture( textureName, ALL_SIDES); it works just fine.

When I changed the script to only change one face using  

llSetLinkPrimitiveParamsFast(3,[PRIM_TEXTURE, 2, textureName, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0]);

It gets the message "texture not transferable"

I am not sure why that is?  Any clues?

Link to comment
Share on other sites

llSetLinkPrimitiveParamsFast(3,[PRIM_TEXTURE, 2, textureName, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0]) won't just change the texture on face 2.  It specifically changes it on face 2 of link 3 in the linkset. If you don't have at least three links in the link set, the statement won't be able to execute.  There's no place to put the texture.

Link to comment
Share on other sites

Right, in addition to what Rolig said, if you're trying to set the texture to the link the script resides in, you could change the 3 to LINK_THIS. If you're not sure which link number the prim is, you can use this script below.

default{// Drop this script into the root prim of of a build// Touch any prim to learn its link number    touch_start(integer num_detected)    {        llOwnerSay("Link number clicked: " + (string)llDetectedLinkNumber(0) );           }}
Link to comment
Share on other sites

And to make sure face 2 is indeed the one you want to apply the texture to

// This is the essential script to drop in a prim when you need to ascertain the number of a face (or faces)// Touch the prim surfaces to learn their face numbers, which you can then use in other scripts for texturing, colouring etc. say(string message){    llSay(PUBLIC_CHANNEL, message);} default{    touch_start(integer num_detected)    {        integer face = llDetectedTouchFace(0);         if (face == TOUCH_INVALID_FACE)//      {            say("The touched face could not be determined");//if using a viewer that doesn't support detecting face touches//      }        else//      {            say("You touched face number " + (string) face);//      }    }}
Link to comment
Share on other sites

I suspect the problem is what the error message suggests it is -- that the texture is not full perms.

That's an issue because, if the texture is not full perms to the prim's owner -- you -- then you can set the prim's texture using the texture's name if, and only if, the texture is in the prim's inventory.    Otherwise you have to use the texture's uuid.   

However, you can't read the texture's uuid by script unless the texture is full perms to you.  

So, I suspect the reason changing the texture with  llSetTexture works and llSetLinkPrimitiveParamsFast doesn't is that the texture is inside the prim that contains the script.

I'm a bit surprised at the wording of the error message, but if the texture isn't full perms then that would explain why you're having problems.

If the texture is copyable (and if you're not planning on giving away or selling the object when you've scripted it) you could put a copy of the texture and a separate script inside the child prim you want to texture and, when you want to retexture the child prim,  trigger llSetTexture in that script by means of a link message.

 

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Yes, you can use the UUID.  The texture doesn't need to be in your inventory.  Also, see the note in the LSL wiki entry for llSetTexture:

If texture is a UUID then there are no new asset permissions consequences for the object.

  • The resulting object develops no new usage restrictions that might have occurred if the asset had been placed in the prims inventory.

So using a texture UUID instead of having the texture in the object's inventory won;t mess up the object's next owner perms.

When I write a script for a client that needs to change textures, I usually don't have the textures themselves at all.  The client just gives me UUIDs, and I hard code them into the script.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2861 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...