• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Concatenation Errors

Status
Not open for further replies.
Level 9
Joined
Apr 23, 2011
Messages
460
[Solved] Concatenation Errors

For some reason this line of code is giving me a bunch of bad operators. Any reasons. It's obviously the concatenation, but I followed syntax didn't i? call DisplayTimedTextToPlayer(recP, 0., 0., 8.5,("(Allies): " + PCOLOR[pnum] + GetPlayerName(p) + ": " + s + "|r"))

Edit: I'm so sorry for the wasted post. I checked over the coding again, and I forgot to do COLOR[PCOLOR[pnum]], Doing what I did before was causing the code to supply an integer. My apologies.
 
Level 9
Joined
Apr 23, 2011
Messages
460
I'm in the process of making a vJass Customizable Chat System. One that you can pick sections of the system to use, and customize, however I have hardly ever used String based systems and so concatenation and SubStrings are being learned as I work ; ). I'm sure once I get the hang of it, the system will be clean, efficient and more so helpful to others who may want a system like this.
 
Level 9
Joined
Apr 23, 2011
Messages
460
All strings being used are stored to locals, used, nulled, and the system works very efficiently, as of now, and does not leak yet. However I do have a question. If I call say: SubString("Red", 0, 4) will it return "Red " with one space, or is the space cut off. This is very important for me to know.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
All strings being used are stored to locals, used, nulled,
This has what to do with string leaks exactly?

Once a string has been created (via any means) it will exist until the end of the session even if no references exist to it.

will it return "Red " with one space, or is the space cut off. This is very important for me to know.
I suspect it will return just "Red" as there are no other characters to use so adding extra characters would be illogical.
 
Level 9
Joined
Apr 23, 2011
Messages
460
I was certain there was a way to clear the entered string so that after it is entered it was like it didn't exist. Is this only with entered string, or if I create a local string, even if I null that string, it stays in the memory for the remainder of the game?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Once a string has been created (via any means) it will exist until the end of the session even if no references exist to it.
If you do not believe me, make a trigger than counts from 0 upwards while printing each number (thus creating a unqiue string). You will be able to see the memory usage of WC3 rise during this and if it is done fast enough you will even start to get frame skipping after enough leaks have occured.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
What is the reason for this? If the data is being stored into the system, doesn't that mean we should be able to get the string and remove it? I don't see why blizzard would design a system like this.
It is due to the strange way of storing strings that they use. Every string is given a unqiue reference and string comparisons are done by reference. When you create new strings, the contense is created locally, hashed and then checked to see if an entry for it exists in the string table. If it does then the string number for the entry is returned else it will add the entry to the hashtable and assign it a string number which is then returned.

I am not sure if strings even get reference counted. If not then there is no way to perform a garbage collection on the string system.
 
Status
Not open for further replies.
Top