Hey everyone, quick question regarding a script I've been using for the past few weeks...
I have this script, with an access list, used to slide a "hidden" wall segment open, allowing listed users access to a hidden area... The problem is, a lot of users FORGET to close the wall. I'm not very good at scripting, and I've only come this far with help. How can I add a timer event into the following script, without breaking it? ---
// Movement
vector OFFSET = <-2.0, 0.5, 0.0>;
float OPENTIME = 0.5;
float CLOSETIME = 0.5;
// Variables
vector vPosition;
rotation rRot;
float omega=0.0;
vector vTargetPos;
integer bOpen = FALSE;
integer bMoving = FALSE;
// Access List
list accesslist = ["name1", "name2"];
// Script
MoveDoor()
{
if(!bOpen)
{
bOpen = TRUE;
rRot = llGetRot();
vPosition = llGetPos();
omega=OPENTIME/llVecDist(<0,0,0>,OFFSET);
vTargetPos = vPosition+OFFSET*rRot;
llSetTimerEvent(OPENTIME);
}else
{
bOpen = FALSE;
omega=CLOSETIME/llVecDist(<0,0,0>,OFFSET);
vTargetPos = vPosition;
llSetTimerEvent(CLOSETIME);
}
bMoving = TRUE;
llSetStatus(STATUS_PHANTOM, TRUE);
llSetStatus(STATUS_PHYSICS, TRUE);
llMoveToTarget(vTargetPos,omega);
}
default
{
state_entry()
{
rRot = llGetRot();
vPosition = llGetPos();
}
touch_start(integer num_detected)
{
string name = llKey2Name(llDetectedKey(0));
if (~llListFindList(accesslist,[name]))
{
MoveDoor();
}
}
timer()
{
bMoving = FALSE;
llSetTimerEvent(0.0);
llSetStatus(STATUS_PHYSICS, FALSE);
llSetStatus(STATUS_PHANTOM, FALSE);
llSetPrimitiveParams([ PRIM_POSITION, vTargetPos, PRIM_ROTATION, rRot ]);
}
}
Any help would be appreciated, thank you in advance.