Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sensor door with unknown avatar detection

Fixyou Kit
Registered User
Join date: 2 Jan 2007
Posts: 2
01-28-2007 03:48
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");
}

}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
01-28-2007 21:41
/54/96/163201/1.html
_____________________
i've got nothing. ;)