Jump to content

Give Display Texture on Touch script


Speed Rexen
 Share

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

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

Recommended Posts

Ok, I cant figure out the script for this. What I am trying to accomplish is to give a texture that is displayed on a prim (full perm textures of course so no issue there) that are stored in the root prim and displayed on a series of display prims. on touch of the display prim I want to give the texture that is displayed but since that texture is not in that prims inventory I cant seem to get it to work. This is my first attempt at making multiple display tiles and I have everything working correctly except when it comes to giving the texture that is displayed. I can make this work no problem when the root prim is the display tile, but I cant seem to get this to work with the textures stored in the root prim and displayed on a linked display prim. Can anyone help or point me in the right direction. Thanks.

Link to comment
Share on other sites

It's a bit hard to advise you without seeing the script, but it sounds to me as if you're almost there.

I am assuming that I touch the prim that's displaying the texture I want, in order to be given a copy.

If that's the case,  then, the script in the root prim must know the uuid of the texture it's displaying on link number n, and it must know the name of that texture to have read its uuid.  So it should be simply a matter, in the touch_start (or touch end) event of checking llDetectedLinkNumber(0) (and possibly llDetectedTouchFace(0)?) and working back from that.

If you need more help, please post the script here, and I'll try to see exactly what needs doing.

Link to comment
Share on other sites

here is a basic example,

for this example: 4 prims, root(1), forward(2) back(3)  display(4)

 

this goes in the root prim

 

 

 integer primNum;
 integer Current ;
 integer max;
 key uuidSend;
 string txtrName;
default
{
    state_entry()
    {
        
         max = llGetInventoryNumber( INVENTORY_TEXTURE );
        --max;
        
        string nameMain = llGetInventoryName(INVENTORY_TEXTURE,0);
        key uuidMain =  llGetInventoryKey(nameMain);        
        llSay(-9,(string)uuidMain);        
       
    }

    touch_start(integer total_number)
    {       
       
       
        primNum = llDetectedLinkNumber(0);
        
        if (primNum == 4)
        {
             llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_TEXTURE, Current));
        }
        
         if (primNum == 3)
        {
            --Current;
             if (Current < 0) Current = max;
             
             txtrName = llGetInventoryName(INVENTORY_TEXTURE, Current);
             uuidSend =  llGetInventoryKey(txtrName);              
             llSay(-9,(string)uuidSend);
        }
        
         if (primNum == 2)
        {
            ++Current;
             if (Current > max) Current = 0;
             
              
             txtrName =  llGetInventoryName(INVENTORY_TEXTURE, Current);
             uuidSend =  llGetInventoryKey(txtrName);              
             llSay(-9,(string)uuidSend);
               
        }
    }
}

  in the display prim (link #4) you would put something like this

 

default{    state_entry()    {       llListen(-9, "", "", "");     }   listen( integer channel, string name, key id, string message )    {       string displaying = message;          llSetTexture(displaying, ALL_SIDES);    }}

 

Link to comment
Share on other sites

ooo, good call, if i'd known about those, thats what i would have used,

then you wouldn't need a script in the display prim :)

you could just change the

 llSay(-9,(string)uuidSend);

to


 llSetLinkTexture(4,(string)uuidSend, ALL_SIDES);

or something like that, and get rid of the second script?

 

 
Link to comment
Share on other sites

Yeah, that's it exactly, and ditch the second script.   You can do it all from the one script in the root prim.

I would use llSetLinkTexture for something like this, but it does have a couple of potential drawbacks.   One is that there's a 0.2 second delay, which doesn't sound much, but adds up pretty fast if you're changing a lot of different prims in a large linkset (for example, if you want to change all the chain prims in a necklace, while leaving the jewels unchanged).    The other -- which can often be an advantage, of course -- is that it doesn't touch the offsets, repeats or rotation of the textures.

In contrast, llSetLinkPrimitiveParamsFast doesn't have any delays, particlarly if you build a list with PRIM_LINK_TARGET and change all the target prims in one call, but you do have to specify the repeats, offset and rotation for each face you want to change, which can be a pain in the neck  if they are different on different faces of different prims.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4123 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...