Your counter_15min thread only waits 15 seconds.
counter_15min:
iprintln "Timeout Started!"
wait 900 // = 15 minutes
level.timeout = 1
iprintln "Time is over!"
end
How can I make an AI wait for a variable?
Moderator: Moderators
test
You can do a tempory test to see if the two conditions are true. This thread will contiously print the values to the screen (every second).
temp_test:
while (1)
{
iprintln "timeout: " (level.timeout)
iprintln "busy chair2: " (level.busychair[chair2])
wait 1
}
end
I think you'll find that they are not 0 or 1.
-------------------------------------------
Btw, using the double bracket is the right way.
while ((level.timeout == 0) || (level.busychair[chair2] == 0))
In the conditions above, the variable values must already have been set to 0 or they will not be true. In other words, a variable does not have the value of 0 automattically, it has the value of NIL until the value is set to a number. Normally these values are set in prespawn, if it will be used a lot. But, you can set them anywhere they will be read before the while line starts checking.
level.timeout = 0
level.busychair[chair2] = 0
You can also set them like this.
if (level.timeout == NIL)
{
level.timeout = 0
}
But normally that is used to see if the value has been set by another script. So, if it were set to 1 already it would not change it. Anyway, as you can see, NIL can be used as "no value".
-------------------------------------------
For all those if statement, You might look into using "for". I'm not real good at using it though. But, I think "for" is also a contiously checking loop.
Hope that helps!!!
temp_test:
while (1)
{
iprintln "timeout: " (level.timeout)
iprintln "busy chair2: " (level.busychair[chair2])
wait 1
}
end
I think you'll find that they are not 0 or 1.
-------------------------------------------
Btw, using the double bracket is the right way.
while ((level.timeout == 0) || (level.busychair[chair2] == 0))
In the conditions above, the variable values must already have been set to 0 or they will not be true. In other words, a variable does not have the value of 0 automattically, it has the value of NIL until the value is set to a number. Normally these values are set in prespawn, if it will be used a lot. But, you can set them anywhere they will be read before the while line starts checking.
level.timeout = 0
level.busychair[chair2] = 0
You can also set them like this.
if (level.timeout == NIL)
{
level.timeout = 0
}
But normally that is used to see if the value has been set by another script. So, if it were set to 1 already it would not change it. Anyway, as you can see, NIL can be used as "no value".
-------------------------------------------
For all those if statement, You might look into using "for". I'm not real good at using it though. But, I think "for" is also a contiously checking loop.
Hope that helps!!!
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
Eureka!
Your temp test is pretty cool, thanks my General
!
And the double brackets are definitly right
!
I can see everythinhg is changing fine...Actualy I solved this d*** annoying problem...Here's the new waitthread:
FINALLY IT'S SOLVED!!!!
Thanks guys, without you m8s I'd never make it!
And I learned my lesson
!
And the double brackets are definitly right
I can see everythinhg is changing fine...Actualy I solved this d*** annoying problem...Here's the new waitthread:
Notice the "!" after the "while"waitcardsloop1:
thread counter_15sec
while !((level.timeout == 1) || (level.busychair[chair2] == 1))
{
self anim chair_waiting_idleloop_nocards
//self waittill animdone
wait 1
}
level.timeout = 0
level.busychair[chair1] = 0
iprintln "A place is available at the card table"
end
Thanks guys, without you m8s I'd never make it!
And I learned my lesson
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
Now it's 3 variables...
hmm, I was about to start a new post but...it's related!
I want the bot to wait for 3 variables this time. So, can I do this:
while !((level.talk[talk1] == 0) || (isalive self !=1) || (level.token1e2 == 1))
{
etc
}
end
If 1 of these 3 conditions are met, then end the thread. Is this working?
Thanks!
I want the bot to wait for 3 variables this time. So, can I do this:
while !((level.talk[talk1] == 0) || (isalive self !=1) || (level.token1e2 == 1))
{
etc
}
end
If 1 of these 3 conditions are met, then end the thread. Is this working?
Thanks!
I will not even try to say whether that would work or not, but what I can say is that it looks a little expedient.
Try this:

Try this:
Code: Select all
while (level.talk[talk1] == 0 && isalive self && level.token1e2 == 1)
-
Krane
- Lieutenant General
- Posts: 782
- Joined: Sat May 31, 2003 4:18 pm
- Location: California, USA
- Contact:
I have already tryed that jv and, for some reason, didn't work
! The only way is to deny first (while ! ). Without the "!", I had no success...
I did a very crazy test to simulate the 2 first conditions and, finally, test if the bots were reacting to the 3rd condition. And yeah, it works
!
How many "&&" and/or "||" can we have?
Who knows what waits for me later...
Thanks m8!
I did a very crazy test to simulate the 2 first conditions and, finally, test if the bots were reacting to the 3rd condition. And yeah, it works
How many "&&" and/or "||" can we have?
Who knows what waits for me later...
Thanks m8!
!
The "!" symbol means "is not". So, if you put it right after the while, it will run the loop while everything in the bracket is not true. But, when one of the things in the bracket becomes true, the looping will stop.


