PrisonLove
Hard Realist
- Reaction score
- 78
A) I don't understand why people don't use more descriptive variables around here. Descriptive variables help a LOT (not necessarily directed at the OP).
B) If you use a timer and a hashtable it can solve all of your issues. Basically a timer that repeats is a loop with an accurate wait. The hashtable is the way to store and load information for every interation of the loop (yes, they can be used for more, but in this case that suffices).
So, I propose something like this:
That is all freehanded so sorry if some of it is incorrect. Anyway, hope that helps.
EDIT: It would appear I'm a little late to the party.
B) If you use a timer and a hashtable it can solve all of your issues. Basically a timer that repeats is a loop with an accurate wait. The hashtable is the way to store and load information for every interation of the loop (yes, they can be used for more, but in this case that suffices).
So, I propose something like this:
JASS:
function TimerCallback takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local whatever yourThingy = LoadWhatever(udg_hash, id, 0)
...
...
if (CompareTimerIterationsHere) then // note: that is NOT a real function, duh for a third time
// your actions
else
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_hash, id)
endif
set = null
// remove other leaks
endfunction
function Actions takes nothing returns nothinf
local whatever yourThingy = whatYouWant // note: not a real variable type, duh
...
...
local timer t = CreateTimer()
local integer id = GetHandleId(t)
local real waitTime = 0.01
call SaveWhatever(udg_hash, id, 0, yourThingy) // need a global Hashtable variable, also that is not a real function, duh again
...
...
call TimerStart(t, waitTime, function TimerCallback)
set t = null
// remove other leaks
endfunction
That is all freehanded so sorry if some of it is incorrect. Anyway, hope that helps.
EDIT: It would appear I'm a little late to the party.