| 02-25-2010, 12:49 PM | #1 |
Hey guys. I want to reuse as much of variables that I can now, and I started using TimerUtils. However, I always get the error that there are no free timers, when I create the first timer. The start amount is 50. Ignore my system double free, the timer problem is still there. Thanks for helping. CM_UP_v.0.0.2.w3x |
| 02-25-2010, 01:20 PM | #2 |
disclaimer: I haven't opened your test map. Which flavour are you using?? if you use red, try blue (just for testing) Are you using properly ReleaseTimer()?? post code of your code... |
| 02-25-2010, 01:22 PM | #3 |
It doesn't work with any of the flavors. And its easier to check the map, since I only create one timer once and never again. I do not release timers, because there is only one timer I need. (yet). |
| 02-25-2010, 02:30 PM | #4 | ||
Quote:
Quote:
|
| 02-25-2010, 02:31 PM | #5 |
Yes, but sooner or later I want to learn how to use that stuff, and I want to give the possibility to create a timer per instance. So it wouldn't be useless. |
| 02-25-2010, 02:41 PM | #6 |
How to use TimerUtils: Replace CreateTimer() with NewTimer() Replace DestroyTimer() with ReleaseTimer() I personally would use Blue flavour for what you need it for. |
| 02-25-2010, 02:45 PM | #7 |
I don't even destroy timers and I only have one function that creates a timer, using NewTimer(). Please check the map. |
| 02-25-2010, 03:29 PM | #8 |
Struct initialization occurs before library Initialization. Move your NewTimer calls into a library intialization instead of the struct. |
| 02-25-2010, 04:55 PM | #9 |
What Ammorth said. Generally, however, for a static timer that you never destroy, you should just use CreateTimer() instead of NewTimer(), problem averted. |
| 02-25-2010, 06:17 PM | #10 |
Hmm yeah thanks, that was my mistake. And why isn't it initialized before? I mean it requires the other library, doesn't that mean its onInit parsed after the requirement? At least it should |
| 02-25-2010, 07:05 PM | #11 |
TimerUtil's NewTimer() method requires the TimerUtil's library be initialized before it can be used. If you use it from a struct's initializer, which is run before _any_ library initializers.... |
| 02-25-2010, 07:14 PM | #12 |
Oh I see. Damn so there is no other way around. |
| 02-25-2010, 10:51 PM | #13 |
JASS:library YourLib intitializer onInit requires TimerUtils, Blah blah blah struct yourStruct ... private function onInit takes nothing returns nothing set yourStruct.t = NewTimer() endfunction |
| 02-25-2010, 10:52 PM | #14 |
Yes I know, but I really like the static onInit method. So they are kinda useless? |
| 02-26-2010, 12:29 AM | #15 | |
Quote:
|
