Change font size
It is currently Thu Nov 22, 2018 6:06 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 2   [ 17 posts ]
Go to page 1, 2  Next
Author Message
 Post subject: Simple security.
PostPosted: Mon Apr 20, 2009 10:15 pm 

Joined: Sat Mar 14, 2009 8:03 pm
Posts: 16
Here is a very simple script that will send anyone in sensor range that is not on access list to their home spot.
Set the custom settngs.
Fill in the access list with names of avatars you wish to allow in sensor area. You can add as many as you want.
Set the delay. which is how often the sensor scans.
Then finally set the sensor range. The range is in meters and 96 is the max range.

{L_CODE}:
//Simple security system
//Author:Trixie Paragorn

//Custom Settings.
list access_list = ["name1", "name2", "name3"];
float delay = 5;  //  How often the sensor scans in seconds.
float range = 20;  //  Sensor range in meters. Max is 96

default
{
    state_entry()
    {
        llSetObjectName("Security System");
        llSensorRepeat("","",AGENT,range,PI,delay);
    }
    sensor(integer number)
    {
        if(llListFindList(access_list, (list)llKey2Name(llDetectedKey(0))) == -1)
        {
            llInstantMessage(llDetectedKey(0),"\nUnathorized access.\nSending you home in 5 seconds.");
            llSleep(5.0);
            llTeleportAgentHome(llDetectedKey(0));
        }
    }
}


Top
 Profile  
 
 Post subject: Re: Simple security.
PostPosted: Tue Apr 21, 2009 9:04 am 
OSG Elite
User avatar

Joined: Fri Oct 17, 2008 11:30 am
Posts: 300
Location: Yorkshire, England
Thanks, Trixie.

What's the thinking on using something like this on OSGrid? Does it contravene the "open to all" philosophy of the grid?

I'm not being criticial - I could use something like this myself - just wanting to clarify that before I think of using it.

_________________
John
UK resident; OSGrid & Second Life: "Barrington John"; code monkey in RL
OSGrid region server: P4/3.6GHz/2GB, Ubuntu Karmic/Mono 2.6/MySQL 14.14v5.1.37, home ADSL (~8.5Mbps/0.85Mbps), 8-14 regions, 2 users


Top
 Profile  
 
 Post subject: Re: Simple security.
PostPosted: Tue Apr 21, 2009 9:06 am 
Site Admin
User avatar

Joined: Sat Feb 02, 2008 5:27 pm
Posts: 843
Well as far as i'm concerned, the grid is an open place, but if you don't want avatars visiting your region its well within your right to send them home. Sort of like how the united states is a free country, but you cant just walk into any house and plop down on someones bed for a nap.. as long as your not being disruptive to your neighbors we'll never bother anyone for having a security system in place.

Neb


Top
 Profile  
 
 Post subject: Re: Simple security.
PostPosted: Tue Apr 21, 2009 9:20 am 
OSG Elite
User avatar

Joined: Fri Oct 17, 2008 11:30 am
Posts: 300
Location: Yorkshire, England
Thanks, nebadon. That clears it up.

I'll add a note that the SensorMaxRange setting in the XEngine section of OpenSim.ini can be tweaked to change the maximum range of a sensor. I believe it's been tested up to 1000m, but how that impacts on sim performance - especially when scanning every few seconds - I've no idea. Also, note that, unlike the SL version, llSensorRepeat() in OpenSim does not detect objects or agents in adjacent regions. Apparently this is by design, rather than being a bug.

_________________
John
UK resident; OSGrid & Second Life: "Barrington John"; code monkey in RL
OSGrid region server: P4/3.6GHz/2GB, Ubuntu Karmic/Mono 2.6/MySQL 14.14v5.1.37, home ADSL (~8.5Mbps/0.85Mbps), 8-14 regions, 2 users


Top
 Profile  
 
 Post subject: Re: Simple security.
PostPosted: Tue Apr 21, 2009 9:59 am 
OSG Elite
User avatar

Joined: Fri Oct 17, 2008 11:30 am
Posts: 300
Location: Yorkshire, England
Also, note that Trixie's script will only detect one avatar at a time, so if the first person it senses is a legitimate visitor, nobody else in sensor range will be detected.

For this to work on all detected avatars, replace the code in the sensor() event with something like this:

