|
Keno Pontoppidan
Registered User
Join date: 20 Oct 2005
Posts: 75
|
12-20-2006 12:32
How do I set it up so one of my dialog menus shows all the people within a certain area using a sensor?
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
12-20-2006 13:32
Just have the llDialog button do a link message to one of the freely available radar scripts. Change the radar from sensor repeat to sensor and instead of outputting llSetText, use llOwnerSay.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
12-20-2006 14:11
I think you missed the question Jesse. What I think Keno wants is to pouplate the buttons based on a sensor return.
As Jesse said use a sensor to pick up all the avatars within the specified sensor area. There is a finite time between starting a sensor and receiving the result. You can either have a repeating sensor constantly updating a list of the nearest AV's or can fire a single sensor on dialog selection. The problem with a single shot sensor is you may get false negatives if the sim is particularly laggy. I've experimented and found that single sensor sweeps can miss 80% of the time!
The list wont be huge as you can only get a maximum of 16 returns from a sensor no matter how densely populated the area. So list / memory management shouldn't be an issue. Jesse's idea of using a seperate sensor script and linked messages would be useable anyway. Can have the sensor on a constant semi slow repeat and then send the list of av's or their keys when requested.
The next hurdle is that although Dialog button text can be up to 24 characters, they only display a maximum of 10-14. Which menas most of your name is truncated. A better solution is to use the space above the buttons to list the AV names and an associated button Number rather than display the text directly on the buttons. Using this method you get 4 or 5 lines of text/buttons per page.
|
|
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
|
12-20-2006 14:46
Dialogs are limited to 12 buttons, so you'll only get 4 rows of 3 buttons per page.
|
|
bucky Barkley
Registered User
Join date: 15 May 2006
Posts: 200
|
12-20-2006 14:49
Put the names in the list element of the dialog, prefixed by a number:
1) gumby 2) pokey 3) fred 4) wilma
.. and associate a numbered button with each...
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
Yeah Newgy was bored
12-20-2006 15:30
The simple version // Configurable Settings float Range = 10; // 10 meters float Rate = 5; // in seconds
// Detected list variables list detected_list; list detected_names;
// Dialog Handler integer Listening; integer ListenChannel;
key owner = NULL_KEY; // Functions UpdateListen(key id) { CancelListen(); Listening = llListen(ListenChannel,"",id,""); llSetTimerEvent(30); }
CancelListen() { if(Listening > 0) llListenRemove(Listening); Listening = 0; llSetTimerEvent(0); }
// Owner Conversation Dialog StartConversation(key id) { string text = "Who's Near"; ListenChannel = (integer)llFrand(2147483646) + 1; list AVList; // Simple version - put AV names directly on Buttons integer len = llGetListLength(detected_list); if(len == 0) { text += "\n\nNO ONE HERE BUT US CHICKENS!"; } else { if(len > 12)len = 12; AVList = llList2List(detected_names,0,len); } llDialog(id,text,AVList,ListenChannel); UpdateListen(id); }
default { state_entry() { owner = llGetOwner(); llSensorRepeat("", "", AGENT, Range , PI, Rate); }
on_rez(integer num) { llResetScript(); }
changed(integer change) { // Test for a changed inventory if (change & CHANGED_OWNER) { llResetScript(); } }
no_sensor() { detected_list = []; detected_names = []; } sensor( integer number_detected ) { integer i; string name; detected_list = []; detected_names = []; for( i = 0; i < number_detected; i++ ) { key id = llDetectedKey( i ) ; if(id != owner ) { // Limit name to 24 Characters name = llGetSubString(llDetectedName( i ), 0 , 24);; detected_list += id; detected_names += name; } } }
timer() { CancelListen(); } touch_start(integer total_number) { // Owner key id = llDetectedKey(0); if( (id == owner)) { StartConversation(id); } } listen( integer channel, string name, key id, string message ) { integer index = llListFindList(detected_names, [ message ] ); if(index >= 0) { llOwnerSay("You selected " + llList2String(detected_names,index) + " : " + (string)llList2Key(detected_list, index)); } } }
|
|
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
|
12-20-2006 15:55
From: Newgate Ludd if(len > 12)len = 12; AVList = llList2List(detected_names,0,len);
That will make a 13-item list. Since the argument is an index, you need to subtract 1: if(len > 12)len = 12; AVList = llList2List(detected_names,0,len - 1); ought to do what you wanted.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
12-20-2006 16:32
Damm your right, shows what happens when you code while watching TV.
Boss is correct about the 12 item limit, its easy enough to code up a paged system. AS for Bucky's suggestion I did cover that in my original posting.
|