System Key Timers 2

Troll-Brain

You can change this now in User CP.
Reaction score
85
Meh nevermind, i will still be stuck with Timers Utils Blue for longs or accurate timers, and my own personal ugly system for low periods.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Because i've made my own timer system, and tested it, i've found a lame thing.
If you don't set to null the boolexpr variable after destroying the boolexpr, it leaks.

JASS:
library Test initializer init

globals
    private boolexpr B1
    private boolexpr B2
    private trigger Trig
endglobals

private function F1 takes nothing returns boolean
    return true
endfunction

private function F2 takes nothing returns boolean
    return true
endfunction

private function F3 takes nothing returns boolean
    return true
endfunction

private function Actions takes nothing returns nothing
    call EnableTrigger(Trig)
    call TriggerSleepAction(20.)
    //call BJDebugMsg("end")
    call DisableTrigger(Trig)
endfunction

private function DoTheTest takes nothing returns nothing
    //call BJDebugMsg("run")
    set B1 = And(Condition(function F1),Condition(function F2))
    set B2 = And(B1,Condition(function F3))
    call DestroyBoolExpr(B1)
    call DestroyBoolExpr(B2)
    //set B1 = null
    //set B2 = null
endfunction

private function init takes nothing returns nothing
    local trigger trig = CreateTrigger()
    set Trig = CreateTrigger()
    
    call TriggerRegisterTimerEvent(Trig,0.01,true)
    call TriggerAddAction(Trig,function DoTheTest)
    call DisableTrigger(Trig)
    
    call TriggerRegisterPlayerEventEndCinematic(trig,Player(0))
    call TriggerAddAction(trig, function Actions)
endfunction

endlibrary


- i've tested on window mode.
- i've waited the stability of the process war3 before press escape
- and you can wait as you want the memory won't be freed after the trigger disabling, but if you set to null the variables there are no leaks.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
No, if the variable set to another value, original value will be removed, I think.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
No, if the variable set to another value, original value will be removed, I think.
Test it ?
That was i assumed, but it's wrong with boolexprs at least.

Btw it's a minor leak.

EDIT :
To be more accurate it doesn't leak handle references but just take some memory.
And the epic thing, it seems to be true for all handles (at least for triggers and locations).

Meh i wouldn't assume anything more without a personal test now ...
 

BlackRose

Forum User
Reaction score
239
? You don't in detail how WC3 handles memory? WUT? That doesn't make sense. You dont in detail how? I don't in detail how....


< INSERT GIANT SMILEY FACE HERE >
< YEP, BLACKROSE HAS LOST IT, HE GONE INSANE >
Has anyone really been far even as decided to use even go want to do look more like?
lolwut?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
But it's not the same effect, i know it's unbelievable, but you can test the code and you will see it leaks, even if it's minor like i've said.
The reason why i posted here because i thought it was a particular case for boolexpr, but it seems it's true for handle type in general.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
What, setting the value to something else instead of null?
It leaks, it's minor but it's still a leak.
I know it's unbelievable, but you can test it yourself, just test my code with the comments for the setting nulls, and then with theses comments removed.
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
:) This is like the only system from you that does not have an ASCII

Well, there you go.
JASS:

//  _  __       _______ _                         ___  
// | |/ /      |__   __(_)                       |__ \ 
// | &#039; / ___ _   _| |   _ _ __ ___   ___ _ __ ___   ) |
// |  &lt; / _ \ | | | |  | | &#039;_ ` _ \ / _ \ &#039;__/ __| / / 
// | . \  __/ |_| | |  | | | | | | |  __/ |  \__ \/ /_ 
// |_|\_\___|\__, |_|  |_|_| |_| |_|\___|_|  |___/____|
//            __/ |                                    
//           |___/          

// This one is nice too

//  _   __         _____ _                          _____ 
// | | / /        |_   _(_)                        / __  \
// | |/ /  ___ _   _| |  _ _ __ ___   ___ _ __ ___ `&#039; / /&#039;
// |    \ / _ \ | | | | | | &#039;_ ` _ \ / _ \ &#039;__/ __|  / /  
// | |\  \  __/ |_| | | | | | | | | |  __/ |  \__ \./ /___
// \_| \_/\___|\__, \_/ |_|_| |_| |_|\___|_|  |___/\_____/
//              __/ |                                     
//            |____/
 

