1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

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

Discussion in 'Triggers & Scripts' started by ALTELMA, May 15, 2012.

  1. ALTELMA

    ALTELMA

    Joined:
    Jan 4, 2009
    Messages:
    113
    Resources:
    0
    Resources:
    0
    Normally I use this.
    Code (vJASS):

    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.

    Code (vJASS):

    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...
     
  2. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    It's TextTagSize2Height, SetTextTagPos when you take the coordinates, last parameter of color is alpha, 0 is fully invisible, try 255. I do not have delay.
     
  3. ALTELMA

    ALTELMA

    Joined:
    Jan 4, 2009
    Messages:
    113
    Resources:
    0
    Resources:
    0
    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: May 16, 2012
  4. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    DestroyTextTag or SetTextTagLifespan (texttag should not be flagged as permanent then afaik). First destroys it immediately, latter sets a timer for it. SetTextTagLifeAge resets the timer.
     
  5. ALTELMA

    ALTELMA

    Joined:
    Jan 4, 2009
    Messages:
    113
    Resources:
    0
    Resources:
    0
    Do you mean function SetTextTagLifespan is expires time of texttag? If I use Destroy first that TextTag can't show. I don't understand it. Example Code for me, Plz.
     
  6. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    Yes.

    Why would you destroy a text tag that you want to show?
     
  7. ALTELMA

    ALTELMA

    Joined:
    Jan 4, 2009
    Messages:
    113
    Resources:
    0
    Resources:
    0
    I want to clear leak from texttag. function DestroyTextTag is the way to clear leak?
    Tell me, plz. If SetTextTagLifeSpan can clear leak.
     
  8. Spartipilo

    Spartipilo

    Joined:
    Jul 14, 2011
    Messages:
    3,190
    Resources:
    0
    Resources:
    0
    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).
     
  9. ALTELMA

    ALTELMA

    Joined:
    Jan 4, 2009
    Messages:
    113
    Resources:
    0
    Resources:
    0

    Ok I get it. Thanks a lot.
     
  10. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    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.
     
  11. ALTELMA

    ALTELMA

    Joined:
    Jan 4, 2009
    Messages:
    113
    Resources:
    0
    Resources:
    0
    Ok, I'll see, thanks you a lot, too. It's Clear If I uses SetTextTagLifespan.
     
  12. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,896
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    Don't forget to null local variable such as
    texttag
    .
    In your example:
    Code (vJASS):

    local texttag tt = CreateTextTag()
    local unit    u  = gg_unit_Harf_0000

    /* Your code */

    set tt = null
    set u = null
     
     
  13. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    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.
     
  14. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    It's a decent habit to get in to.
     
  15. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    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.
     
  16. ALTELMA

    ALTELMA

    Joined:
    Jan 4, 2009
    Messages:
    113
    Resources:
    0
    Resources:
    0
    OK, It's shouldn't be necessary to set texttag = null. I get it.
     
  17. Troll-Brain

    Troll-Brain

    Joined:
    Apr 27, 2008
    Messages:
    2,372
    Resources:
    1
    JASS:
    1
    Resources:
    1
    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.
     
  18. ALTELMA

    ALTELMA

    Joined:
    Jan 4, 2009
    Messages:
    113
    Resources:
    0
    Resources:
    0
    Ok, Thanks a lot.