ayamashi Posted September 26, 2019 Share Posted September 26, 2019 (edited) Any kind soul can help me with my issue. I am trying to make a script with llDialog which will pop up all the avatars in the region. I managed to create something but it shows only 1 avatar in the region and it is an UUID of said avatar. I made it in comparison to a script which does the same in llSay. touch_start(integer total_number) { key toucherID; toucherID = llDetectedKey(0); list ava = []; ava = llGetAgentList (AGENT_LIST_REGION, []); integer Avatars = llGetListLength(ava); list buttons; buttons += [llGetSubString(llList2String(ava,0),0,23)]; string dInfo = "Please"; integer dChannel; dChannel = 0; llDialog(toucherID, dInfo, buttons, dChannel); } } I found llKey2Name, llGetDisplayName but I havent really managed to actually make it work. Why does it only show 1 avatar even if there are more in the region? Follow up question: If I managed to get the avatar names to show up and I decided to use a listen event, how would I go about to make the listen know which avatar was selected prior? I know that if you have a pre made list of options you can just put the IF control and an event. Thank you . Edited September 26, 2019 by ayamashi Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted September 26, 2019 Share Posted September 26, 2019 (edited) 31 minutes ago, ayamashi said: Why does it only show 1 avatar even if there are more in the region? Because: list buttons; buttons += [llGetSubString(llList2String(ava,0),0,23)]; Here, you are using List2String to get the first avatar (at index 0). Then you use GetSubString to get the first 24 characters of their key (index range from 0 to 23). Instead, you would need a loop to do that for every avatar in the list. And besides that, if you want the menu to be readable (names instead of UUIDs), you should use Key2Name instead of GetSubString. That has its own complications as you'll then need to use one of the functions to convert the name back into a key, and store it in a global variable so that you can "remember" it in the listen event. Edited September 26, 2019 by Wulfie Reanimator 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted September 26, 2019 Share Posted September 26, 2019 (edited) 40 minutes ago, ayamashi said: Why does it only show 1 avatar even if there are more in the region? Because you only created one button, using the UUID of the first avatar on the list that was created by llGetAgentList. So, you need to do two things: 1. You need to create a list of names, which means looping through all of the entries in your list of UUIDs, something like this: integer i; while (i < llGetListLength(buttons) { string name = llGetDisplayName(llList2Key(buttons, i)); lDisplayNames += [name]; ++i; } That's assuming that you have created a global list variable named lDisplayNames. 2. Then you need to use the new lDisplayNames list as your list of button labels for a dialog menu, instead of using UUIDS the way you are now. As Wulfie points out, some of those names may be more than the 24 characters that are allowed on a dialog button, so you will need to truncate them before creating your dialog. Once you've done that, you can proceed to write the code for your dialog menu, including the listen event that will interpret the response when you choose a specific button. STudy the tutorial here on how to create a dialog >>>> http://wiki.secondlife.com/wiki/Dialog_Menus Edited September 26, 2019 by Rolig Loon typos, of course 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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