System Timer32

Kenny

Back for now.
Reaction score
202
>Also, the name "next" and "prev" could conflict with other stuff... <_< any ideas for that issue? Or is that unlikely.

That was my biggest concern as well... That is where operators come in handy, but I don't think giving them an absurd name is going to be all that good.

It is unlikely that they will ever be used, so maybe even a T32_next or T32_getNext() or something. :p That way, although they are there, they will not conflict with anything, and it isn't something that someone will just type. They will only be there for people who know about them and understand their usage.
 

Azlier

Old World Ghost
Reaction score
461
Just here to say that this is handy.

JASS:
method periodic takes nothing returns nothing
    set Size = Size - 0.05
    call SetUnitScale(Burrow, Size, 0, 0)
    if Size == 0 then
        set Size = 1
        call stopPeriodic()
    endif
endmethod
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
I fail to make a test where it proofs that thing is more efficient than using X timers instead.
Maybe internally timers are already handle like that ?

It starts to lag not because one or the other method, but just because of the tested code itself.

Maybe my pc is to much performant for a such test.
I understand that the API is neater here than just TimerUtils, though.

Could someone provide me an example where T32 is more efficient than using TimerUtils with X timers, plz ?
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
KT2 is better than TimerUtils in short period(see the benchies). T32 is more efficient than KT2.
 

Sickle

New Member
Reaction score
13
However, there are plenty of benchmarks in the KT2 thread. And since T32 is a hardcoded KT2 period, logically it is faster. But, alas, logic does not work with Blizzard.
 

Romek

Super Moderator
Reaction score
964
The speeds are the same, the core system is identical.
The only difference is the method of stopping the executions.
 

Jesus4Lyf

Good Idea™
Reaction score
397
That's not true, actually. Look carefully:
T32:
JASS:
function Periodic takes integer i returns boolean
    if condition then // if/then.
        return true
    endif
    return false
endfunction
private function PeriodicLoop takes nothing returns boolean
    local thistype this=thistype(0).next
    loop
        exitwhen this==0
        if this.periodic() then // another if/then.
            // This is some real magic.
            set this.prev.next=this.next
            set this.next.prev=this.prev
            // This will even work for the starting element.
            debug set this.prev=0
        endif
        set this=this.next
    endloop
    return false
endmethod

T32x:
JASS:
function Periodic takes integer i returns nothing
    if condition then
        call this.stopPeriodic()
    endif
endfunction
private function PeriodicLoop takes nothing returns boolean
    local thistype this=thistype(0).next
    loop
        exitwhen this==0
        call this.periodic() // no second if statement.
        set this=this.next
    endloop
    return false
endmethod

T32x should be faster. Faster again, if you used a .ticks value and switch to .endTick and use T32_Tick.

But I haven't benchmarked T32x yet.
 

Hatebreeder

So many apples
Reaction score
381
shouldn't this [ljass] call TimerStart(CreateTimer(),PERIOD,true,function OnExpire) [/ljass] leak?
 

Romek

Super Moderator
Reaction score
964
> That's not true, actually. Look carefully:
Yes, it's pretty much the same. :p
The stuff within the 'if' in the periodic loop has simply been moved to another function.
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
I got a problem with your system.

It seems that certain frequencies make the system go malfunctioning.
I have this one function for camera movement that runs every 0.02 seconds. Now if I set the value to 0.015 the function stops running after some time, I think especially when I used other spells that include KT.
I wondered what could possibly be the issue and added a debug msg each time the function runs. And yeah as I thought for the 0.015 frequency the function just doesn't run anymore after using other spells or whatever including KT.
And all I change is the goddamn frequency!
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
Ahh crap you're right, ment to be in they Key Timers 2 thread. Sorry :/
 

Nexor

...
Reaction score
74
I'm working on a map that uses currently about 10-12 spells, and the 70% of it uses T32.
There are some problems with it, sometimes the debugmessages are displayed but I don't see any reason why it should be displayed.

Here's an example:

JASS:
private struct slow
    unit hero
    integer ticks
    integer stacks
    
    method periodic takes nothing returns boolean
        local unit u
        set .ticks = .ticks - 1
        if .ticks == 0 or .stacks == 0 then
            set .ticks = T32_FPS
            set .stacks = .stacks + 1
            call UnitRemoveAbility(.hero,BuffID)
            set u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),&#039;dumy&#039;,GetUnitX(.hero),GetUnitY(.hero),0)
            call UnitAddAbility(u,SlowID)
            call SetUnitAbilityLevel(u,SlowID,.stacks)
            call UnitApplyTimedLife(u,&#039;BTLF&#039;,1.)
            call IssueTargetOrder(u,&quot;slow&quot;,.hero)
            set u = null
        elseif .stacks == 9 then
            set u = null
            return true
        endif
        return false
    endmethod
    
    implement T32
endstruct



private function onCast takes unit u returns nothing
    local slow S =  slow.create()
    
    set S.hero = u
    set S.stacks = 0
    set S.ticks = T32_FPS
    
    call S.startPeriodic()
    
endfunction



I see that it has been updated, what should I do to make it work with T32x?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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