Jump to content

Texture Switch won't apply by UUID - Help Needed Please


Ry Elcano
 Share

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

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

Recommended Posts

Hi  :)

I was hoping someone could please offer a little assistance as to where I'm going wrong with this coding.

The script I'm working on is a texture changer for certain linked prims based on names, and runs via a dialog menu. I'm looking at expanding the number of textures available for choosing but I don't want to re-write the script to be a notecard reader to get the UUID's. (if possible!). So, I currently have the UUID's of the choices in the script as per below:

 

string Vic_101 = "xxxxxxxxx UUID Value Here xxxxxxxxxx";
string Vic_102 = "xxxxxxxxx UUID Value Here xxxxxxxxxx";
string Vic_103 = "xxxxxxxxx UUID Value Here xxxxxxxxxx";
string Vic_104 = "xxxxxxxxx UUID Value Here xxxxxxxxxx";

 The name "Vic_101" would be an option name on the dialog menu.

So when the person chooses the texture from the menu such as Vic_101, it applies that texture by it's UUID. As the list of textures is growing I don't want to have to hard code a menu option for every available texture choice. So after setting up all the other available choices for the menu, I have the below to handle the selection of texture from the menu (the other options relate to access permissions etc):

 

            else
            {
                SetLinkPrimitiveParamsFast(message);
                
            }

// This then calls the below, which sits above the default state:


SetLinkPrimitiveParamsFast(string texture)
{
    integer i;
    for (i = llGetNumberOfPrims(); i > 0; --i)
    {
        if (llGetLinkName(i) == child_name_wall)
        {
            llSetLinkPrimitiveParamsFast(i,[ PRIM_TEXTURE, ALL_SIDES, texture, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0 ]);
        }
    }
    llWhisper(0, "Applying texture: " + texture);
}

 

This is where the problem is happening.What I wanted was for the person to select, for example Vic_101, from the menu and then that message becomes the name of the texture to apply. As that name is specified as a string above, the script would then apply using UUID instead, but I can't get that to work.

It attempts to apply the texture by the name selected from the menu, such as "Vic_101" rather than the UUID against it in 'string Vic_101 = "xxxxxxx UUDI HERE xxxxxxx" .

I know I'm missing something here, but can't put my finger on it. Thinking maybe I have to add a 'key' but not entirely sure where, or that it is not properly looking at the string "Vic_101" and so is not applying by it's UUID.

Any help or direction on this would be greatly appreciated!

Thanks in advance.  :)

 

Link to comment
Share on other sites

A dialog communicates which button was clicked by "saying" the button name on the specified channel. 

I would put the button names and the texture keys in a list.  Like for instance:

list buttons = ["vic_101", "vic_102", etc];
list textures = ["uuid", "uuid", etc];

Then in the listen event use llListFindList(buttons, [message]) to find the index of the buttonname in the buttons list and set the texture with llList2Key(textures, index).

This way you can also use the buttons list in the llDialog().  

  • Like 1
Link to comment
Share on other sites

in your listen, change the button name to a key?

(this means the textures in the main inventory would have to be named Vic_101, etc)

 

 listen( integer channel, string name, key id, string message )
    {
     
 
key uuid = llGetInventoryKey(message);
}

//then change the SLPPF
 llSetLinkPrimitiveParamsFast(i,[ PRIM_TEXTURE, ALL_SIDES, uuid, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0 ]);
  • Like 1
Link to comment
Share on other sites

Thank you very much for the replies  :)

 

The script is now functioning properly and applying by the UUID.  One of the problems was that having textures in the inventory was not an option, so I was trying to work around that while the list of textures kept growing. Eventually I had to make the two lists and add in a query to find the matching UUID.

 

Thanks again for the advice, very much appreciated   :)

Link to comment
Share on other sites

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