Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Eject from land with check for over land

BoBo Boxer
Registered User
Join date: 3 Sep 2005
Posts: 28
03-29-2006 21:42
Well I am working on a script that will eject certain people from a sim once they cross the boundry but I am having a problem with llOnMyLand I set a condition that first Senses peopel then checks their name against a list then it starts a countdown as long as the condition of llOnMyLAnd() is true and checks this condition every second for 10 seconds before unsitting and ejecting them. The only problem is that llOnMyLand is either being bypassed or is not working properly, anyone have any thoughts?

CODE

string gName = "ban_list"; // name of a notecard in the object's inventory
integer gLine = 0; // current line number
key gQueryID; // id used to identify dataserver queries
list ban_list; //list compiled from notecard
default {
state_entry() {
gQueryID = llGetNotecardLine(gName, gLine); // request first line
llSensorRepeat("","",AGENT,90,PI,1);
}

dataserver(key query_id, string data) {
if (query_id == gQueryID) {
if (data != EOF) { // not at the end of the notecard
ban_list = ban_list + [data]; //add name to ban list
++gLine; // increase line count
gQueryID = llGetNotecardLine(gName, gLine); // request next line
}
}
}

sensor(integer num_detected)//help from Cathrine Omega Im sooo excited I got to talk to her and everything, but llOnMyLand isnt behaving right not her fault though
{
integer i;
for (i = 0; i < num_detected; i++) //reads up to 16 potential violaters
{
string detected_name = llDetectedName(i); // sets name of sensed agent
if (llListFindList(ban_list,(list)detected_name) != -1) // checks list of people to eject
{
key detected_key = llDetectedKey(i); // sets key

integer j;
for (j=10; j >= 0; --j) // used for 10 second countdown required by LL to avoid being classed a greifer script
{
if (llOverMyLand(detected_key)) // This is the problem spot detects well outside of land boundreys
{
llShout(0,detected_name + ", You Have " + (string)j + " seconds to vacate before being ejected!");
if (j == 0)
{
llUnSit(detected_key); // prevents Agent from getting away with being seated
llEjectFromLand(detected_key); // Well it ejects!!!
}
llSleep(1.0);
}
else
{
j=-1; // supposed to stop count when far enough from sensor
}
}
}
}
}
changed (integer change)
{
if (change & CHANGED_INVENTORY)
{
llResetScript();
}
}

}
Joker Opus
Registered Usimibober
Join date: 9 May 2006
Posts: 363
06-19-2006 13:40
what exactly is the problem because everything seems to be valid....
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
06-19-2006 17:52
Hi BoBo

Maybe there is a conflict between you calling for sensor sweeps once every second, but then taking at least 10 seconds to cmplete that sensor event for each detected person.

Perhaps you could just record their presence at each sweep and then add 1 to a counter allocated to that av. You could also take reduce the count each time the sweep does not find that person. That would give the overland detection code a chance to run. You could confirm that this is the problem or not if the overland answer does not change while you are in that sleep loop and the av is moving.

In any case, I think most security systems are too far reaching. They should be using multiple sensors each set for 5 to 10 M to more accurately scan for trespassing av's.

Ed
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
06-19-2006 18:58
Or make the area large but check the detected avatar against the coordinates of the protected area.

What I did with my house is my security system does not throw you out until you are actually inside the house. Every cubic meter of the house interior is covered and with the exception of the cavity in the rear there is no place outside the house where you will get ejected. I could have programmed it to exclude the cavity but I decided in favor of simpler zones since there's no point in staying in the cavity area anyway.

The system uses only one sensor with a range enough to exactly reach the point farthest from the security system.
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
06-19-2006 19:21
Another way could be to simulate a rotating radar. Use a rotating prim with a narrow beam and adjust the length of the beam so as to do a binary search for the suspect if detected on that beam. That would give the angle and direct distance of the suspect from which you can work out the suspect's coordinates. From there it should be simple.

However, with that kind of activity, speed and lag might become problems.
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
06-19-2006 20:24
llDetectedPos(detectednumber) gives you the coordinates.
Harleen Gretzky
Registered User
Join date: 27 Oct 2005
Posts: 51
Sim boundary issue
07-06-2006 08:00
llOverMyLand() has a problem with sim boundaries, so you need to check to make sure the avatar's position is in the sim.

// Check for sim boundary bug:
// position should not be greater than 256 or less than 0 in either the x or y axis
// Make sure it is not the owner and make sure they are over the owner's land
vector AVpos = llDetectedPos(i);
if ( llDetectedKey(i) != llGetOwner() && llOverMyLand(llDetectedKey(i)) && (AVpos.x > 0 && AVpos.x < 257) && (AVpos.y > 0 && AVpos.y < 257) )
Travis Lambert
White dog, red collar
Join date: 3 Jun 2004
Posts: 2,819
07-06-2006 08:55
From: Harleen Gretzky
llOverMyLand() has a problem with sim boundaries, so you need to check to make sure the avatar's position is in the sim.

// Check for sim boundary bug:
// position should not be greater than 256 or less than 0 in either the x or y axis
// Make sure it is not the owner and make sure they are over the owner's land
vector AVpos = llDetectedPos(i);
if ( llDetectedKey(i) != llGetOwner() && llOverMyLand(llDetectedKey(i)) && (AVpos.x > 0 && AVpos.x < 257) && (AVpos.y > 0 && AVpos.y < 257) )


Another way to do this is to perform:

CODE
if(llOverMyLand(key agent) && llGetAgentInfo(key agent) != 0) 


While things like llName2Key are also unreliable across sim boundaries, llGetAgentInfo() appears to reliably return a 0 value when the agent being queried is not in the sim.

I ran up against this same issue for my own security system (being at the corner of 4 sims), and this is how I resolved it.
_____________________
------------------
The Shelter

The Shelter is a non-profit recreation center for new residents, and supporters of new residents. Our goal is to provide a positive & supportive social environment for those looking for one in our overwhelming world.