| 12-31-2006, 06:19 PM | #1 |
Ok, im making a spell! But for the first time im taking past experience into it. I remember Blu saying "Dont create multiple timers every like 0.04 seconds that will run every 0.04 seconds, when you can create one and run it all at the same time", he dident say that exactly, but he said use groups instead of mutliple timers. So, im also trying to aviod setting a timer to null, as of the timer set to null bug. So im using a set of functions like these: JASS:function SomeOtherUpdate takes timer t returns nothing endfunction function Update takes timer t returns nothing endfunction function BeginTimerStuff takes nothing returns nothing call SomeOtherUpdate(GetExpiredTimer()) call Update(GetExpiredTimer() // More update stuff endfunction function BeginSpell takes nothing returns nothing call TimerStart(CreateTimer(), ..., function BeginTimerSutff) endfunction This all works fine, but the question is, with the functions Update and SomeOtherUpdate, once it has run once, how will i get the timer back into that function when it is run again? Or is there a better method of doing this? |
| 12-31-2006, 09:09 PM | #2 |
I don't understand your question. GetExpiredTimer() will get you the timer. |
| 01-01-2007, 09:45 AM | #3 |
Sorry, i found a other solution to this problem, which work arounds this problem. (I read over my first post and realised there wasent enough infomation) My question was: "with the functions Update and SomeOtherUpdate, once it has run once, how will i get the timer back into that function when it is run again?" It should have been: "when functions Update and SomeOtherUpdate have ran once, they will wait for a timer to run them again, but how will i get a timer to run multiple functions after it expires." Which still dosent make sense, im not good at explaining things, sorry. |
| 01-01-2007, 10:09 AM | #4 |
Timers can only run one function each loop, though that function can then run other functions (remember you can't use waits in threads created by timers expiring). |
| 01-01-2007, 12:52 PM | #5 | |
Quote:
Yeah, i just decided to go with that idea, one function that runs more. My final idea is: JASS:function SomeOtherUpdate takes timer t returns nothing endfunction function Update takes timer t returns nothing endfunction function TimerStuffUpdate takes nothing returns nothing call SomeOtherUpdate(GetExpiredTimer()) call Update(GetExpiredTimer() call TimerStart(GetExpiredTimer(), ..., function TimerStuffUpdate) endfunction function BeginSpell takes nothing returns nothing ... call TimerStart(CreateTimer(), ..., function TimerStuffUpdate) ... endfunction |
| 01-01-2007, 01:22 PM | #6 |
Triggers can have multiple actions, if you replace the timer with a trigger with a periodic event, you can use TriggerAddAction multiple times |
| 01-01-2007, 01:31 PM | #7 | |
Quote:
|
| 01-01-2007, 01:40 PM | #8 | |
Quote:
Ohh.. Clever! Thanks for the smart idea Vex, i plan on using it! EDIT: Jacek, the thread will crash. |
