| 04-16-2008, 08:24 PM | #1 |
JASS:call PauseTimer(SpawnTimer) call PauseTimer(BossTimer) call PolledWait(25.) call ResumeTimer(SpawnTimer) call ResumeTimer(BossTimer) Here's the function that starts those timers: JASS:call TimerStart(SpawnTimer, 8. + (PlayerNum * 2), true, function Master_Spawn_Func) //call TimerStart(BossTimer, 38. + (PlayerNum * 2), true, function Boss_Spawn_Func) I think it has something to do with PolledWait, but I'm not sure. The calls for Pause/ResumeTimer are in the function each timer calls when they expire. I'm pausing these timers because it's a wave game, and all the spawns run off of one timer. So at the end of each wave, the timers pause, players get 25 seconds to heal, then the timers resume and the next wave starts (well, that's what it's supposed to do. The timers don't resume, so nothing happens =/) Could BossTimer not being a started timer mean anything? It's a created timer, but not started. Would pausing it cause a thread crash or anything like that? |
| 04-16-2008, 08:34 PM | #2 |
Make sure your thread isn't crashing because of the PolledWait(). If this is done in a timer callback, it will crash and the ResumeTimer() won't even get called. |
| 04-16-2008, 08:39 PM | #3 |
Oh, it will? Then that's the problem. (PolledWait() in a timer callback) Do you have any idea how I could fix it? Could a timer with a .01 callback that links to another function which pauses those timers, then starts ANOTHER timer which would resume them. It's tacky, but that's what I could think of. Is there a better way to go about it? |
| 04-16-2008, 08:43 PM | #4 |
You could just do: JASS:function ResumeSpawnTimer takes nothing returns nothing call TimerStart(SpawnTimer, 8. + (PlayerNum * 2), true, function Master_Spawn_Func) endfunction //... call TimerStart(SpawnTimer, 25.0, false, function ResumeSpawnTimer) |
| 04-16-2008, 09:06 PM | #5 |
See above, Vex's method is what I use for timers starting timers. You could also call TimerStart() on GetExpiredTimer() and it works perfectly fine. |
| 04-16-2008, 09:41 PM | #6 |
Okay, let me see... So, I start SpawnTimer as a 25 second timer. After it goes off, it starts SpawnTimer as a periodic 8+# timer. Once it's run its course the number of times I want it to (12), I stop the timer and then... call the function that initiates SpawnTimer as a 25 second timer? |
| 04-16-2008, 09:44 PM | #7 | |
Quote:
|
| 04-16-2008, 09:45 PM | #8 |
Never have waits in a timer callback, it will either create tremendous lag or crash the thread Just use if-then-else statements with a counter if you wanna manage different instances in a timer or do what Vex did |
| 04-16-2008, 10:04 PM | #9 |
I'm doing what Vex and Dusk recommended. It looks easy and helpful. And a bit of what you suggested to. I have a counter that keeps track of the number of times the timer has fired, and once it fires X times I'll stop it and resume it. ExecuteFunc takes a string, right? So it would be ExecuteFunc("Timer_Whatever"), right? Thanks for the help. Waits in my timers is probably why a lot of my previous attempts with timers failed so miserably. |
| 04-16-2008, 10:05 PM | #10 | |
Quote:
|
