Game Development Community

While loop and bool crash - Bug?

by Andy Hawkins · in Torque Game Builder · 10/13/2006 (10:33 am) · 5 replies

I have this line which locks up Torque - I guess because it's stuck and can't get out of the loop. As a fail safe I put in a counter to make sure it could pop out.

while (%stillValid != false || %cnt > 5)

However if I change it to this it doesn't lock - but the conditions are the same, only the bool condition has been modified but it means the same as this...

while ((%stillValid == true) || (%cnt > 5))


Is this a bug?

#1
10/14/2006 (3:46 am)
Could you include the rest of the script, I will test it then to check and help however I can :)
#2
10/14/2006 (6:10 am)
I'll send you the code privately.
#3
10/14/2006 (2:49 pm)
Gut feeling is that within your loop, you are setting %stillValid = "false";, not %stillValid = false;

That would cause the %stillVald != false check to never fail.
#4
10/14/2006 (5:09 pm)
Well I got it to work using the second statement instead. Do you still want me to send you the code Matthew because I think it's my code and not the engine that is causing the problem.
#5
10/16/2006 (6:43 am)
Man, I'm so stupid. I don't even know how this worked. It should have been...

while (%stillValid == true && %cnt < 6) 
{
          // keep checking until failed or number of items exceeds total
          .... // do stuff with things....
}

bleh! Dumbass....