Change font size
It is currently Fri Aug 17, 2018 7:45 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: Security Orb
PostPosted: Thu Jul 02, 2009 1:09 pm 
Furious Typer
User avatar

Joined: Sun Aug 31, 2008 4:34 pm
Posts: 107
As a rule with these type of scripts, I state two caveats
1) they are perceived RUDE.
2) they can load a region, so watch scan distance and time interval.

Instructions:
How to set this up:
Place a notecard with the name whitelist in a prim.
Add all the names that should be allowed to come near it in the whitelist. (firstname / lastname)
The owner does not need to be in here but its never a bad practice to do so anyway
Drop the script in the same prim as the whitelist is in.
It will read the notecard and get into an inactive state.

The following commands can be used:
/9 activate = activate orb
/9 deactivate = deactivate orb
/9 reset = reset script and reread whitelist. Comes in handy if you have added or removed names.
{L_CODE}:
//free to use, modify, copy or transfer
//------------------------------------
key second = NULL_KEY; // fill in a second key if you want

string active = "deactive";
float range = 20.0; // Range we will be scanning for for persons to check if they are on the whitellist

key nrofnamesoncard; // Some variables used to collect all the data from the notecard
integer nrofnames;
list names;
list keynameoncard;
string nameoncard;
string storedname;
integer listener;

default // We use the default state to read the notecard.
{
    state_entry()
    {
          llOwnerSay("Startup state reading whitelist notecard");
          nrofnamesoncard = llGetNumberOfNotecardLines("whitelist"); // Triggers the notecard reading by getting the numer of lines in the notecard
    }
   
    on_rez (integer param)
    {
        llResetScript();   
    }
   
    dataserver (key queryid, string data){       
        if (queryid == nrofnamesoncard)
        {
            // When we receive the number of lines in the notecard we do llGetNotecardLine for each line to get the contents   
            nrofnames = (integer) data;     
            llOwnerSay("Found "+(string)nrofnames+ " names in whitelist.");
           
            integer i;
            for (i=0;i < nrofnames;i++){
               keynameoncard += llGetNotecardLine("whitelist", i);
            }   
        } else
        {
            integer listlength;
            listlength = llGetListLength(keynameoncard);
            integer j;
            for(j=0;j<listlength;j++) {
                if (queryid == (key) llList2String(keynameoncard,j))
                { // after checking if this really was an answer to one of our llGetNotecardLines calls (checking the keys we stored earlier)
                  // We add the name to our names list. Which we will use in a later state.
                    llOwnerSay("Name added to whitelist: "+data);
                    names += data;
                }
            }
        }
         
        if (llGetListLength(names) == nrofnames)
        {
            // If we have read all the names (just as many names as there where notecard lines). We switch to our next state "start"
            // This state will do the actual work
            llOwnerSay ("Done with reading notecard. Starting script now");
            state start;
        }               
    }           
}
state start
{
    state_entry ()
    {
        // This is where we enter our state. We start 2 listeneres. One for our owner and one for our second owner..
        llListen(9, "", llGetOwner(), "");   
        llListen(9, "", second, "");
        llSensorRepeat("", NULL_KEY, AGENT, range, PI, 5.0); // We also start scanning for people in it's vincinity. This scan scans for AGENS (avatars), in a range we determinded above (first few lines). And PI means a full circle around us. In theory you could just scan parts of it.
    }
   
    on_rez(integer param)
    {
        llResetScript();
    }
   
    listen(integer channel, string name, key id, string message)
    { // This is our listen event. Here we receive all commands to control the orbs behaviour.
        if (message == "activate") // Starts the orb
        {
            active = "active";
            llOwnerSay("Activated");
        }
        if (message == "deactivate") // Stops the orb
        {
            active = "deactive";
            llOwnerSay("Deactivated");
        }
        if (message == "reset") // Resets the script
        {
            llResetScript();
        }
        if (llGetSubString(message,0,4) == "range"){ // If the command was range. We extract the new range from the command. Stop the sensor and start it again with the new range.
            range = (float) llGetSubString(message,6,-1);
            llSensorRemove();
            llSensorRepeat("", NULL_KEY, AGENT, range, PI, 5.0);
            llOwnerSay("Changed range to: "+(string) range);
        }
    }   
    sensor(integer nr)
    { // Here is where all people found in its vincinity are returned.
       
        if (active == "active") // first we make sure the orb is active before we continue
        {
            integer i;
            for (i = 0; i < nr; i++) //Here we start to loop throug all persons we found. We do this one by one.
            {
                string found = "no";               
                string nametotest = llDetectedName(i);
                integer j;
                for (j = 0; j < llGetListLength(names); j++) // We scan through the list of names to see if this person is whitelisted
                {
                    if (llList2String(names, j) == nametotest){ 
                    found = "yes"; // When found we set found to true.
                    }
                } 
                if (found == "no" && llOverMyLand(llDetectedKey(i)) && (llDetectedKey(i) != llGetOwner())) // ifperson has not been found, check if this person is on our land. we will never kick the owner ;)
                {
                    llSay(0, "You will be ejected from this area in 10 seconds. You are in a private zone."); // Let's notify this user that he has a few seconds to leave
                    llSleep(10); // Wait the time we gave him to leave
                    if (llOverMyLand(llDetectedKey(i))) // Ok let's see if he has left.
                    { // If he is still on lets say BYE to him, and tell the owner and second owner someone is kicked off the land
                        llSay(0, "BYE!");
                        llInstantMessage(llGetOwner(), "Ejecting from our home: "+llDetectedName(i));
                        if (second != NULL_KEY)
                        {
                            llInstantMessage(second      , "Ejecting from our home: "+llDetectedName(i));
                        }
                        llEjectFromLand(llDetectedKey(i)); //And finaly we really kick him off
                    }
                }
            }
        }
    }
       
}


