Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Code following IF gets executed regardless

Losenger Blair
SL Bum
Join date: 24 Feb 2004
Posts: 7
01-02-2006 19:39
Nevermind
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
01-02-2006 19:44
adding PHP tags.. Just makes it a little bit easier for people who know more than me about scripting :p :D

CODE

default
{


touch_start(integer total_number)


{
llGroundRepel(2,FALSE,.1);

llCollisionSound("", 0.0);

llSetStatus(STATUS_PHYSICS, TRUE);

llWhisper( 0, "we're on our way 1" );

vector destination = <134.273,144.32,26>;

llMoveToTarget( destination, 5 );

position = llGetPos();


if (position == <130.5,144.32,26>);

{
llSay(0, "I'm at " + (string)llGetPos());

llStopMoveToTarget();

llApplyRotationalImpulse(llGetMass()*<0,0,.1>,FALSE);

llSleep(2);

llApplyRotationalImpulse(-llGetMass()*llGetVel(),FALSE);

vector destination = <134.273,220,26>;

llMoveToTarget( destination, 5);
}

if (position == <134.273,176.925,26>);

{
llStopMoveToTarget();

llSleep(20);

vector destination = <134.273,220,26>;

llMoveToTarget(destination, 5);
}

if (position == <134.273,216,26>);

llStopMoveToTarget();


}



}
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.
---------------
Zapoteth Designs, Temotu (100,50)
---------------
Almarea Lumiere
Registered User
Join date: 6 May 2004
Posts: 258
01-02-2006 19:44
From: Losenger Blair
the following code, the commands are executed regardless of the IF conditions.
I got burned by this once.

Take the semicolons off of the end of the "if" statements (it is the null statement terminated by the semicolon which is conditionally executed -- if you remove them, the following compound statment will be the one governed by the "if";).
Losenger Blair
SL Bum
Join date: 24 Feb 2004
Posts: 7
01-02-2006 20:10
I'm stupid... thank you!