Jesus4Lyf

Good Idea™
Reaction score
397
>What, setting the value to something else instead of null?
It leaks, it's minor but it's still a leak.
I know it's unbelievable, but you can test it yourself, just test my code with the comments for the setting nulls, and then with theses comments removed.
He's right. But this has nothing to do with KT2 anymore at all. This is a new leak altogether. Shift discussion here.

Aaaannd I'm not in a rush to ASCII Key Timers 2. :p
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
Yummy!
Compared to HSAS by PandaMine this is easy as **** to use (although his system attaches to other handles as well).

One last question. I don't need to null struct variables actually do I?
I did that til now because it was necessary in HSAS. But normally I don't need to or?
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
Yummy!
Compared to HSAS by PandaMine this is easy as **** to use (although his system attaches to other handles as well).
That's because HSAS is a general struct attachment system and this is a timer system. Two completely different things with two completely different purposes.

If you like J4L's systems and you want to attach to, say, units, use this.

One last question. I don't need to null struct variables actually do I?
I did that til now because it was necessary in HSAS. But normally I don't need to or?
You never need to null struct variables even if you are using HSAS. Struct variables themselves are just integers. HSAS refers to nulling the local handle variables, which is something that you should be doing anyway regardless of what system you're using.
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
Okay thanks, didn't really take a look at AIDS although I implanted it for 'Damage' already. Looks neat^^
I'll un-null my struct members then. Seems like I misunderstood PandaMine:

"The system just uses conventional arrays to store data. The maximum possible number of handles that can be used by the system is specified by a limit per database, however the actual maximum value can be lower, and it decreases as the map time increases (the bigger the gap between the handle indexes the lower the amount of structs you can store). It is however almost IMPOSSIBLE to go through all 3 arrays as long as
1. You are not being stupid
2. MOST CRUCIALLY remember to set your handles to null when you are finished with them. This recycles the index which makes a huge differences in the amount of data the system an store. If you set your handles to null most of the time then you will most likely never reach the limit
3. Someone enjoys playing your map for over a day straight "

Thought he meant struct members because nulling handles is... kinda obvious anyway oO
 

Viikuna

No Marlo no game.
Reaction score
265
I tried to read that TAZO shit, but I just cant force myself to concentrate on it, because it just seems to be too damn complicated for such an simple thing, so I think I just ask you about this stuff.


Would it be possible to add some functions for pausing this TAZO timer outside of callback, as well as some TimerGetRemaining and TimerGetElapsed functions, or just some way to get the timer that runs some specific instance?
 

SanKakU

Member
Reaction score
21
ok, i want to learn to use this system that you wrote.
please help me with it.

you said for typical waiting KT2 should be used
also another system should be used for graphics
or whatever. i don't remember what that one was,
but for now i just want to at least tackle this one.

here is a hero revival trigger, for an example


JASS:

scope revivehero initializer I
private function C takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and IsUnitIllusion(GetTriggerUnit()) == false
endfunction
//the following comments are just notes considering you cannot
//view the unit id in the terrain editor
    //call KillUnit( gg_unit_nhmc_0117 )
    //call KillUnit( gg_unit_nder_0195 )
    //call KillUnit( gg_unit_nshe_0196 )
    //call KillUnit( gg_unit_nrac_0197 )
    //call KillUnit( gg_unit_ndog_0190 )
    //call KillUnit( gg_unit_necr_0199 )
    //call KillUnit( gg_unit_nfro_0201 )
    //call KillUnit( gg_unit_npng_0189 )
    //call KillUnit( gg_unit_nfbr_0162 )
    //call KillUnit( gg_unit_ncrb_0148 )
