| 07-14-2011, 12:32 AM | #1 |
Hello. I'm having a problem with a timer. call TimerStart(t,wait,false,function Callback) The code above works just fine. The problem is that the function "Callback" takes an argument, and I can't get that part working. call TimerStart(t,wait,false,function Callback(example-argument)) I tried like above, but that doesn't work. Can anyone lend a hand? |
| 07-14-2011, 03:02 AM | #2 |
Timer Callback functions cannot take any arguments. They must be like this function SomeTimerCallback takes nothing returns nothing
If you want to pass something to the callback, TimerUtils can work for that but it only allows you to pass an integer (e.g. a struct or an array index) but that should be all you need to pass if you're doing things right ;) |
| 07-14-2011, 04:46 AM | #3 |
I recommend that you read either of these tutorials: http://www.wc3c.net/showthread.php?t=89072 http://www.thehelper.net/forums/show...Timers-in-JASS The second one is more recent. You'll probably want to use a timer system (I suggest either TimerUtils or Timer32). They mostly involve using structs. Otherwise, you can always manually use hashtables to store data under the handle ID of the timer. |
| 07-14-2011, 04:11 PM | #4 |
Thanks for the help. I went for the Hashtable solution, it was the easiest one for me to understand. Oh and I already use TimerUtils. |
