Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

door auto closes dispite my best efforts

maihem Sinister
Registered User
Join date: 7 Oct 2008
Posts: 29
07-01-2009 13:13
i have tried editing this script so that it does not auto close but when i do the door rotates continuously with out stopping at all. can some one point out what needs to be changed?

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;
}
}
}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-01-2009 14:33


for future reference please just reply in the topic you previously created to bump it, it makes searching solutions for others much faster, and saves people reworking the same problems when they are already solved elsewhere.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -