llSensor and llDialog
|
|
Lyndzay Meili
Registered User
Join date: 2 Sep 2007
Posts: 28
|
04-26-2008 13:32
Hi there all  I've cobbled together part of a script that puts the names all of the people found in a X radius in a dialog box which is great, the thing I need to figure out is how do I keep myself/ or the object owner out of the dialog box. Basically how do I keep from taking up a button  Here's the part that I have php integer channel; integer i; string victim; key target; default { state_entry() { // Create random channel channel= (integer)(llFrand(-1000000000.0)); } touch_start(integer num_detected) { if (llDetectedKey(0) == llGetOwner()) { llSensor("",NULL_KEY,AGENT,20,PI); } } sensor(integer num) { list targets; integer i; if(num > 12) num = 12; for(i=0;i<num;i++) { targets += [llGetSubString(llDetectedName(i), 0 ,23)]; } llDialog(llGetOwner(),"Batter Up",targets,channel); } } /php Thanks in advance for any help you can give. ~Lyndz
_____________________
"Be who you are and say what you feel, because those who matter don't mind, and those that mind, don't matter." —Dr. Seuss
|
|
Laurence Corleone
Registered User
Join date: 12 Oct 2006
Posts: 126
|
04-26-2008 13:46
Change this bit for(i=0;i<num;i++) { targets += [llGetSubString(llDetectedName(i), 0 ,23)]; } to this for(i=0;i<num;i++) { if( llDetectedKey( i ) != llGetOwner() ) { targets += [llGetSubString(llDetectedName(i), 0 ,23)]; } }
_____________________
There are no stupid questions, just stupid people.
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
04-26-2008 13:55
And to keep from asking the simulator the same thing multiple times declare it a global like so for llGetOwner: integer channel; integer i; key owner;
default { state_entry() { // Create random channel channel = (integer) (llFrand(-1000000000.0)); owner = llGetOwner();
}
touch_start(integer num_detected) { if (llDetectedKey(0) == owner) { llSensor("", NULL_KEY, AGENT, 20, PI); } }
sensor(integer num) { list targets; if (num > 12) num = 12; for (i = 0; i < num; i++) { if (llDetectedKey(i) != owner) targets +=[llGetSubString(llDetectedName(i), 0, 23)]; } llDialog(owner, "Batter Up", targets, channel); }
}
_____________________
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
|
|
Sarah Showboat
Registered User
Join date: 3 Nov 2006
Posts: 13
|
in addition
04-26-2008 14:01
If the owner is wearing the object, it will never sense the owner..... just FYI
|
|
Laurence Corleone
Registered User
Join date: 12 Oct 2006
Posts: 126
|
04-26-2008 14:07
From: Sarah Showboat If the owner is wearing the object, it will never sense the owner..... just FYI That was the whole point of the question From: Lyndzay Meili the thing I need to figure out is how do I keep myself/ or the object owner out of the dialog box. Basically how do I keep from taking up a button
_____________________
There are no stupid questions, just stupid people.
|
|
Lyndzay Meili
Registered User
Join date: 2 Sep 2007
Posts: 28
|
04-26-2008 15:53
Thanks for the help, I'll make th changes when I get in world.  From: Sarah Showboat If the owner is wearing the object, it will never sense the owner..... just FYI I hadn't decided yet if it was an attachment or what so I just wanted to prepare of whatever I wind up doing with it Thx, Lyndz
_____________________
"Be who you are and say what you feel, because those who matter don't mind, and those that mind, don't matter." —Dr. Seuss
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
04-26-2008 17:45
From: Lyndzay Meili Thanks for the help, I'll make th changes when I get in world.  I hadn't decided yet if it was an attachment or what so I just wanted to prepare of whatever I wind up doing with it Thx, Lyndz NP and you got to learn 3 things from 3 different people in the process. Keep on scripting and keep on learning!
_____________________
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
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-11-2008 08:28
just wondering, what is the reason for the random channel in the state entry? wouldn't it be better to generate that in the touch start?
|
|
Lyndzay Meili
Registered User
Join date: 2 Sep 2007
Posts: 28
|
09-11-2008 16:24
From: Ruthven Willenov just wondering, what is the reason for the random channel in the state entry? wouldn't it be better to generate that in the touch start? I'll have to admit that I don't know, it's just the way I saw it done once and have done it that way since, though if it is better to do it on touch I'm willing to change my ways 
_____________________
"Be who you are and say what you feel, because those who matter don't mind, and those that mind, don't matter." —Dr. Seuss
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
09-11-2008 17:05
From: Ruthven Willenov just wondering, what is the reason for the random channel in the state entry? wouldn't it be better to generate that in the touch start? Good question  If you put it in the touch_start event then the simulator is having to generate a new random number every time it is touched. The same reason behind suggesting making llGetOwner a global variable. Personally I always try to reduce the impact of a script as much as possible. To take it a step further; For scripts that are strictly for my own use I just enter a minus sign and hit a bunch of keys on the number pad to generate my own random number, it makes for just one more thing that the simulator doesn't have to do.
_____________________
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
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-11-2008 23:27
From: Lyndzay Meili I'll have to admit that I don't know, it's just the way I saw it done once and have done it that way since, though if it is better to do it on touch I'm willing to change my ways  i know it's just an example script cause it doesn't have anything to use the names for. but the reason i ask that is because, the state entry only runs once, until you reset/save the script again. so depending if you have it scripted correctly, multiple instances of the script in the same area would interfere with each other because they all have the same channel derived from the state entry.
|