Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Newb brain fart

Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
07-06-2006 22:36
Hi all...

something way too simple... but code fails...

just trying to get something to become gradually transparent: on voice command

CODE

key owner;

default
{
state_entry()
{
owner=llGetOwner();
llListen(0,"",owner,"");
}

listen(integer a, string n, key id, string m)
{
float t;
if(m=="trans") {
t = 1.0; \\ stops here !!!!!!!!!!!!!!
while (t > 0);
{
llSetAlpha(t, ALL_SIDES);
t = t - 0.001;
}
}
}
}




the darned code stops at "t=1.0". No error... no nothing.

I'm stumped.

Any ideas?
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
07-06-2006 23:05
Remove the semicolon after ( t > 0)

It's not stopping at the t = 1.0 statement. It locks up at the while statement since the exit condition will never be met.

Because the while contains no decrement statment, (t > 0) is always true.
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
07-06-2006 23:15
Ahhhhh....

that did the trick. Dang. looking right at it :-)

Thanks so much


From: Aodhan McDunnough
Remove the semicolon after ( t > 0)

It's not stopping at the t = 1.0 statement. It locks up at the while statement since the exit condition will never be met.

Because the while contains no decrement statment, (t > 0) is always true.
Sapat Engawa
Registered User
Join date: 22 Jun 2006
Posts: 25
07-06-2006 23:23
From: Ryder Spearmann
but t is decremented by .001 in the while loop....

The while loop construct
while ( t > 0 )
controls the first following statement.

What's biting you is that e.g.
t=1.0;
is a statement, and so is the empty statement
;
which is what you have after yours. The brace-enclosed statement you think is the loop body isn't. Delete the empty loop body statement following the loop controller; that'll put the one you want in the right place.
_____________________
When the going gets tough, the tough specialize.