Page 2 of 2
time
Posted: Sat Feb 21, 2004 11:09 pm
by tltrude
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
Posted: Sun Feb 22, 2004 2:04 am
by Krane
Yeah, I know...Just mispelled the s***...I want it to wait for 15 sec...
But The labels are equal in both threads

test
Posted: Sun Feb 22, 2004 4:00 am
by tltrude
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!!!
Eureka!
Posted: Mon Feb 23, 2004 4:27 am
by Krane
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:
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
Notice the "!" after the "while"

FINALLY IT'S SOLVED!!!!
Thanks guys, without you m8s I'd never make it!
And I learned my lesson

!
Now it's 3 variables...
Posted: Fri Feb 27, 2004 4:19 pm
by Krane
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!
Posted: Fri Feb 27, 2004 6:46 pm
by jv_map
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:
Code: Select all
while (level.talk[talk1] == 0 && isalive self && level.token1e2 == 1)

Posted: Fri Feb 27, 2004 7:34 pm
by Krane
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!
!
Posted: Sat Feb 28, 2004 6:37 am
by tltrude
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.
Posted: Sat Feb 28, 2004 3:49 pm
by Krane
Yes sir

! I realize that! The funny is that jv's method is, of course, far simple and suppose to work...Was one of my first trys...but, for some reason is not, maybe when I tryed that, I had a mistake somewhere...Well, It's working anyway!
