Change font size
It is currently Mon Nov 19, 2018 11:06 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: Sensor door with unknown avatar detection
PostPosted: Wed Sep 10, 2008 4:09 am 
Site Admin
User avatar

Joined: Sat Feb 02, 2008 5:27 pm
Posts: 843
{L_CODE}:
// Fixyou Kit's sensor door script with unknown avatar detection.
// Door can be opened by up to 10 avatars, set up by name in the list.
// The door scans for any avatars witin a distance of "scandist" and reports any avatar that is not on the access list
// If known avatars get within a distance of "distdoor" to the door, it will open
//plz IM me if you have questions! Have fun!

//set names of avatars you want to allow access:
string access1 = "Fixyou Kit";
string access2 = " ";
string access3 = " ";
string access4 = " ";
string access5 = " ";
string access6 = " ";
string access7 = " ";
string access8 = " ";
string access9 = " ";
string access10 = " ";
integer distodoor = 3; // set distance (meters) between avatar and door to open
integer scandist = 500; //set scanning distance
string Ava_detected;
integer ava_known = 0;

default
{
state_entry()
{
llSensorRepeat("","",AGENT,scandist,TWO_PI,10.0);
llWhisper(0,"Scanner is active");
}

sensor(integer total_number)
{
integer x;
for (x = 0; x < total_number; x++)
{
vector pos = llGetPos();
string Ava_detected = llDetectedName(x);
float diff = llVecDist(pos,llDetectedPos(x));
integer dist = llRound(diff);
if(Ava_detected==access1 || Ava_detected==access2 || Ava_detected==access3 || Ava_detected==access4 || Ava_detected==access5 || Ava_detected==access6 || Ava_detected==access7 || Ava_detected==access8 || Ava_detected==access9 || Ava_detected==access10)
{
ava_known = 1;
}
if(ava_known == 0)
{
string detected = Ava_detected + " @ " + ((string)dist) + "m";
llWhisper(0,detected);
}
if(dist < distodoor)
{
if(ava_known == 1)
{
llWhisper(0,((string)dist)+" " + ((string)distodoor));
llPlaySound("startrekdoor", 0.5);
llSay(0, "Door open for "+(llDetectedName(0)));
llSetPrimitiveParams([PRIM_PHANTOM, TRUE]);
llSleep (15);
llSetPrimitiveParams([PRIM_PHANTOM, FALSE]);
dist = 100;
}
else
{
llSetPrimitiveParams([PRIM_PHANTOM, FALSE]);
llSay(0, "Sorry "+(llDetectedName(0))+", can't let you enter, you are not on the access list");
}
}
}
}


no_sensor()
{
llWhisper(0,"No activity within " + ((string)scandist) + "m");
}

}


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


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