| 02-05-2007, 03:26 AM | #1 |
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 |
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 | |
Quote:
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 |
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 |
PolledWait ( Real ) |
| 02-06-2007, 04:52 AM | #6 |
PolledWait() uses TriggerSleepAction. |
