TriggerHappy
...
- Reaction score
- 341
Introduction
This is a simple script that will remove leaks after a certain period of time.
Requires
Usage
Simply remove a leak as your normally would, except add the Timed suffix to it.
RemoveLocationTimed,DestroyGroupTimed,DestroyEffectTimed
ect..
Script
Side notes
I haven't added in everything that leaks, only the most used things that leak, Though I probably missed a few popular ones.
I have also never used TimerUtils before so, correct anything wrong with it's usage.
This is a simple script that will remove leaks after a certain period of time.
Requires
- TimerUtils (also included in the demo map)
- JassHelper (included with JassNewGen Pack)
Usage
Simply remove a leak as your normally would, except add the Timed suffix to it.
RemoveLocationTimed,DestroyGroupTimed,DestroyEffectTimed
ect..
Script
JASS:
//*********************************************************************
//* Timed Leaks
//* ----------
//*
//* ClanMapz.com / wc3c.net / thehelper.net
//*
//* Implementaion
//* Simply copy the TimerUtils and TimedLeaks triggers into your map
//*
//* Requirements
//* This requires JassHelper vJASS Preprocessor and TimerUtils
//********************************************************************
library TimedLeaks requires TimerUtils
private struct data
location l
group g
effect e
force f
lightning light
texttag text
timer time
boolexpr b
weathereffect w
timer timer
real timeout
static method remove takes nothing returns nothing
local data index = GetTimerData(GetExpiredTimer())
call RemoveLocation(index.l)
call DestroyGroup(index.g)
call DestroyEffect(index.e)
call DestroyForce(index.f)
call DestroyLightning(index.light)
call DestroyTextTag(index.text)
call DestroyTimer(index.time)
call DestroyBoolExpr(index.b)
call RemoveWeatherEffect(index.w)
call ReleaseTimer(index.timer)
call index.destroy()
endmethod
//! textmacro TimedLeaks takes LEAKS
static method create takes $LEAKS$ real t returns data
local data d = data.allocate()
set d.l = l
set d.g = g
set d.e = e
set d.f = f
set d.light = light
set d.text = text
set d.time = time
set d.b = b
set d.w = w
set d.timer = NewTimer()
call SetTimerData(d.timer, d)
call TimerStart(d.timer, t, false, function data.remove)
return d
endmethod
//! endtextmacro
//! runtextmacro TimedLeaks("location l, group g, effect e, force f, lightning light, texttag text, timer time, boolexpr b, weathereffect w,")
endstruct
function RemoveLocationTimed takes location loc, real timeout returns nothing
local data d = data.create(loc, null,null,null,null,null,null,null,null,timeout)
endfunction
function DestroyGroupTimed takes group g, real timeout returns nothing
local data d = data.create(null,g,null,null,null,null,null,null,null,timeout)
endfunction
function DestroyEffectTimed takes effect e, real timeout returns nothing
local data d = data.create(null,null,e,null,null,null,null,null,null,timeout)
endfunction
function DestroyForceTimed takes force f, real timeout returns nothing
local data d = data.create(null,null,null,f,null,null,null,null,null,timeout)
endfunction
function DestroyLightningTimed takes lightning l, real timeout returns nothing
local data d = data.create(null,null,null,null,l,null,null,null,null,timeout)
endfunction
function DestroyTextTagTimed takes lightning l, real timeout returns nothing
local data d = data.create(null,null,null,null,l,null,null,null,null,timeout)
endfunction
function DestroyTimerTimed takes timer t, real timeout returns nothing
local data d = data.create(null,null,null,null,null,null,t,null,null,timeout)
endfunction
function DestroyBoolExprTimed takes boolexpr b, real timeout returns nothing
local data d = data.create(null,null,null,null,null,null,null,b,null,timeout)
endfunction
function RemoveWeatherEffectTimed takes weathereffect w, real timeout returns nothing
local data d = data.create(null,null,null,null,null,null,null,null,w,timeout)
endfunction
endlibrary
Side notes
I haven't added in everything that leaks, only the most used things that leak, Though I probably missed a few popular ones.
I have also never used TimerUtils before so, correct anything wrong with it's usage.