Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

change state when Owner _leaves_ sensor range

Little Gray
Registered User
Join date: 16 Oct 2006
Posts: 48
03-21-2007 03:12
I want to create a script that changes state when an owner (or authorized user) leaves an area.

I can easily script a change state if the owner (or authorized user) comes within sensor range. But, if i simply mod the script so that if the detected AV is not the owner, then, it would change state whenever it detected any av who wasn't the owner, as opposed to detecting when the owner (or authorized user leaves). I guess I can make the sensor make a list of whos on the property and check if the owner is in that list, and, take action if the owner is not in the list of sensed AVs. I'm not exactly sure how to check a list for the presence of a specific AV, but, but it sure seems possible.

I know could use the llOverMyLand function to take action if the object owner (or other authorized user) is not over my land (or the object owner's land), but, I want/need to use a sensor in this application for greater versatility.

I'm wondering if theres a simpler way to take action if a specific AV is not in sensor range, without creating a list. Surely, there must be an example of a script performing this function somewhere. If you have an example, or know where to find one, it would be appreciated.
Simil Miles
Creator
Join date: 1 Mar 2007
Posts: 300
03-21-2007 04:23
The no_sensor event handler is what you need.
CODE

default
{
state_entry()
{
llSensorRepeat("", llGetOwner(), AGENT, 10.0, PI, 10.0);
}

sensor(integer num_detected)
{
llOwnerSay("owner detected");
}

no_sensor()
{
llOwnerSay("owner not detected");
}
}
_____________________
UnConWTech @ Flo (144, 84, 224) http://unconwtech.free.fr

SL books http://astore.amazon.com/secondlife-sl-20/

Need a beta tester for quality assurance ?
Need a translator for English, French, Spanish ?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-21-2007 04:38
Just be careful about false negatives.
With the state of SL at the moment I'm finding sensor repeats are failing to detect 40% of the time.
Little Gray
Registered User
Join date: 16 Oct 2006
Posts: 48
03-21-2007 16:33
doh .. comming from an idiot i don't suppose this means much, but, thanks!