Really really small waits

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:

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.
 

PrisonLove

Hard Realist
Reaction score
78
Indeed.
And your costume's lame. :thup:
T32 is better than [LJASS]GetHandleId[/LJASS]/[LJASS]hashtable[/LJASS] attachment for small periods.

Does that require vJASS or another third party program? I have a mac and am forced to do everything in the Vanilla editor so I know not of these fancy add ons. But I guess it's always good to know how to do things things without the extra shiz.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top