• 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.

[General] Variable name to string.

Status
Not open for further replies.
I think variables names usually are removed after code has been read, and replaced by some kind of id because their names are not needed at all for the game running.

Edit:
Maybe you could try to save variables names as strings into hashtable in key of Id of "triggering unit" for example. And later load string of key of Id of "triggering unit".. or it's null, or its name. But would need to save after each variable change again in hashtable :s
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
No. There are three main steps in reading code (in wc3)

Code is written by the coder (vJass, gui, jass) (world editor)>
Code is compiled into war3map.j (jass) (save button) >
Code is compiled into bytecode (bytecode) (during map loading process) > Variable names are lost here.

@TheHerb i'd have to assume for debugging

@Chaosy the names of variables in C# are cached and stored relative to their memory address, similar to how its done in java
 
You should check out the debugging features of SharpCraft.

http://i.imgur.com/y1H15C2.jpg


y1H15C2.jpg

 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Code is compiled into bytecode (bytecode) (during map loading process) > Variable names are lost here.
You sure about that? I remember stepping through WC3 and it seemed to be resolving every jass name each time it was referenced, multiple times. In fact this is why JASS variable name length impacts execution speed.

Long names -> slower hashes -> slower execution
Short names -> faster hashes -> faster execution

One would think it would remove all names during run time, but it keeps resolving them each time a reference is made which is why jass is interpreted and why jass is so slow. It does seem to byte code overall line functionality but continues to resolve each given name.

SC2 fixed this by finally converting all variables and functions into byte code so that their names are truly lost at run time except if the debugger is in use.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I'm pretty sure DSG is right.

If the variable names were lost then SharpCraft wouldn't be able to tell you which null variable is being accessed.

Is it able to? In the picture, all that was stated was "uninitialized variable read". It might all be true, its mostly speculation on my part.
 
Status
Not open for further replies.
Top