| 08-06-2007, 08:33 AM | #1 |
Am I seeing this right? You cannot use a wait within a function, only within a trigger thread... If this is true, there goes my hopes of being lazy... ![]() JASS:function TestWait takes nothing returns nothing call DisplayTextToForce( GetPlayersAll(), "Test5" ) call TriggerSleepAction( 1.00 ) call DisplayTextToForce( GetPlayersAll(), "Test6" ) call PolledWait( 1.00 ) call DisplayTextToForce( GetPlayersAll(), "Test7" ) call TriggerSleepAction( 1.00 ) call DisplayTextToForce( GetPlayersAll(), "Test8" ) endfunction function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing call DisplayTextToForce( GetPlayersAll(), "Test1" ) call TriggerSleepAction( 1.00 ) call DisplayTextToForce( GetPlayersAll(), "Test2" ) call PolledWait( 1.00 ) call DisplayTextToForce( GetPlayersAll(), "Test3" ) call TriggerSleepAction( 1.00 ) call DisplayTextToForce( GetPlayersAll(), "Test4" ) call TimerStart(CreateTimer(), 1., false, function TestWait) endfunction //=========================================================================== function InitTrig_Untitled_Trigger_001 takes nothing returns nothing set gg_trg_Untitled_Trigger_001 = CreateTrigger( ) call TriggerRegisterTimerEventSingle( gg_trg_Untitled_Trigger_001, 1.00 ) call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions ) endfunction Starts as a trigger thread, waits work fine. Launch a function thread and the waits destroy the thread. It only displays: Test1 Test2 Test3 Test4 Test5 |
| 08-06-2007, 08:54 AM | #2 |
... Of course they work, all triggers are functions. And may i ask what is a trigger thread? As far as i know, they are called threads. Triggers are just a fake colourful interface if you like, everything that happens in there gets converted to functions and ran as functions, triggers dont really exist in the game. |
| 08-06-2007, 08:55 AM | #3 |
You're right, you can't do this, though for a different reason you thought I believe. No TriggerSleepAction can be used in functions run by timers. You could, however, let the timer function be a 'wrapper' function that uses ExecuteFunc() to run TestWait(). Then a new thread is started and you can use wait again. ... or you could just call the function, without using a non-periodic timer. |
| 08-06-2007, 09:39 AM | #4 |
Please excuse my noobnes but, whats the difference betwene JASS:call TriggerSleepAction( 2.00 ) JASS:call PolledWait( 2.00 ) |
| 08-06-2007, 09:52 AM | #5 |
TriggerSleepAction pauses the thread for x seconds when it hits it. It is inaccurate and can cause problems, such as killing threads. PolledWait does exactly the same, but waits in game time seconds, so if the game was paused all of a sudden, PolledWait would also pause, while TriggerSleepAction would continue to fire even if the game was paused. They are both innacurate, but can have handy times. |
| 08-06-2007, 09:55 AM | #6 |
kool ty |
| 08-06-2007, 04:43 PM | #7 | ||
Quote:
Ahh, thanks for the info! Quote:
|
