NeonSteamPunk Posted June 13, 2017 Share Posted June 13, 2017 There used to be a script in the library that let you click a HUD prim and it would drop a dialog of the avatar names around you using a scanner.I can not seem to find it would anyone know where this might be or could help me make one? Link to comment Share on other sites More sharing options...
Ivanova Shostakovich Posted June 13, 2017 Share Posted June 13, 2017 Here is a script that uses a listen from the owner to start a scan for avatars. You could easily dispense with the use of llListen() and owner checks with a simple touch event. Put it in a simple small hud object of your own design, attach it to a hud point, and away you go. I'm not sure about the range thing. The function in that script may try to scan out to 256, but I don't know if that's possible. At any rate, you can adjust the range down to suit your own needs. Link to comment Share on other sites More sharing options...
mikka Luik Posted June 13, 2017 Share Posted June 13, 2017 Might find something useful here : http://wiki.secondlife.com/w/index.php?title=Special%3ASearch&search=avatar+radar&go=Go Link to comment Share on other sites More sharing options...
Innula Zenovka Posted June 13, 2017 Share Posted June 13, 2017 I try not to post whole scripts but since I made something very similar the other day, and since it was based on two examples that used to be in the old script library, but which I couldn't find (so I had to look out something I'd made earlier and base it on that), here's an example of one way to do what the OP wants. Note that it constructs a dialog menu that gives you a list of names and index numbers and has numbered buttons to press. This is a far more convenient way, to my mind, of displaying names on menus than putting them on the buttons themselves, since the buttons will truncate them after 12 characters or so. The uDlgBtnLst userfunction is by Void Singer (who, sadly, no longer comes here, but who has contributed so much to SL through her generosity and patience in sharing her scripting knowledge) and our very own Rolig Loon produced an example (which I can't now find) showing how to use the numbered menu buttons in a dialog menu. Any mistakes are, of course, all my own work. integer iDialogChannel; integer iHandle; key kOwner; list uDlgBtnLst( integer vIntPag ) { integer vIdxBeg = 10 * (~-vIntPag); //-- 10 * (vIntPag - 1), enclose "~-X" in parens to avoid LSL bug integer vIdxMax = -~(~([] != gLstMnu) / 10); //-- (llGetListLength( gLstMnu ) - 1) / 10 + 1 list vLstRtn = llListInsertList( llList2List( gLstMnu, vIdxBeg, vIdxBeg + 9 ), //-- grab 10 dialog buttons (list)(" <<---(" + (string)(vIntPag + (-(vIntPag > 1) | vIdxMax - vIntPag)) + ")"), //-- back button -1 ) + //-- inserts back button at index 9, pushing the last menu item to index 10 (list)(" (" + (string)(-~((vIntPag < vIdxMax) * vIntPag)) + ")--->>"); //-- add fwd button at index 11 return //-- fix the order to L2R/T2B llList2List( vLstRtn, -3, -1 ) + llList2List( vLstRtn, -6, -4 ) + llList2List( vLstRtn, -9, -7 ) + llList2List( vLstRtn, -12, -10 ); } list lAvatars; list lAvatarNames; list gLstMnu; list gDlabels; default { state_entry() { kOwner = llGetOwner(); } attach(key id) { if(id){ kOwner = llGetOwner(); } } changed(integer change){ if(change & CHANGED_OWNER){ kOwner = llGetOwner(); } } touch_start(integer num_detected) { llListenRemove(iHandle);//remove any old listeners hanging around lAvatars = [];//clear the old lists lAvatarNames =[]; gDlabels = []; gLstMnu =[]; //first, build a list of avatars and their names list l = llGetAgentList(AGENT_LIST_PARCEL, []);//get a list of all agents on the parcel integer max = llGetListLength(l); integer counter = 0 ; do{ //loop through the list of avatars key k = llList2Key(l,counter); lAvatars +=[llGetUsername(k)]+[k];//and add the avatar's name and key to lAvatars } while(++counter < max); lAvatars = llListSort(lAvatars, 2, TRUE);//sort the list alphabetically by first name lAvatarNames = llList2ListStrided(lAvatars,0,-1,2);//split off the names into a separate list lAvatars = llList2ListStrided(llDeleteSubList(lAvatars,0,0), 0,-1,2);//and now remove the names from lAvatars, leaving us with list of uuids arranged in the same order as the names counter = 0 ; do{ gDlabels += [(string)(counter + 1)+": "+llList2String(lAvatarNames, counter)+"\n"];//list of numbers and corresponding names to go on the dialog label //numbers start at 1, since humans prefer that to starting at 0, as LSL prefers gLstMnu +=[(string)(counter + 1)]; //numbered list of buttons } while(++counter < max); lAvatarNames =[];//clear it, since no longer needed iDialogChannel = (1000 + (integer)(llFrand(9999999))) * -1; iHandle = llListen(iDialogChannel,"",kOwner,""); string temp = ""; integer i; //Display the first 10 names in dialog for (i=0;i<10;++i) { temp += llList2String(gDlabels,i); } llSetTimerEvent(30.0); llDialog(kOwner, "Who do you want to choose? \n"+temp, uDlgBtnLst(1), iDialogChannel); //present the toucher with the first 10 avatar names and corresponding buttons } listen(integer channel, string name, key id, string message) { llListenRemove(iHandle); llSetTimerEvent(0.0); if(!llSubStringIndex(message, " ")){//detect two leading spaces llSetTimerEvent(30.0); iHandle = llListen(iDialogChannel,"",kOwner,""); string temp = ""; integer menu = (integer)llGetSubString( message, -~llSubStringIndex( message, "(" ), -1 ); integer i; for (i=(10*(menu - 1));i<(10*menu);++i){ temp += llList2String(gDlabels,i); //build a menu for the next or the previous page } llDialog(kOwner, "Who do you want to choose? \n"+temp, uDlgBtnLst(menu), iDialogChannel); } else{ // chosen someone integer choice = (integer)message - 1; key k = llList2Key(lAvatars,choice);//look up the corresponding avatar uuid llOwnerSay("You chose "+llGetUsername(k)); } } timer(){ llListenRemove(iHandle); llSetTimerEvent(0.0); } } 2 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