HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

To localize or not to localize? Timed effects are the question...

02-05-2007, 03:26 AM#1
CaptainPicard
Well, obviously, one way to have multi-instanceable spells is to do everything locally, thus making new threads which will resolve themselves, hopefully with no memory leaks.

However, it seems that timed effects in such spells would have to be coordinated using the TriggerSleepAction() function, which is notoriously imprecise. I suppose it wouldn't be a big deal if you had only one or two such waits in a series (executing multiple functions in parallel, each containing one or two waits, would also be just fine).

But, is there any way to make precisely timed effects in a single function thread?

Thanks!

Capt. Picard
02-05-2007, 04:03 AM#2
Ammorth
Using timers and CScache. Store everything required to the timers and then get the values again when the timer expires. Although there are problems with destroying timers, but I'll leave the reading up to you.
02-05-2007, 02:59 PM#3
wyrmlord
Quote:
Originally Posted by CaptainPicard
But, is there any way to make precisely timed effects in a single function thread?

I'm pretty sure he's wanting a sleep action he can do without creating a new thread. The closest you can get is using PolledWait, but if you're looking for accuracy, you'll have to use timers.
02-05-2007, 03:57 PM#4
Captain Griffen
Collapse JASS:
function DestroyEffectTimedEx takes nothing returns nothing
    call DestroyEffect(I2Effect(GetTimerInt(GetExpiredTimer())))
    call DestroyTimer(GetExpiredTimer())
endfunction

call TimerAttach(CreateTimer(), time, H2I(effect), function DestroyEffectTimedEx)
02-06-2007, 02:17 AM#5
Feroc1ty
PolledWait ( Real )
02-06-2007, 04:52 AM#6
Jazradel
PolledWait() uses TriggerSleepAction.