- Joined
- Aug 7, 2009
- Messages
- 1,406
Introduction
Short variable names are not only faster, but reduce the script's total size. It's a known fact. But nowadays many people write their submissed systems/snippets - even the complicited ones - that takes more time understing, than writing, because of the super-annoying short names. Their reason(/excuse): The "Compress Names" function of Vexorian's optimizer is broken, and as said above, it's faster this way. Well, this little tutorial will show you how you can get it work, so that this annoying habit can finally go to an end.
Tools Needed
Let's Begin!
1, First of all, we need a map. Open the optimizer, browse the map, and set it up according to your liking. I'll make it like this:
2, Click "Save optimized as..." and save it. This will optimize everything and create two files: the optimized map, and the script file. Go and rename it immediately to "war3map.j"
3, Open the generated script file. Natives must be directly under global declaration, after the keyword
4, Open Ladik's awesome MPQ editor. We know how big our script file is; sort files by file size, locate the script file, and delete it. If you're not sure it's the right file, open it by double-clicking on it.
5, Go to Operations -> Add File(S), or press Ctrl+A. Locate our fixed script file, and import it. When the window pops up, select "Compress+Encrypt" and "Zlib" compression. Then go to File -> Close all MPQ's.
6, Open your WarCraft 3 and test it. It should work by now.
ExecuteFunc/TriggerRegisterVariableEvent natives
Those two natives have a string parameter; one of them is a function name, the other one is a variable name. If you pass a concatenated string, the optimizer will just ignore it. It can also be fixed by editing the "war3map.j" script file, when fixing the native bug, but you have to go through the entire file and find all these function calls, plus their arguments' shortened names. It's hard and time-consuming.
Getting rid of those ExecuteFunc/TriggerRegisterVariableEvent calls is simple, you have many options:
Credits
Short variable names are not only faster, but reduce the script's total size. It's a known fact. But nowadays many people write their submissed systems/snippets - even the complicited ones - that takes more time understing, than writing, because of the super-annoying short names. Their reason(/excuse): The "Compress Names" function of Vexorian's optimizer is broken, and as said above, it's faster this way. Well, this little tutorial will show you how you can get it work, so that this annoying habit can finally go to an end.
Tools Needed
- Wc3mapoptimizer
- Ladik's MPQ Editor
- Notepad++ (Optional)
Let's Begin!
1, First of all, we need a map. Open the optimizer, browse the map, and set it up according to your liking. I'll make it like this:
2, Click "Save optimized as..." and save it. This will optimize everything and create two files: the optimized map, and the script file. Go and rename it immediately to "war3map.j"
3, Open the generated script file. Natives must be directly under global declaration, after the keyword
endglobals
. The optimizer generates some garbage functions and places them inbetween the two of them; locate all the custom declared natives and move them where they belong.4, Open Ladik's awesome MPQ editor. We know how big our script file is; sort files by file size, locate the script file, and delete it. If you're not sure it's the right file, open it by double-clicking on it.
5, Go to Operations -> Add File(S), or press Ctrl+A. Locate our fixed script file, and import it. When the window pops up, select "Compress+Encrypt" and "Zlib" compression. Then go to File -> Close all MPQ's.
6, Open your WarCraft 3 and test it. It should work by now.
ExecuteFunc/TriggerRegisterVariableEvent natives
Those two natives have a string parameter; one of them is a function name, the other one is a variable name. If you pass a concatenated string, the optimizer will just ignore it. It can also be fixed by editing the "war3map.j" script file, when fixing the native bug, but you have to go through the entire file and find all these function calls, plus their arguments' shortened names. It's hard and time-consuming.
Getting rid of those ExecuteFunc/TriggerRegisterVariableEvent calls is simple, you have many options:
- Use either
.evaluate
or.evaluate
; - Evaluate triggers manually;
- Use this snippet.
Credits
- BBQ, for revealing why natives break maps
- Vexorian & Ladik, for their tools
Attachments
Last edited: