• 🏆 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!

[JASS] Why Native TextTag is Dealy to show it?

Status
Not open for further replies.
Level 5
Joined
Jan 4, 2009
Messages
118
Normally I use this.
JASS:
local texttag tt

call CreateTextTagPosUnitBJ("HELLO", gg_unit_Harf_0000, 0, 10, 100, 0, 0, 0)
set tt = GetLastCreatedTextTag()
call SetTextTagPermanentBJ(tt, fasle)

Upper Code is no delay,but I want to uses this insteatd.

JASS:
local texttag tt
local real h = TextTagHeight2Size(10)
local unit  = gg_unit_Harf_0000

set tt = CreateTextTag()
call SetTextTagText(tt, "HELLO", h)
call SetTextTagPosUnit(tt, GetUnitX(u), GetUnitY(u), 0)
call SetTextTagColor(tt, 255, 0, 0, 0)
call SetTextTagPermanent(tt, false)

Upper Code. It's display, but It's delay about 1-2 second before display text.

Suggest and advice me for how to uses TextTag.Plz
Thanks a lot before...
 
Level 5
Joined
Jan 4, 2009
Messages
118
OK, I fix alpha = 255. It's OK,but I have other question about How to clear leak for texttag?
Should I use DestroyTextTag or Only Set variable texttatg = null?

And This Question function SetTextTagLifeAge is use for?

Tell me more.
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Just set the TextTag lifespan to whatever you want and it will be automatically destroyed. It's like the Expiration Timer for units, when it expires the unit is killed. If for some reason you don't want to remove the textag after a fixed amount of time, you can use DestroyTextTag (or something like that).
 
Level 5
Joined
Jan 4, 2009
Messages
118
Just set the TextTag lifespan to whatever you want and it will be automatically destroyed. It's like the Expiration Timer for units, when it expires the unit is killed. If for some reason you don't want to remove the textag after a fixed amount of time, you can use DestroyTextTag (or something like that).


Ok I get it. Thanks a lot.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Clearing leaks is getting rid of allocated memory you do not need anymore. It's about memory management. This means you dispose of objects like texttags after their purpose is fulfilled. It does not make sense to destroy something you want to work with. If it was that simple, everyone would just do it right after the object is being created. To avoid leaks, you just have to store it in some variable to be able to retrieve it later on and then drop it.

Really, try to understand the issues in their basic meaning before giving in to hysteria the forums created.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
I'm not sure you need to flush local variable for the texttag type, i would even say that's useless.
Since like image, the handle id is recycled immediatly when the texttag is destroyed, no matter if variable(s) still point on it or not.
At least they are not concerned about the handle id leak bug with local variables.
But well, flush it wouldn't hurt anyway.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
I'm not sure you need to flush local variable for the texttag type, i would even say that's useless.
Since like image, the handle id is recycled immediatly when the texttag is destroyed, no matter if variable(s) still point on it or not.
At least they are not concerned about the handle id leak bug with local variables.
But well, flush it wouldn't hurt anyway.
It's a decent habit to get in to.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
I know, i just like to be accurate, technically it shouldn't be necessary, but well it's jass after all, moar safety can't be bad, and the overhead is negligible, so ...

Plus, then you wouldn't mess with an other texttag if you use (read) the not flushed variable later, maybe that's what you wanted to mean.
EDIT : I suppose not, since we are talking about locals, not globals.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Shouldn't in theory, but meh maybe there is some hidden leak/jass vm performance issue if you don't (i've not done any test about it).
Jass is full of weird behaviors (others will call them bugs), so just null them like the other handles, that won't hurt anyway.
I've mentionned it just for the sake of accuracy.
 
Status
Not open for further replies.
Top