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.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • 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 Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top