For some reason, script 2 finishes without the other condition being true, it passes anyway even if one is still false. Logically it should not be happening, right?
If I put separate the two conditions into one while loop of their own, it works as intended.
I feel like a noob but this is confusing and frustrating me why a simple condition combination is failing.
EDIT: I just tried it from a different approach which is probably better anyway but I still want to know why the first way fails. Here's what I did instead:
I don't know what's going on here. Can someone explain what is going on with this and why it doesn't care about both conditions?
int monstersDead = 0;
script 1 (void)
{
// theres a bunch of crap here, but eventually...
monstersDead = 1;
}
int switchUses = 0;
script 2 OPEN
{
While(switchUses < 2 && monstersDead == 0) Delay(10);
Delay(35);
// do some thing
}
For some reason, script 2 finishes without the other condition being true, it passes anyway even if one is still false. Logically it should not be happening, right?
If I put separate the two conditions into one while loop of their own, it works as intended.
I feel like a noob but this is confusing and frustrating me why a simple condition combination is failing.
EDIT: I just tried it from a different approach which is probably better anyway but I still want to know why the first way fails. Here's what I did instead:
script 2 OPEN
{
While(TRUE)
{
if(monstersDead == 1 && switchesUsed >= 2)
{
// stuff
terminate;
}
Delay(10);
}
}
Edited by NevanderShare this post
Link to post