| 04-07-2008, 03:04 AM | #1 |
JASS:call StartTimerBJ( udg_StrafeChng[index], false, 0.1 ) loop exitwhen TimerGetRemaining(udg_StrafeChng[index]) <= 0.00 call BJDebugMsg(R2S(TimerGetRemaining(udg_StrafeChng[index]))) endloop Hey, I have been having trouble with this code. And I was wondering why this timer never finishes. I've tested this and the result displays 0.100 non-stop to me. Any reason? udg_StrafeChng is just an array of timers. This is the only place it is used... Thanks, for any assistance. I will on to check tomorrow, I'm off for now! |
| 04-07-2008, 03:13 AM | #2 |
Code runs instantly, there's no wait. So that code is looping in a single instant of time, ergo no time has actually passed on the timer. What you should do instead of that is to clock the time passed in the timer callback, that's the best way. |
| 04-07-2008, 07:08 PM | #3 | |
Quote:
Basically all I want is a wait, and apparently this is how gui did it. This is some gui converted code. I guess I'll just use a callback to run what I want. Thanks! |
| 04-07-2008, 07:30 PM | #4 |
If you're talking about PolledWait, you forgot about the TriggerSleepAction call they put into the loop. |
| 04-07-2008, 08:02 PM | #5 | |
Quote:
Ya, I took it out thinking it was useless. I thought to expect that, because all gui is dumb. |
| 04-07-2008, 08:25 PM | #6 |
This way is terribly inaccurate for short interval checks and such, you should really invest in checking out and using timers for these things. But yeah, if you really want to do it this way, you'll need the TriggerSleepAction(...) call. |
| 04-07-2008, 08:47 PM | #7 | |
Quote:
I'm going to use a callback function, and TimerStart(etc.). |
| 04-07-2008, 10:52 PM | #8 |
do... <=0.001 =) // yes they newer runs down to zero (how i have tested) only if you StartTimer with 0 period it will (or not xD) be zero. |
| 04-07-2008, 11:03 PM | #9 | |
Quote:
This we have established already, and all problems are fixed. |
