[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

Last edited:
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.
 
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.
 
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.
Back
Top