private function A takes nothing returns nothing
local real x
local real y
call TriggerSleepAction(I2R(GetUnitLevel(GetTriggerUnit())) * 1.75 + 10.00)
if GetOwningPlayer(GetTriggerUnit()) == Player(2) then
set x = GetUnitX(gg_unit_nshe_0196)
set y = GetUnitY(gg_unit_nshe_0196)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(3) then
set x = GetUnitX(gg_unit_npng_0189)
set y = GetUnitY(gg_unit_npng_0189)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(4) then
set x = GetUnitX(gg_unit_necr_0199)
set y = GetUnitY(gg_unit_necr_0199)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(5) then
set x = GetUnitX(gg_unit_nfbr_0162)
set y = GetUnitY(gg_unit_nfbr_0162)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(6) then
set x = GetUnitX(gg_unit_nder_0195)
set y = GetUnitY(gg_unit_nder_0195)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(8) then
set x = GetUnitX(gg_unit_nrac_0197)
set y = GetUnitY(gg_unit_nrac_0197)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(7) then
set x = GetUnitX(gg_unit_nfro_0201)
set y = GetUnitY(gg_unit_nfro_0201)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(10) then
set x = GetUnitX(gg_unit_ndog_0190)
set y = GetUnitY(gg_unit_ndog_0190)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(11) then
set x = GetUnitX(gg_unit_ncrb_0148)
set y = GetUnitY(gg_unit_ncrb_0148)
if GetOwningPlayer(GetTriggerUnit()) == Player(9) then
set x = GetUnitX(gg_unit_nhmc_0117)
set y = GetUnitY(gg_unit_nhmc_0117)
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
call ReviveHero(GetTriggerUnit(), x,y,true)
endfunction

