HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

What does "wait" exactly do?

09-13-2003, 04:14 PM#1
danny760311
Both the 2 types of "wait" action bugs >"<

Last time I use a "wait for 0.1 seconds", it become too slow.

0.1 seconds comes to 0.2 or even more seconds...

I had tested a feature:

Code:
Events:
    game time 0
Actions:
    loop
        wait for 0.00 seconds
        set Index = Index + 1
        Text to all players Integer(Index)
    endloop

and I created a game timer to watch

when game pasted 5 seconds, the print went to about 45(0.11).

when game pasted 10 seconds, the print went to about 80(0.125)

when game pasted 60 seconds, the print went to about 350(0.17)

when game pasted 120 seconds, the print went to about 585 (0.2)


Cound someone tell me what "Wait" exactly does?:(
09-13-2003, 04:23 PM#2
Dragon
It makes it wait before doing the action after it. Wait 30.00 would make it not do anything for 30 seconds then resume the actions.
09-13-2003, 04:53 PM#3
SpectreReturns
The reason it doesnt work in that situation is that when using a loop, they shoot one after another, but they dont wait till the last one is done to go.
09-14-2003, 12:19 AM#4
danny760311
Quote:
Originally posted by SpectreReturns
The reason it doesnt work in that situation is that when using a loop, they shoot one after another, but they dont wait till the last one is done to go.


I don't understand, could you give me an example?
09-14-2003, 12:23 AM#5
Draco
It means that the next loop is running before the last one finishes. If this keeps going, then your number will grow bigger and bigger each time.
09-14-2003, 01:23 PM#6
danny760311
It cannot be "loop"'s bug

I've tried this one:

Code:
Test
    Events
        Time - Elapsed game time is 0.00 seconds
    Conditions
    Actions
        Countdown Timer - Start Timer1 as a One-shot timer that will expire in 30.00 seconds
        Wait 0.00 seconds
        Game - Display to (All players) the text: (String((Elapsed time for Timer1)))
        Countdown Timer - Start Timer1 as a One-shot timer that will expire in 30.00 seconds
        Wait 0.00 seconds
        Game - Display to (All players) the text: (String((Elapsed time for Timer1)))
                        .
                        .
                        .

And it prints 1.00 1.25 1.00 1.00 0.75 1.75 2.25 2.75 .....................................different every time


And this one caused the same result:

Code:
Test
    Events
        Time - Elapsed game time is 0.00 seconds
    Conditions
    Actions
        For each (Integer A) from 1 to 999999, do (Actions)
            Loop - Actions
                Countdown Timer - Start Timer1 as a One-shot timer that will expire in 30.00 seconds
                Wait 0.00 seconds
                Game - Display to (All players) the text: (String((Elapsed time for Timer1)))


What' wrong with the "Wait" action???
And why it is inaccurate??
09-14-2003, 01:46 PM#7
vjeux
Wait is bugged, use an other trigger with Time Elapsed, it work perfectly :)

09-14-2003, 02:59 PM#8
Magos
It's not bugged, it works as it should.

A Wait statement doesn't wait EXACTLY X seconds, it waits AT LEAST X seconds. Since you can't have more than 1 triggers running simultaneously the first one must finish or reach a wait statement until the next on gets some time for execution.

Imagine a trigger with a Wait 2:00 in it. At 1:90 the engine checks if it is time for it to run. Nope, 100 ms is left, lets run another trigger. So it runs another trigger, which takes says 600 ms to run. The next time the first trigger is checked it has waited 2:50, thus a little time difference.