Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Automatic doors i need help

BamBam Dinova
Registered User
Join date: 6 Aug 2004
Posts: 2
12-15-2004 20:42
ok last time i posted that i needed help with an automatic door,i have the script but i dont know how to use it. if any one can help me out.this script is driving me insane



integer OpenO = FALSE;

OPENW()
{
if(Open == FALSE)
{

llSetPos(llGetPos() + <0,1,0>;);
llSetPrimitiveParams([PRIM_SIZE, <0.01, 0.01, 6.09>]);
Open = TRUE;

}
}

CLOSEW()
{
if(Open == TRUE)
{

llSetPos(llGetPos() - <0,1,0>;);
llSetPrimitiveParams([PRIM_SIZE, <0.340, 1.719, 6.339>]);
Open = FALSE;

}
}
default
{
state_entry()
{
llSensorRepeat("",NULL_KEY,AGENT,4,PI,1);
}

sensor(integer num_detected)
{
OPENW();
}
no_sensor()
{
CLOSEW();
}

}




:cool:
_____________________
What a Day :cool:
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
12-15-2004 23:14
just use this code:
CODE

integer doorState = FALSE;
integer DIRECTION = -1; // direction door opens in. Either 1 (outwards) or -1 (inwards);

integer bitChange ( integer bit )
{
if ( bit == TRUE )
{
return FALSE;
}
else
{
return TRUE;
}
}

integer door(integer open) {
if (open) {
llSetRot(llEuler2Rot(<0, 0, -DIRECTION * PI_BY_TWO>) * llGetRot());
return TRUE;
} else { // close
llSetRot(llEuler2Rot(<0, 0, DIRECTION * PI_BY_TWO>) * llGetRot());
return FALSE;
}


then what ever you want to trigger the door just call, doorState = door ( bitChange ( doorState ) );