Texttags are bugging! leak?

Rushhour

New Member
Reaction score
46
Hi there. I have a problem with these stupid texttags. At first it works perfectly. I use them to display damage dealt and suffered and so there are a lot of texttags created over gameplay.

After a time ( I don't know how many are exactly created, could be some hundreds) they start bugging. To be exact that means they vanish after one second. Vanish after another one has been created. Start moving even if they shouldn't,... .

I guess this has something to do with only having some hundreds of texttags preallocated per player...
Well I thought I could 'recyle' them by destroying them (attached to a struct and destroyed after lifespan).
It doesn't work! I nulled the variables, disabled permanence, set lifespan and that's pretty much all I can imagine. How can I make this work for longer games?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
You can have only 100 texttag simultaneously on each machine.
You can create a textag locally with GetLocalPlayer without any desync.

EDIT : Hide a texttag doesn't help, only destroy them with SetTextTagLifespan or ofc DestroyTextTag.
Also i had never use SetTextTagPermanent, but maybe it prevents the destroy of the texttag with the Set...LifeSpan function.

You can see how many more textags you can create by displaying the id of your texttag with GetHandleId.
The first will be "99", and the last "0".
That's one more weird thing for jass, the last valid id for texttag is "0" but that's also the same for an invalid texttag when you reach the limit of 100.
 

Rushhour

New Member
Reaction score
46
Well: I do not have 100 texttags in my map at the same time.
I guess I display around 800-1000 correctly (it's a single player map) until they first start bugging.

Now I tried to preallocate a stack of texttags myself, save them in an array and get them just by increasing the stackindex...

Something weird came out.:

JASS:
globals
        constant integer PreAllocAmount=50
        integer CurrStackIndex=0
       texttag array TextStack
endglobals

function CreateTextTagEx takes /*lot of things*/ returns nothing
   if TextStack[CurrStackIndex] == null then
        call BJDebugMsg("there is no text! index is: "+I2S(CurrStackIndex))
    else
        call BJDebugMsg("there is one! index is: "+I2S(CurrStackIndex)) //displayed
    endif

   //setting texttag stuff here...

        set CurrStackIndex=CurrStackIndex+1
        if CurrStackIndex>=PreAllocAmount then
            set CurrStackIndex=0
        endif
call BJDebugMsg("Text should be there") //displayed
endfunction

function StackInit takes nothing returns nothing
    local integer index=0
        loop
            exitwhen index>=PreAllocAmount
            set TextStack[index]=CreateTextTag()
            set index = index+1
        endloop
call BJDebugMsg("Init successful") //displayed
endfunction

this setup DOESN'T work! The marked debug messages are displayed, but there is no text ingame.

----------------------------------------------------------------------------------------------------------------------------------
But if I only change this to the following:

JASS:
globals
        constant integer PreAllocAmount=50
        integer CurrStackIndex=0
endglobals

function CreateTextTagEx takes /*lot of things*/ returns nothing
   set TextStack[CurrStackIndex]=CreateTextTag()
   if TextStack[CurrStackIndex] == null then
        call BJDebugMsg("there is no text! index is: "+I2S(CurrStackIndex))
    else
        call BJDebugMsg("there is one! index is: "+I2S(CurrStackIndex)) //displayed
    endif

   //setting texttag stuff here...

        set CurrStackIndex=CurrStackIndex+1
        if CurrStackIndex>=PreAllocAmount then
            set CurrStackIndex=0
        endif
call BJDebugMsg("Text should be there") //displayed
endfunction

function StackInit takes nothing returns nothing
    local integer index=0
        loop
            exitwhen index>=PreAllocAmount
            set TextStack[index]=CreateTextTag()
            set index = index+1
        endloop
call BJDebugMsg("Init successful") //displayed
endfunction

then it works... the functions for setting the texttag stuff weren't touched.

What the hell?

Edit: Ok when I have more than 100 texttags allocated/created at the same time I get the effects I described. But I do not have these many texts all the time. Maybe in a rare situation, but I still have these effects when fighting solo units afterwards...

The last thing I can think of is that there is maybe a situation where more than 100 texttags are in the map, but would this screw up everything? Even future situations where there are less texttags?
And why doesn't the first setup work while the second one does? :O
 

Bribe

vJass errors are legion
Reaction score
67
You don't need to destroy texttags as they are auto-destroyed once the 100 limit is reached.

CreateTextTag 1-99: as you'd expect

CreateTextTag 100: destroys texttag 1
CreateTextTag 101: destroys texttag 2
etc.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
[del]Hmm, not really the destroyed texttag is kinda random if i remember correctly.[/del]
And still, it's good to know the limit.

After a short test it seems in this case it works like a stack, the last created is destroyed, so it's kinda lame, isn't it ?

I'm also totally sure that you can only have 100 texttag per player, no more.
And no the limit is 100 not 99.

EDIT : Recycling texttags is a really really lame idea.
Just create and destroy them when you don't need it.

Also, i was always wondering if the textags created by the game itself does matter in the hardcoded limit of 100 texttags.
You know when a peon bring a resource gold/wood, or when an unit takes a critic damage, and so one.
I had never tested because i don't use texttags that much, but maybe it's your problem.
 

Rushhour

New Member
Reaction score
46
I couldn't reproduce the bug when doing a stresstest, damaging 50 units 4 times a second...

Afterwards everything went on fine 0o

The strange thing is that I do all my texttag creation with one base function. It's not like I created a stack of texttags, saved them and forgot about them...

Will have to look through my script then.. man I hate stuff like that :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top