Jump to content

[HELP] get dialog list to corispond with uuids.


Boopadoopdoop
 Share

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

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

Recommended Posts

So what is trying do, is trying to get the names from a dialog menu to mach with uuid's in a list, and no i don't want to have the textures inside the inventory, I want to hard code them inside.

this is not the script is working on, is other script similar to figure this out, then can apply fix to actual script am working on.

Is script that used to get textures from inventory, but want to hard code inside.

[sorry English is bad]

 

list textures = [
"63305784-1523-1ddc-b301-8a1a3d6f7d09",
"a628d431-2b18-ef75-826f-719a37b3a2de",
"8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"
];

list names = [
"blue",
"pink",
"HIDE"
];

integer side = ALL_SIDES;
integer link = 2;
list texture_list;
list texture_list2;
key user = NULL_KEY;
integer chan = -54;
composelist()
{
    integer currenttexture = 0;
    integer totaltextures = llGetListLength(textures);
    
    if(totaltextures > 0 & totaltextures <= 12)
    {
        texture_list = [];
        do
        {
            texture_list = texture_list + llList2String(names, currenttexture);
            currenttexture++;
        }
        while (currenttexture > 0 & currenttexture < totaltextures);
    }
    
    if(totaltextures > 12 & totaltextures <= 22)
    {
        texture_list = ["Next Page"];
        do
        {
            texture_list = texture_list + llList2String(names, currenttexture);
            currenttexture++;
        }
        while (currenttexture > 0 & currenttexture < 11);
        
        texture_list2 = ["Last Page"];
        do
        {
            texture_list2 = texture_list2 + llList2String(names, currenttexture);
            currenttexture++;
        }
        while (currenttexture >= 11 & currenttexture < totaltextures);
    }
    
    if(totaltextures > 22)
    {
        llWhisper(0, "Sorry, I can hold 22 textures.");
    }
    if(totaltextures == 0)
    {
        llWhisper(0, "No textures, please add some.");
    }
}

integer menu_handler;
integer menu_channel;
menu(key user,string title,list texture_list)
{
    menu_channel = (integer)(llFrand(99999.0) * -1);
    menu_handler = llListen(menu_channel,"","","");
    llDialog(user,title,texture_list,menu_channel);
    llSetTimerEvent(30.0);
}

default
{
    state_entry()
    {
        llListen(chan, "", llGetOwner(), "");
        composelist();
    }

    touch_start(integer total_number)
    {
        if (llDetectedKey(0) == llGetOwner()) {
        user = llGetOwner();
        menu(user,"nnPlease select one below.",texture_list);
    }
}    
    listen(integer channel,string name,key id,string message)
    {
        if (channel == menu_channel)
        {
            llSetTimerEvent(0.0);
            llListenRemove(menu_handler);
            if(message == "Next Page")
            {
                menu(user,"Please select one below.",texture_list2);
            }
            else if(message == "Last Page")
            {
                menu(user,"Please select one below.",texture_list);
            }
            else
            {
              /*somehow get dialog menu selection to identify UUIDs in same order as order of names list HERE*/

                if (message == "HIDE")
                {
                llSetLinkAlpha(link,0,ALL_SIDES);    
                llSetLinkTexture(link,message, side); //still set transparent texture
            }else{
                llSetLinkAlpha(link,1,ALL_SIDES);    
                llSetLinkTexture(LINK_THIS,message, side);//set root prim texture first for preloading.
                llSleep(4);//give time to load before switching texture
                llSetLinkTexture(link,message, side);
            }
        }
    }
}
    timer()
    {
        llSetTimerEvent(0.0);
        llListenRemove(menu_handler);
    }
    
    changed(integer change)
    {
        if (change & CHANGED_INVENTORY)
        {
            composelist();
        }
    }
}

 

also want remove the limit on the menu.... but likely remake that part on own time....

Link to comment
Share on other sites

You can use llListFindList on the list with names, to get that name's index. Then, you can use that index to access the UUID in the other list, assuming both lists are in the same order.

list names = ["red", "blue", "green"];
list uuids = [ ... ];

default
{
    listen(integer channel, string name, key id, string message)
    {
        integer index = llListFindList(names, [message]);
        key uuid;
        if (index != -1)
        {
            uuid = llList2Key(uuids, index);
        }
    }
}

 

Edited by Wulfie Reanimator
Added an example.
  • Like 1
Link to comment
Share on other sites

is there way to return index number of the item selected in menu, then can use llSetTexture(llList2String(textures, RETURNED INDEX HERE FROM NAMES LIST),ALL_SIDES);

 

like if pick blue in menu, it's index in list is 0, then can just use that number to also match textures list.

Edited by Boopadoopdoop
Link to comment
Share on other sites

44 minutes ago, Wulfie Reanimator said:

You can use llListFindList on the list with names, to get that name's index. Then, you can use that index to access the UUID in the other list, assuming both lists are in the same order.


list names = ["red", "blue", "green"];
list uuids = [ ... ];

default
{
    listen(integer channel, string name, key id, string message)
    {
        integer index = llListFindList(names, [message]);
        key uuid;
        if (index != -1)
        {
            uuid = llList2Key(uuids, index);
        }
    }
}

 

figured it out, sorry bout that, haha, and thanx much!

Edited by Boopadoopdoop
  • Like 1
Link to comment
Share on other sites

10 minutes ago, Love Zhaoying said:

The “[...]” is for example only, you need to put a list of keys to replace the “.. “.

was not the issue, did not see they change "textures" list to "uuids", so when copied over it was confusing what happen, is use diff viewer and it not jump to where script is wrong like firestorm do lol

Edited by Boopadoopdoop
Link to comment
Share on other sites

1 minute ago, Boopadoopdoop said:

was not the issue, did not see they change boops "textures" list to "uuids", so when copied over it was confusing what happen, is use singularity and it not jump to where script is wrong like firestorm do lol

There are no syntax errors in my code besides the "[ ... ]"

I did not write code that you can just copypaste into your script. I showed you an example of how to use llListFindList to get an index from one list and use it in another. Now it's your turn to read the wiki page I linked, and teach yourself how to use that function.

  • Like 1
Link to comment
Share on other sites

29 minutes ago, Wulfie Reanimator said:

There are no syntax errors in my code besides the "[ ... ]"

I did not write code that you can just copypaste into your script. I showed you an example of how to use llListFindList to get an index from one list and use it in another. Now it's your turn to read the wiki page I linked, and teach yourself how to use that function.

is already working, you example help, and i did not fully copy paste, just copied that one line for lazy reasons. lol thanx alot for help, is very nice!

  • Like 2
Link to comment
Share on other sites

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