{L_CODE}:
    sensor(integer Total)
    {
        integer I ;
        for (I = 0 ; I < Total ; I++)
        {
            key ID = llDetectedKey(I) ;
            string Name = llKey2Name(ID) ;
            if(llListFindList(access_list, (list)Name) == -1)
            {
                llInstantMessage(ID,"\nUnathorized access.\nSending you home in 5 seconds.");
                llSleep(5.0);
                llTeleportAgentHome(ID);
            }
        }
    }

_________________
John
UK resident; OSGrid & Second Life: "Barrington John"; code monkey in RL
OSGrid region server: P4/3.6GHz/2GB, Ubuntu Karmic/Mono 2.6/MySQL 14.14v5.1.37, home ADSL (~8.5Mbps/0.85Mbps), 8-14 regions, 2 users


Top
 Profile  
 
 Post subject: Re: Simple security.
PostPosted: Tue Apr 21, 2009 12:20 pm 

Joined: Sat Mar 14, 2009 8:03 pm
Posts: 16
oh yeah your right. good update for the code. And for uses. you dont have to set range to cover your whole sim. prehaps just a section or 2. =)


Top
 Profile  
 
 Post subject: Re: Simple security.
PostPosted: Wed Apr 22, 2009 3:59 am 
Furious Typer

Joined: Fri Dec 12, 2008 9:47 am
Posts: 258
Hi

I even went a step further and instead of using the sensor, i use a Prim with collision. This has the advantage that the range is upto 256m and you can use a texture on the outside for a bannline. Collision i think also needs less recources than the repeated sensor?

{L_CODE}:
// This script is a Freebie, do not sell for Money unless changed.

// Script provided by http://www.x-avatar.de (Michelle Argus)


// How does it Work?

// Rez a prim containing this script
// Set Prim to Phantom
// Set the size of the prim (Prim is the area secured by the script)

list accepted = []; // Add the List of Avatarnames allowed to enter

default
{
    on_rez(integer oz)
    {
        llResetScript();
    }
    state_entry()
    {
        llVolumeDetect(TRUE);
    }
    collision_start(integer num_detected)
    {
        integer i;
        for( i = 0; i < num_detected; i++ )
        {
            if( llListFindList(accepted, llDetectedName(i)) == -1 && llDetectedKey(i) != llGetOwner())
            {
                llInstantMessage(llDetectedKey(i), "Sry, you do not have Access");
                llTeleportAgentHome(llDetectedKey(i));
            }
        }
    }
}


what i noticed while testing is, that if an avatar teleports direktly into the sensor and gets teleported away, then the client tends to crash if the agent wasnt fully loaded on the simulator yet. (http://opensimulator.org/mantis/view.php?id=3243)

[EDIT] Changed mistakes in script

_________________
{L_IMAGE}{L_IMAGE}{L_IMAGE}


Last edited by Michelle Argus on Mon Apr 27, 2009 2:53 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Simple security.
PostPosted: Wed Apr 22, 2009 8:13 pm 

Joined: Sat Mar 14, 2009 8:03 pm
Posts: 16
Wow Argus, nice idea! I had not thought about doing it like that. It would make zone systems a breeze! And thanks for the info about the crashing.


Top
 Profile  
 
 Post subject: Re: Simple security.
PostPosted: Thu Apr 23, 2009 7:53 am 
Site Admin
User avatar

Joined: Wed Jul 16, 2008 7:22 pm
Posts: 186
Argus {L_WROTE}:
{L_CODE}:
        llVolumeDetect(TRUE);
        llSetPrimitiveParams([PRIM_PHANTOM, TRUE]);


The second line is unnecessary, as llVolumeDetect() already sets the prim to phantom. (It may also cause the volume detection to fail if the script is used in Second Life; according to the wiki: "The object can NOT be set to phantom by any other means, or else llVolumeDetect will not work. llVolumeDetect will set phantom automatically.".)


Top
 Profile  
 
 Post subject: Re: Simple security.
PostPosted: Sun Apr 26, 2009 10:25 pm 

Joined: Sat Mar 14, 2009 8:03 pm
Posts: 16
Quick update to Argus's code.

I had to change llTeleportAgentHome(llDetectedName(i));

to llTeleportAgentHome(llDetectedKey(i));
to make it work. It works great now!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 2   [ 17 posts ]
Go to page 1, 2  Next


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:  
cron


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