• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Triggers]Checking for eficiency

Status
Not open for further replies.
Level 2
Joined
Feb 21, 2013
Messages
17
hi, i have a map that im working on right now but i think alot of the triggers that im using are leaking i would like to know if som 1 can check them out and give some advice

EDIT: here is the map
 

Attachments

  • TDO 1.0T.w3x
    1,006.7 KB · Views: 80
Last edited:
Level 21
Joined
Mar 27, 2012
Messages
3,232
To check for leaks you use a handle counter.
Mine is this:
JASS:
function Trig_Periodic_Actions takes nothing returns nothing
    local location l = Location(0,0)
    call DisplayTextToPlayer(GetLocalPlayer(),0,0,I2S(GetHandleId(l)-1000000))
    call RemoveLocation(l)
    set l = null
endfunction

//===========================================================================
function InitTrig_Periodic takes nothing returns nothing
    set gg_trg_Periodic = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Periodic, 1.00 )
    call TriggerAddAction( gg_trg_Periodic, function Trig_Periodic_Actions )
endfunction

Just create a new trigger named "Periodic". Then turn it to custom text and replace everything with this.
It prints the handle count every time the trigger loops. 1 second loop is probably good enough.

How does this help to find leaks? Well most leaks are handle leaks, so if you keep leaking handles, then the handle IDs keep getting larger. This trigger prints the next available handle ID.
 
Level 2
Joined
Feb 21, 2013
Messages
17
yes ill test it right away but still i'd like som 1 to take a look on the map and tell me if im doing smt bad on the triggers. i added comments to be easier to see them.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Made fixes for some of the first triggers(everything up to goblin king). From that point I just wrote what's wrong and how to fix it.
Overall I like this map, although it's far from complete.
If you have any more questions, then feel free to ask.
 

Attachments

  • TDO 1.0Tfix.w3x
    1,013.3 KB · Views: 50
Level 2
Joined
Feb 21, 2013
Messages
17
tkx learned alot from your help here, i see u had some hard work and sry for it but i think next time i wont need this help and i may give to som 1 that same help :)
REALLLY helpfull :goblin_good_job:
 
Last edited:
Status
Not open for further replies.
Top