i had to put spaces between the < and > symbols otherwise i could not post the script
float openingTime=2.0; // in seconds
float openingAngle=45.0; // in degrees
float autocloseTime=5.0; // in seconds
float omega=0.0;
vector axis;
rotation closedRot;
rotation openRot;
integer swinging;
integer open;
openDoor(integer yes)
{
vector useAxis=axis;
open=yes;
if(!yes)
useAxis=-axis;
llSetTimerEvent(openingTime);
llTargetOmega(useAxis,omega,1.0);
}
default
{
state_entry() {
swinging=FALSE;
open=FALSE;
omega=TWO_PI/360*openingAngle/openingTime;
llTargetOmega(ZERO_VECTOR,1.0,1.0);
llListen(1,"", NULL_KEY, ""
;}
listen(integer channel, string name, key id, string message) {
if (message == "wing"
{if(!open)
{
axis=llRot2Fwd(llGetLocalRot());
closedRot=llGetLocalRot();
openRot=llEuler2Rot( < openingAngle,0.0,0.0 > *DEG_TO_RAD)*closedRot;
}
swinging=TRUE;
openDoor(!open);
}
}
timer()
{
if(swinging)
{
swinging=FALSE;
llTargetOmega(axis,0.0,0.0);
if(open)
{
llSetLocalRot(openRot);
llSetTimerEvent(autocloseTime);
}
else
{
llSetLocalRot(closedRot);
llSetTimerEvent(0.0);
}
}
else
{
llSetTimerEvent(0.0);
openDoor(!open);
swinging=TRUE;
}
}
}