//===========================================================================
private function I takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TAF_PUE( t, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( t, Condition( function C ) )
    call TriggerAddAction( t, function A )
endfunction

endscope

now, how do you swap out the TriggerSleepAction function call?
 

Jesus4Lyf

Good Idea™
Reaction score
397
>now, how do you swap out the TriggerSleepAction function call?
To do that, try this:
JASS:
scope revivehero initializer I
private struct Data
    real x
    real y
    unit hero
endstruct
private function AfterWait takes nothing returns boolean
    local Data d=Data(KT_GetData())
    call ReviveHero(d.hero,d.x,d.y,true)
    call d.destroy()
    return true
endfunction
private function C takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and IsUnitIllusion(GetTriggerUnit()) == false
endfunction
//the following comments are just notes considering you cannot
//view the unit id in the terrain editor
    //call KillUnit( gg_unit_nhmc_0117 )
    //call KillUnit( gg_unit_nder_0195 )
    //call KillUnit( gg_unit_nshe_0196 )
    //call KillUnit( gg_unit_nrac_0197 )
    //call KillUnit( gg_unit_ndog_0190 )
    //call KillUnit( gg_unit_necr_0199 )
    //call KillUnit( gg_unit_nfro_0201 )
    //call KillUnit( gg_unit_npng_0189 )
    //call KillUnit( gg_unit_nfbr_0162 )
    //call KillUnit( gg_unit_ncrb_0148 )
private function A takes nothing returns nothing
local Data d=Data.create()
local real x
local real y
if GetOwningPlayer(GetTriggerUnit()) == Player(2) then
set x = GetUnitX(gg_unit_nshe_0196)
set y = GetUnitY(gg_unit_nshe_0196)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(3) then
set x = GetUnitX(gg_unit_npng_0189)
set y = GetUnitY(gg_unit_npng_0189)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(4) then
set x = GetUnitX(gg_unit_necr_0199)
set y = GetUnitY(gg_unit_necr_0199)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(5) then
set x = GetUnitX(gg_unit_nfbr_0162)
set y = GetUnitY(gg_unit_nfbr_0162)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(6) then
set x = GetUnitX(gg_unit_nder_0195)
set y = GetUnitY(gg_unit_nder_0195)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(8) then
set x = GetUnitX(gg_unit_nrac_0197)
set y = GetUnitY(gg_unit_nrac_0197)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(7) then
set x = GetUnitX(gg_unit_nfro_0201)
set y = GetUnitY(gg_unit_nfro_0201)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(10) then
set x = GetUnitX(gg_unit_ndog_0190)
set y = GetUnitY(gg_unit_ndog_0190)
else
if GetOwningPlayer(GetTriggerUnit()) == Player(11) then
set x = GetUnitX(gg_unit_ncrb_0148)
set y = GetUnitY(gg_unit_ncrb_0148)
if GetOwningPlayer(GetTriggerUnit()) == Player(9) then
set x = GetUnitX(gg_unit_nhmc_0117)
set y = GetUnitY(gg_unit_nhmc_0117)
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
set d.x=x
set d.y=y
set d.hero=GetTriggerUnit()
call KT_Add(function AfterWait,d,I2R(GetUnitLevel(GetTriggerUnit())) * 1.75 + 10.00)
endfunction

//===========================================================================
private function I takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TAF_PUE( t, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( t, Condition( function C ) )
    call TriggerAddAction( t, function A )
endfunction

endscope

I can't syntax check it right now, but that should work. :thup:

However, this will revive the hero at the location of the unit when the hero died. Is the unit mobile? You could store the unit in the struct, and get its x/y when it revives or something. :thup:

Edit: Done that also.
JASS:
scope revivehero initializer I
private struct Data
    unit hero
endstruct
private function AfterWait takes nothing returns boolean
    local Data d=KT_GetData()
    local real x
    local real y
    if GetOwningPlayer(d.hero) == Player(2) then
    set x = GetUnitX(gg_unit_nshe_0196)
    set y = GetUnitY(gg_unit_nshe_0196)
    else
    if GetOwningPlayer(d.hero) == Player(3) then
    set x = GetUnitX(gg_unit_npng_0189)
    set y = GetUnitY(gg_unit_npng_0189)
    else
    if GetOwningPlayer(d.hero) == Player(4) then
    set x = GetUnitX(gg_unit_necr_0199)
    set y = GetUnitY(gg_unit_necr_0199)
    else
    if GetOwningPlayer(d.hero) == Player(5) then
    set x = GetUnitX(gg_unit_nfbr_0162)
    set y = GetUnitY(gg_unit_nfbr_0162)
    else
    if GetOwningPlayer(d.hero) == Player(6) then
    set x = GetUnitX(gg_unit_nder_0195)
    set y = GetUnitY(gg_unit_nder_0195)
    else
    if GetOwningPlayer(d.hero) == Player(8) then
    set x = GetUnitX(gg_unit_nrac_0197)
    set y = GetUnitY(gg_unit_nrac_0197)
    else
    if GetOwningPlayer(d.hero) == Player(7) then
    set x = GetUnitX(gg_unit_nfro_0201)
    set y = GetUnitY(gg_unit_nfro_0201)
    else
    if GetOwningPlayer(d.hero) == Player(10) then
    set x = GetUnitX(gg_unit_ndog_0190)
    set y = GetUnitY(gg_unit_ndog_0190)
    else
    if GetOwningPlayer(d.hero) == Player(11) then
    set x = GetUnitX(gg_unit_ncrb_0148)
    set y = GetUnitY(gg_unit_ncrb_0148)
    if GetOwningPlayer(d.hero) == Player(9) then
    set x = GetUnitX(gg_unit_nhmc_0117)
    set y = GetUnitY(gg_unit_nhmc_0117)
    endif
    endif
    endif
    endif
    endif
    endif
    endif
    endif
    endif
    endif
    call ReviveHero(d.hero, x,y,true)
    call d.destroy()
    return true
endfunction
private function C takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and IsUnitIllusion(GetTriggerUnit()) == false
endfunction
//the following comments are just notes considering you cannot
//view the unit id in the terrain editor
    //call KillUnit( gg_unit_nhmc_0117 )
    //call KillUnit( gg_unit_nder_0195 )
    //call KillUnit( gg_unit_nshe_0196 )
    //call KillUnit( gg_unit_nrac_0197 )
    //call KillUnit( gg_unit_ndog_0190 )
    //call KillUnit( gg_unit_necr_0199 )
    //call KillUnit( gg_unit_nfro_0201 )
    //call KillUnit( gg_unit_npng_0189 )
    //call KillUnit( gg_unit_nfbr_0162 )
    //call KillUnit( gg_unit_ncrb_0148 )
private function A takes nothing returns nothing
    local Data d=Data.create()
    set d.hero=GetTriggerUnit()
    call KT_Add(function AfterWait,d,I2R(GetUnitLevel(d.hero)) * 1.75 + 10.00)
endfunction

//===========================================================================
private function I takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TAF_PUE( t, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( t, Condition( function C ) )
    call TriggerAddAction( t, function A )
endfunction

endscope
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top