Top
 Profile  
 
 Post subject: Re: Security Orb
PostPosted: Thu Jul 02, 2009 10:03 pm 
User avatar

Joined: Thu Jun 18, 2009 8:08 am
Posts: 11
Location: South Australia
I made something like this recently, I was wondering, does llOverMyLand return true if you happen to own all the parcels surrounding the one that is meant to be secured by the script? So if an intruder leaves the parcel he was intruding on he would still get ejected because he was still on a parcel owned by me?

In my case one of the borders of my secure parcel is also belonging to me however I don't want to eject people from that so in my script I saved the parcel info from llGetParcelDetails at the location of the device and then compared it with the parcel info at the location of the intruder. If I've misinterpreted llOverMyLand it would be a much nicer solution.


Top
 Profile  
 
 Post subject: Re: Security Orb
PostPosted: Fri Jul 03, 2009 9:25 pm 
Furious Typer
User avatar

Joined: Sun Aug 31, 2008 4:34 pm
Posts: 107
Hi Xundra,

LSL wiki has this note, unsure if we use the same condition.

NOTE: The false positive condition may be worked around by performing:

if (llOverMyLand(key agent) && llGetAgentSize(key agent) != ZERO_VECTOR)

llGetAgentInfo() could be used instead of llGetAgentSize()

but there is the risk that it will return a false negative.


Top
 Profile  
 
 Post subject: Re: Security Orb
PostPosted: Sat Jul 04, 2009 2:13 pm 
User avatar

Joined: Thu Jun 18, 2009 8:08 am
Posts: 11
Location: South Australia
That's for when an avatar is on a neighboring sim, but I meant just a neighboring parcel on the same sim.


Top
 Profile  
 
 Post subject: Re: Security Orb
PostPosted: Sun Jul 05, 2009 3:31 pm 
Furious Typer

Joined: Mon Jan 12, 2009 10:47 am
Posts: 150
maybe instead of whitelist a blakclist of not allowed avatars, cuz banlist not working... :roll:

_________________
{L_IMAGE}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net