- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
So TextTags (TTs) can be given values that determine how long they last/how quick they fade out.
But as far as I know, TTs need to be destroyed otherwise they will cause a permanent leak, like any non-primitive type in WC3.
So suppose I have the following code, and I need to make sure at each loop iteration that I destroy the TT to avoid accumulating leaks.
If I uncomment the line that destroys the TT, the TT never actually gets displayed. This is obviously because it's destroyed before it gets to appear on the screen (or at least no human can see it in between the time that it's displayed and the microseconds that it gets destroyed).
So how would I proceed here? I am not willing to write up a timer or hash table the TT and then figure out smartly how to delete it. That is too much overhead for what should have a very simply solution (i.e. a one liner that calls the destroy).
Or is that the only real solution?
So TextTags (TTs) can be given values that determine how long they last/how quick they fade out.
But as far as I know, TTs need to be destroyed otherwise they will cause a permanent leak, like any non-primitive type in WC3.
So suppose I have the following code, and I need to make sure at each loop iteration that I destroy the TT to avoid accumulating leaks.
JASS:
loop
if ... then
set j = 0
loop
...
if ... then
set tt = CreateTextTag()
call SetTextTagText(tt, "Exp +" + I2S(R2I(expGain)), 0.02)
call SetTextTagVisibility(tt, true)
call SetTextTagPosUnit(tt, m, 0)
call SetTextTagColor(tt, 190, 0, 255, 255)
call SetTextTagVelocity(tt, 0, 0.04)
call SetTextTagPermanent(tt, false)
call SetTextTagLifespan(tt, 3)
call SetTextTagFadepoint(tt, 2)
//call DestroyTextTag(tt)
set tt = null
endif
set j = j + 1
endloop
endif
set i = i + 1
endloop
If I uncomment the line that destroys the TT, the TT never actually gets displayed. This is obviously because it's destroyed before it gets to appear on the screen (or at least no human can see it in between the time that it's displayed and the microseconds that it gets destroyed).
So how would I proceed here? I am not willing to write up a timer or hash table the TT and then figure out smartly how to delete it. That is too much overhead for what should have a very simply solution (i.e. a one liner that calls the destroy).
Or is that the only real solution?