HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Wait untill conditions are met.

06-01-2006, 07:21 PM#1
iNfraNe
Im using the wait untill conditions are met:
Collapse JASS:
function Dmsg takes string s returns nothing
  if udg_Debug then
    call BJDebugMsg(s)
  endif
endfunction

function IsGroupEmpty takes group g returns boolean
  return FirstOfGroup(g) == null
endfunction

      loop
        exitwhen IsGroupEmpty(udg_ParticleGroup)
        call Dmsg("working?"+I2S(CountUnitsInGroup(udg_ParticleGroup)))
        call TriggerSleepAction(0.5)
        call Dmsg("2")
      endloop

This displays "working?1" as it should. But right there it stops. FOREVER. it NEVER displays "2".

This seems really odd to me. I've also tested with multiple debug messages in front so it cannot be the thread limit I think...

Are there situations where triggersleep fails?
06-01-2006, 07:27 PM#2
Rising_Dusk
Well, I know that TriggerSleepAction is delayed a HUGE amount.
Using it with a .5 second wait should delay it to almost double the time.
Have you tried it with commenting out the TriggerSleep?
06-01-2006, 07:57 PM#3
iNfraNe
Commenting out the triggersleep would cause a threadstop for sure since there's no wait the conditions change within 1 threadlength.

I dont care about that inaccuracy (at least, the one you're talking about) It seems to be delayed to infinity here.

Maybe it matters that I constantly have periodic triggers running in the background?
06-01-2006, 08:07 PM#4
Blade.dk
In what function is the code block with the loop? If it is a function used by TimerStart of ForGroup, then a TriggerSleepAction call will crash the thread. The solution to that would be using ExecuteFunc and another function to get a new thread.
06-01-2006, 08:12 PM#5
iNfraNe
Oh cool, waits crash the thread when it is ran by TimerStart? I didnt know that :) thx. Solved.