    ****************************************
    *                                      *
    *  Wc3 Text File Optimizer 5.0         *
    *                                      *
    ****************************************

The usual 3rd party program warning:

      THIS PROGRAM IS DISTRIBUTED "AS IS".  NO WARRANTY OF ANY KIND IS EXPRESSED
      OR IMPLIED. YOU USE AT YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR
      DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
      OR MISSUSING THIS SOFTWARE.

      NOTE: This program as EVERY SINGLE 3rd party wc3 modding program is
      AGAINST the world editor's EULA.

# Index:

- What does it do?
- How to use it?
- Wc3 map Optimizer F.A.Q
  - System requirements
  - What is it?
  - Map protection?
  - How do I use it?
  - I am just a guy that wants to optimize a map, which options should I use?
  - What to do if the optimized map doesn't work correctly?
  - What to do if the optimized map becomes BIGGER than original?
  - I can't upload the optimizer to certain site
  - How can I use the Widgetizer and the optmizer on the same map?
  - What does an error message mean?
- Map Optimization Options:
  - Options that require MPQ reconstruction:
    - ZLIB Deflate
    - Buffer Size
    - Mantain (attributes)
  - Auxiliar ListFile
  - Also optimize other script files
  - Optimize String usage
    - Remove editor suffixes
  - Clean BLPs
  - Extra Cleaning:
    - Clean Slks
    - Remove editor suffixes
    - Remove Editor Only Files
- Script Optimization Methods
  - Remove comments and useless spaces
  - Optimize script
  - Compress names
  - Tweaks
- Command line
- Final Notes
- Credits and Special thanks
- In the future
- Legal stuff
- Version history

## Wc3 Map Optimizer F.A.Q.

### System requirements

You probably need a computer to run this program, processor speed would determine the time the optimizing process takes, on some large maps this might get a little large. Memory is also recommended, it should work with 256 MB of RAM, but it might get over that if there are bugs in my code, so expect some swapping.

You may run wc3mapoptimizer on supported platforms, which would be Windows XP SP2 and WINE 1.0 or greater. Windows XP SP3 is probably fine as well. Notice other platforms are not supported by the developer, the optimizer might work there but if there's a bug that you can get in them and I cannot reproduce on the supported platforms it is unlikely I'd fix it.

### What is it?

This is a program that was meant to optimize warcraft III maps in many possible ways and dimensions, as a map maker your best intention should be to let your map take the least size possible, to be as fast as possible in game and to load as fast as possible. The map optimizer aids you improving the map in those sections by removing or changing certain parts of your map.

### Map protection?

You have probably downloaded it because some one in some forum told you it is the "Strongest Map Protection method" as I noticed from browsing the web it is the usual way in which the map optimizer is linked. You got to notice that "map protection" is not something I consider to exist, unless a tool that encryptyed the map and made wc3 require a special DRM-like hack to read the map is created . Although that is very feasible to happen, I doubt anyone would actually make it done.

But some of optimizer's options certainly have the side effect of making world editor unable to edit the map or open it at all. And the script optimization methods change the pattern in the map's script in a way that it is very hard to rebuild the data from it automatically. Before the optimizer was around it was a common "map protection method" to delete war3map.wtg from the map, it made the editor unable to open the map. But someone made a tool that reconstructed the war3map.wtg from the map's script and let the map be editable again, hence the name of map deprotector.

Since those tools were based on patterns and not on keywords, the optimizer's ability to change the patterns in a script to better ones made those tools unable to work again, and that is the reason the optimizer got its fame of a very strong protection method, since files are no longer rebuildable (this is just a theoric wall, this is actually caused by the lack of ability/interest among the people in that side, since they are either unable to make a complex map script parser that would be able to rebuild such data OR they figured pretty much that rebuilding those is very useless).

But the fact is that nothing really prevents people from editing a map, unless they really could not stand editing it without world editor. Thus such a thing as "Map protection" does not exist.

But there are plenty of things you can do to prevent your map from being abused to some extent.

- Use the optimizer, yes, I know what I said already but it is at least able to make the process much harder.
- Use the widgetizer (see bellow ). Somehow some guys are pretty unable to edit SLK files and are dependant on object editor editing...
- Have an official download place for your map, and ask your usual players to only download from that place and avoid downloading a "new version" from someone hosting the map on battle.net
- Rig the map, there are plenty of traps you can add to the map script to prevent it or the map from being changed. I cannot explain any in this readme since it would also be explaining the way to "unlock" the trap. And I will also avoid to explain them directly through email so do not ask me for it. It is better to be creative and invent your own way to do this, the possibilities are actually infinite.

But if your map gets really popular there will be enough losers with a lot of time and the lack of playing skills required to add cheats to your map. In that case just be happy that it happened, and remember that if you followed the tip about the official place this should not really matter since your map's popularity is already protecting your map.

Cheating is still a big deal, since if for some reason it happens to a map that is just starting it would be very difficult to fight it. If you think about it there is not much we can do ourselves besides what I said. In the context of starcraft 2 being announced, it would be a good idea to ask blizzard to think of ways to prevent this situation at least in that game. Why should they care about this? A game is supposed to be fun and cheating is not fun, and playing against a cheater is not fun either, just like they are surely taking measures against map hacking they should try to at least make map cheating harder.

There are plenty of ways to do this, one if that they could let a bnet account register a map's name so that name could not be used in another map in a public bnet game. Map format should be designed in a way that version could be a different field than name, as well.

An actual petition to do something about this is in my plans, thus I will request that you either make your own petition or you support mine. There are plenty of reasons to have an internal map registering feature.

- Cheating.
- Sharing knowledge, the fear prevents some mappers to share knowledge, if your own map could never be changed officially without changing the map's name it would not matter that much.
- Encouraging map making: It has been proved that maps make a game even more popular and replayable, showing some extra respect and promoting popularity of map authors seems to be only good for the game itself.

### How to use it?

Open the exe file, then click the button and find your map, then use to save the optimized version of the map, before doing that you can choose what extra optimization methods you'd like.

I made sure the program disallows you to save your map in the same path to ensure you have a backup of the file you optimized.

### I am just a guy that wants to optimize a map, which options should I use?

For maximum optimization you'd like to use every option besides of tweaks, make sure that you enable 'compress names' for that you need to specify the path to warpatch.mpq.

### What to do if the optimized map does not work correctly?

Whenever you find a problem, please report them to Vexorian@gmail.com , I may also want you to send me your original map script or in the case the problem is caused by the Map optimizing options, your original map. Don't worry, I am not interested in "stealing" your map, and even If I was, I am the kind of person that doesn't need the original version of your map to do so; But I really need the original version of your map/map script to find the reasons behind the bugs SO I CAN FIX THEM.

Is the map a widgetized map? In that case try optimizing a non-widgetized version and check if it still has the bugs, In that case, remember to tell me that the bugs happen only on the widgetized version, and try unchecking "optimize strings" and see if that makes it work correctly.

I suggest these debugging steps:

1) Try Optimizing the map without using any map script optimization. If the new map works, then the problem was caused by one of the obfuscation methods. In that case, Try disabling different combinations of obfuscation options using tweaks, enabling the merge and normal anti bj methods is often enough. Now that we know it was caused by the obfuscation methods, I will really appreciate if you send me your map's map script file (I only need the map script). Also try the map with solely the [Enforce IsUnitType Safety] tweak.

If you are using some events from WEU advanced triggers and [compress names] is enabled, you will have to set the [Consider real variable events] tweak.

If your map contains some rare ExecuteFunc abuse in which some functions are at the same time called by normal call and also called by concatenation, you will have to either stop doing that (since it is a very bad way of doing things) or using the [Identifiers ignored for renaming] tweak.

2) In case it doesn't work even without the script methods, try disabling all of the extra map optimization methods, in case the map works now report it to me, and If possible send me your map so I can debug this program.

### What to do if the optimized map becomes BIGGER than original?

Map size increasement, might be caused by various reasons:

- WAVE sound files in the map, the optimizer's features compress them wrongly. I decided to do not fix this because WAVE sounds should be removed from the surface of earth and replaced by MP3, get LAME or another sound compressor to replace your WAVE sounds to the mp3 format. If you were replacing sounds in the game with other sounds and can't have .mp3 as extension of them, don't worry, it is safe to import mp3 files as wav files, the game is able to recognize them.

- A bug in the obfuscation methods, I've never seen this, but in theory a bug in any of the obfuscation methods may cause the script to increase on size a lot, this is really unprobable though, just try the map without any extra obfuscation method, and see if the map's size is reducing now. In case you find it is caused by the obfuscation methods, please send Vexorian at wc3campaigns your map's script, I will really appreciate it,

- The only option that you used was "Keep (Attributes)" , that's supposed to support the other options, using it alone is just a bad idea.

- Could also be that you used a very small charmap tweak, try at least a charmap of size 4.

### I cannot upload the optimizer to certain site

If the map can be used correctly by warcraft III but cannot be uploaded to a site, then it is a that site's bug and it is up to its admins to fix their upload scripts.

### Widgetizer

Widgetizer is a tool by Pitzermike that basically converts the object data into slks and txts , this greatly improves loading time, but it also reduces the chances to get a better compression.

When you use a map on widgetizer, it will actually reduce its size most of the times, but this is actually because widgetizer already uses the buffer size feature.

Using the optimizer on a widgetized map, will reduce the map's size but not as much as it would reduce the size on a non widgetized map, just take that in mind.

Also the 'Optimize Strings' will have no effect on a widgetized map, since widgetizer converts them to slks, and it already inlines the strings. But Remove Editor Suffixes will work.

There might be problems with the final result when optimizing a widgetized map, in that case try unchecking "Optimize Strings", if it doesn't work I would need you to send me your original version of the map.

There is also a Widgetizer problem caused by blizzard, the destructables become boxes some times, just uncheck [x] Destructables and [x] doodads when using widgetizer on a map, that should fix the problem.

Another optimizer option that may cause problems with widgetizer maps is the clean slks options, in case you have troubles try unchecking it.

Either way please send me the original version of your map so I can fix the bugs.

Some tests

This information may help you decide what combination is better for you:

Tested Map : Vexorian Hero Arena 0.507 (not released yet)

| Map Size� | Loading Time�
Original File | 1227 KB | 2 min 32.45 sec
Map Optimizer | 655 KB | 2 min 17.24 sec
Widgetizer | 1142 KB | 1 min 13.68 sec
Widgetizer+Optimizer� | 888 KB | 1 min 11.25 sec

Granted Widgetizer and Optimizer make a great synergy with a 339KB reduction and 81.2 less loading time seconds.

One thing to note is the 233KB difference between the combined Widgetizer and Optimizer and the Optimizer alone, and the 1 minute 5 seconds difference in loading time. What is more important Map Size or loading time? If the map is for LAN or Single player, then you should just focus on loading time, but if the map is for bnet you should reconsider, since Bigger map size means bigger download time, certain maps may grow bigger than others depending on their object data, so you have to double check if the extra size isn't causing a download time increment bigger than the loading time reduction.

Optimizer seems to decrease loading time a little after Widgetizer, but consider that the difference (2 seconds) is not meaningful and that it is in the Error range of the test. I used an external timer for that and because of lack of time I only did one test per version of the map. It should have sense that Map optimizer decreases loading time though, because of the Script optimizations.

The loading time of my map seems to be big after both optimizations, it is because those optimizations are based on object data (both the strings optimization from the Optimizer and what the Widgetizer does) , my map has thousands of lines at map initialization to declare values of spell templates, horadric cube recipes and other stuff.

### Error Messages:

- I/O Exception, unable to open file, and similars, The file you want to replace is currently opened by another program, or your disk is damaged.
- Too Much lines on file : Certain obfuscation methods have a limit of JASS lines in the file, the actual value is 30000 lines, I don't think a map script with more lines than 30000 will ever appear, but in case your map script has more than 30000 lines, tell me so I can increase the value (thus making the program use more memory)
- Merge Error: Function to merge never ends! : the map script, either because of the original file or may be the obfuscation methods made before, doesn't have its correspondant endfunction, If you are using a map script this shouldn't happen, in that case I'll ask you to send me your map script (just the script not the map) , to see what is happening.
- Other error messages: Please report them.

### Map Optimization Options:

#### Options that require Map MPQ reconstruction:

Using any of these options will force the optimizer to rebuild the map's mpq. Keep in mind that it means that the optimizer needs to know all the paths of the files in the map to prevent losing them. World Editor automatically adds a (listfile) to the map that points to every file in the mpq, but if you happen to have removed it you will have to use an Auxiliar Listfile (see bellow).

- Zlib Deflate.- will recompress the files listed in the mpq using the ZLIB deflate compression, should save some Kbytes.
- Buffer Size.- The entire map mpq using a new buffer size, the biggest the buffer size is the more ram the game will require to decompress it and the least space the map will need, Blizzard's favorite buffer size is 4096 bytes, and the recomended one is 65536 bytes, bigger buffer sizes may work, though they might be risky but they are worth a shot none the less. At this moment I would say that the Auto detect option is the best for you, unless you want to test other values by yourself.
- Mantain (attributes) .- The (attributes) file is a protection used by the game to know if a map's data is phisically correct contains CRC32 for each file and also a registry for file adittion times. Normally the optimizer and other tools remove this file to avoid the process to update it, but you might want to keep it to have its phisical damage detection ability, I also think that the fact that TFT maps may just not have this file is a bug and blizzard may fix this bug everytime, so you can make the optimizer add this file (takes some bytes) .

#### Auxiliar ListFile:

In the case your map's mpq doesn't have a correct listfile (you should know about this in that case, if you are totally clueless about what I am talking about then you probably don't have to use this option) Use this option to give the optimizer an external listfile to be able to browse the map's mpq, and more importantly, be able to rebuild the mpq without losing any file when using ZLIB deflate, Buffer Size or Mantain (attributes).

#### Miscelaneous Options

- Also optimize other script files.- Will check all of the files listed in the listfile that have the .j, .ai or .pld extensions, then will remove comments and useless spaces from them. This is useful when you have a custom blizzard.j, an ai scripts or preloading batches in your map.

- Optimize String usage.- This will move the strings from the WTS file into the files that use them, If you have a map with long loading time and lots of abilities / units / items and-or upgrades , this option will improve loading time a lot and also reduce some map size.

  - Remove editor suffixes.- The playable version of your map doesn't really need the editor suffixes anyways, use this option to remove the editor suffixes from the object files and save some kilobytes. This option requires "Optimize Strings".

- Clean BLPs.- JPEG based blp files often have a bunch of unnneeded 0 bytes after the JPG header, this option just browses the map for BLPs and cleans those 0 bytes (It also needs to change other zones of the blp file to make it work) This method takes like no time, and depending on the quantity of blps in your map it may decrease 3KB or 17KB (This won't affect the quality of the blps)

#### Extra cleaning options

These options are probably the ones that offer the best reduction in map space, but they have some secondary effects like making the map not open correctly or with loss of data in World Editor. Because of this most people call these options "Map protection".

- Clean SLKs.- This was initially meant to save some map space, but the mpq compression is so good that it would only save some bytes even if the SLKs' size is halved. If your map uses SLKS, (for example you widgetized it) this option will clean the slks removing the values that don't really have to be in the slks (zeros, "-", Editor-Only stuff) But it turned out to decrease loading time.

- Remove editor suffixes.- More info above.

- Remove Editor-Only Files.- Will remove all the files that are only needed by the world editor. This will save a bunch of map space.

- Remove as much WE-only data as possible.- Makes the optimizer remove even more data than 'Remove Editor-Only Files' alone, it saves ~0.1 extra kilobytes but it causes World Editor to crash when opening the map.

## Script Optimization Methods

The script optimization methods are the feature that makes this program unique, they have 3 important objectives:

1. Reduce map space
2. Improve Performance
3. Screw GUI reconstructors.

The map's script is a huge jass file that contains most of your map's information, including what people call triggers and also the unit placement, the player configuration, item tables and a lot of related stuff, the map script is run when you open your map, so changes done to the map script affect the overall performance of a map.

When the files containing the descriptions for unit placement and the triggers that are used by World Editor are removed, world editor is unable to open that map, but the map can still be played by warcraft III since that information is contained by the map script.

Very old tools, designed against the simple "map protection" scheme of just removing those files use the map script to rebuild the information for unit placement and GUI triggers from the map script. But these script optimization methods change the pattern of the script effectively disarming these tools.

It is not a certainty that no GUI reconstructor will be made that is able to reconstruct GUI code from an optimized script. But GUI is unnecessary to edit a map, the maps script can be edited directly in a more straight forward way, thus it is unlikely there would be any development on improving those programs since they are not needed, nobody wants to waste compiler time.

The improvements on speed and file size are usually easy to notice, and remember that you can always use these methods and leave the "extra cleaning" methods unchecked, so it would improve your map's performance even if you still want people to see the complete source of your map, I often use these options before releasing a demo map, since it improves their performance.

### Remove comments and useless spaces

This option is always enabled, performs some basic normalizing on the script so it is easier for the other methods to do their work, the result is a much smaller map script, which results in an smaller map as well.

It basically removes comments, and plenty of whitespace characters that are not needed by the script, also uses minimal representation for linebreaks inside strings, instead of escaped line breaks.

### Optimize script

Enables the various script optimizing methods involved within the optimizer, most of them change patterns, all for looking for the smallest and fastest version of what your map's script does.

### Compress names

This enables a very important method that replaces the names of functions and variables in the script with smaller ones, in order to prevent issues like syntax errors the optimizer needs to know what common.j and blizzard.j files your are using (do not worry, if you do not know what these files are then you are using the default ones that come with warcraft III), because of this reason you first have to specify the path to war3patch.mpq before being able to enable this method.

War3patch.mpq is simply the mpq file that contains the latest versions of common.j and blizzard.j and it is always in your warcraft III folder.

Use the war3patch.mpq section to browse for the location of war3patch.mpq by clicking the [Browse ...] button.

In case you are using custom common.j or blizzard.j files for your map, it is your duty to specify so. The tweaks dialog contains a section that allows you to browse for them.

### Enable [map-script-only] optimizations

This option is automatically enabled when you are optimizing a map, if you are optimizing a single script file then you would have to enable it if it is a war3map.j kind of file

This option is just an extension to [Optimize script] in which it tells it that it is able to use certain methods that should only be used on that kind of script file.

### Tweaks

Script optimization is tricky, there is a possibility in which a certain method is broken, although the possibility is small, the possibility exists. It is convenient to be able to disable some of them while enabling the rest in order to prevent malfunction.

Most of the times you should not care about tweaks unless you are an advanced user or you are having problems with the result map, again, these issues are very rare, do not panic

But you would certainly need to use the common.j/blizzard.j tweak if you are using custom versions of them and plan to use "compress names".

#### Tweaks - disable

Disabling certain script optimizing features is sometimes needed, and sometimes is a good idea when you know what you are doing. The next are descriptions of what each method does, checking one of the checkbox will disable that method, thus it will prevent the processes descripted here to happen.

- Init function merge: This is a method that inlines initializng functions saving some space and function calls during loading time.
- Global init merge: This method moves some initialization of GUI global variables to the main globals block.
- AntiBJ: This method replaces some calls to some blizzard.j functions with calls to the original natives.
- BJ optimize: This is one method you might like to disable, it replaces some BJ functions with better versions that do not leak or are much better. But this method may add unneeded extra map size if you usually do not rely on BJ functions.
- Garbage removal: This method simplifies the script replacing some unnecessarily long code with smaller code.
- Constant inlining: This method inlines constant variables and some of the constant functions in order to save size (most of the times) but the bigger impact is an improvement in performance, although this method will not have any impact unless you use some advanced Jass spells or systems.
- String identifier support:. Disable this if you are sure your map does not use ExecuteFunc, it would improve the performance of [compress names] If you do not even know what ExecuteFunc is then you should not disable it.

#### Tweaks - Number-size rawcodes

This will convert rawcodes into number literals, why should you use it? I don't know, but it was requested by someone and thought it was easy to add.

#### Tweaks - Charmap

[compress names] Uses a charmap to generate new variable names, you can change the charmap used, the usefulness for this feature is null, but you can have fun obfuscating the script file, like for example use "O0Il" as charmap and see what kind of variable names it generates

#### Custom blizzard.j and common.j

See compress names for more info.

#### Consider real var events

This option has been removed, now the optimizer will decide whether to consider these events or not automatically. See compress names for more info.

## Command line

Because people kept asking, since version 4.7 the optimizer can be called from the command line, to allow some automatization. This is the list of command line arguments:

        vxjwtsopt.exe [--checkall] [--checkmapstuff] [--checkscriptstuff] [--checkcrash] [--tweak <path to tweaks file>] [--listfile <path to list file>] [path to input file] [--do <path to output file>] [--exit]

It is currently a little limited:

- path to input file Just including a file path without using any other option for prefix will make the optimizer open a map for input.
- --checkmapstuff This one will force the optimizer to check all the map related options (uses previous configuration otherwise). The options checked by this include AUTODETECT for new buffer size, zlib compression, slk optimization, and all the options that would optimize a map without making it unopenable by WE.
- --checkscriptstuff Will force the optimizer to check all the script optimization options (uses previous configuration otherwise).
- --checkcrash Will force the optimizer to check all the options that are on the [Extra cleaning] group. Basically all the options that make the optimizer remove WorldEditor-specific data, the map will crash after opening it in world editor.
- --checkall It is the combination of --checkmapstuff, --checkscriptstuff and --checkcrash.
- --tweak path_to_tweaks The optimizer will load the specified tweaks file, as generated by the tweaks dialog's save button.
- --listfile path_to_list_file Specifies a custom listfile.
- --do path_to_list_output Specifies an output file and starts the saving process, requires you to specify an input file name.
- --exit If --do is not in use, jasshelper will exit with error code 1, otherwise the optimizer will exit once the process started by --do is complete, if there is an error during the process, the program's error code is also 1. Notice that this option is not allowed to specify files that already exist, if you are trying to call the optimizer from an script and want to overwrite files, you can always delete the file at the output path before calling the optimizer.

An example:

        vxjwtsopt.exe in.w3x --do out.w3x  --checkall --exit

It will make the optimizer optimize the file in.w3x using all the necessary options, once the optimizer saves the file out.w3x, the program will end.

## Final Notes:

- This is not a 'map protection' program, besides the fact that map protection and map unprotection are myths, This is a program which main objective is Map Optimizing and beating GUI reconstructors which are an awful aberration.
- The program used to come with the source code, but not anymore, the reason is that I got tired to keep sorting out the source code files into rar files, it is kind of an annoyance after so many versions. And I don't think anybody actually found the code useful at all. IF you'd like source code request it by email.

## Credits and special thanks

Program Author: Vexorian (V�ctor Hugo Sol�z K�ncar)
Uses the wonderful SFMPQ.DLL Library by ShadowFlare

Special thanks to:
- Pitzermike and StarcraftFreak for the huge help they gave me about mpq manipulation.
- BlackDick for helping so much.
- AIAndy for keeping updating pjass which helps testing and finding bugs with the obfuscation methods.
- Zoar for telling me about the fact that blizzard uses UTF8
- IceFrog, PantoCrator, eScpy, Tyler Blank, ArcanisteR, Karukef, Archael, ShadowWolf, ShofetHaolam, Gotenkz, Hexenlord, Sud, adjack, grim0001, Martin luccanera and many more for helping me find and fix bugs.
- BlackDick (again), DJBnJack, PitzerMike (again), StonedStoopid, Ziutek and most specially Zepir for the War3 file specifications document.

## In the future :

- Support for war3map.wts with different locale ids.
- More Obfuscation methods will keep getting released.
- Make Anti BJ also replace the functions that just swap the arguments' positions for functions that have 3 arguments, and for function return values.
- Add an option to change the quality of the minimap image.
- Options for campaign file optimizing will be added.

## Legal stuff

I found out that you can copyright maps and files inside maps according to the EULA so some stuff about using this optimizer and licensed stuff:

- I, vexorian grant any ownership of files modiffied by the optimizer like maps, their slks and their scripts to the original authors of them. In other words you can copyright stuff optimized by the optimizer, as long as it wasn't copyrighted before, in that case it is still the original owner's property as long as it doesn't have any modiffication clause, in that case using map optimizer is not allowed.

## Version History

    5.0:
    - Fixed a bug that caused an arbitrary mod limit in the object optimizer.
    - The optimizer will no longer ignore the tweak to disable BJ optimize (BTW,
      This script tends to be the root of all "map does not work" bugs, so it is a good
      thing that it is possible to disable it again).
    - Fixed a bug that made map scripts with native declarations fail after the short names
      obfuscation executes.

    4.9:
    - Theorically fixed a patch 1.24-related bug that could make some few GUI maps incompatible with patch 1.24.

    4.8:
    - Better number literal optimization may reduce filesize slightly better than the previous version.
    - The optimizer is now more agressive when adding safety !=null stuff to prevent the IsUnitType bug. This might increment some maps' bits after optimizing but will greatly reduce the risk of this problem (in fact, it might actually stop happening).
    - The Enforce IsUnitType safety tweak is not ignored anymore, ironically, due to the above change it may not be necessary anymore.
    - Fixed "init function merge" causing compile errors if there was a function with only local variables.

    4.7c:
      - Fixed a major bug with init Merge on certain maps doing more than usual inside InitTrig.
      - The tweaks "Disable:" frame now says "Avoid: (Check to disable)".

    4.7b:
      - Fixed a major bug with EnumDestructablesInCircleBJ and BJ optimize, often reported as &aquot;compress map names makes my map lag like hell&aquot;.
      - Fixed a minor memory leak possibility in replacement for EnumDestructablesInCircleBJ.

    4.7:
      - Fixed a memory leak and probable crash with a mpq-file-reading function.
      - Fixed a bug that could come in Merge Init functions in certain maps that were compiled using jasshelper's inline optimizations.
      - The [Merge Init functions] should be more effective and able to avoid more problems.
      - Maps using TriggerRegisterVariableEvent will automatically get an all caps charmap for name compression.
      - Command line gibberish.

     4.6
      - Bugfix: Constant variable inlining conflicting with local declarations using the same variable name.
      - Bugfix: Unfortunate constant variable double inline (constant integer A=1, constant integer B=A, set x=B).
      - Feature: Compress map names uses real variable protection automatically if it finds a call to TriggerRegisterVariableEvent.

     4.5:
      - Fixed yet another bug with  EnumDestructablesInCircleBJ and BJ optimization.
      - Can save tweaks again.

     4.4:
      - Fixed issues with strings that contained the number 5.
      - Fixed a dangerous bug with the BJ optimization in some maps that used EnumDestructablesInCircleBJ.
      - Added a tweak to turn rawcodes into numbers.

     4.3:
     - Fixed an issue with strings in the script that were formed of digits or _, again.
     - Fixed an issue with the optimizer replacing \\ with \" (or viceversa) in strings.
     - Fixed a bug regarding possible malfunction after inlining real constants that did not specify a real initial value.

     4.2:
     - Fixed an issue with strings in the script that were formed of digits or _
     - Fixed jass compile error in maps that used EnumDestructablesInCircleBJ

     4.1:
     - Readme updated
     - Changed the interface a lot.
     - Fixed a bug with 'Compress names' a.k.a "Shortest names as possible" that was potentially dangerous for scripts with a lot of globals. (A LOT of globals)
     - Fixed a bug with the globals merger that could have arised issues with global variables with initialized values.
     - "Compress names" will now automatically use an upper case charmap
     - Added tweaks dialog containing the usual things to disable certain methods or to allow some of the formerly known as "non-recommendable" checkboxes.
     - Improved size reduction for basic obfuscation on certain specific cases.

     4.0 :
     - Kind of updates in the readme.
     - Added "Inline constant globals" method.
     - "Look for other scripts to obfuscate" renamed to "Other scripts opt"
     - "Other scripts opt" can now optimize .pld files as well.
     - Added option to remove extra .j files found in the map.
     - "Make sure to clean every unused function/variable" renamed to "Recursive cleaning"
     - No longer has a chance to add 3 utf8 characters at the top of the map's script.

     3.9d :
     - Improved the loading time of external list files, it will also not freeze the PC when the listfile is really big.
     - Fixed various bugs with gamecache function optimization.

     3.9c :
     - Fixed a bug with Anti BJ that replaced GetAbilityEffectBJ and GetAbilitySoundBJ incorrectly.
     - Fixed a bug with remove useless code that had a chance to cause bugs if a typical gamecache
       init function was called without using it as an expression but with the call statement
     - Removed some '}' debug messages.
     - Fixed a graphical glitch.

     3.9b :
     - Fixed a bug with Safe IsUnitType not working correctly sometimes and making the map fail.
     - Fixed a bug with 'Remove editor suffixes' it had a chance to make an ability malfunction If its only modified field was
       the editor suffix
     - Improved the 3.9 feature of optimizing gamecache functions a little.
     - Checked state of 'Not recommended' options will no longer get loaded.
     - It will always save a script file with the same name as the target map but will end with .j that will
       show the resulting script used by the map. This will save some time to the guys that like to check the
       resulting script file after optimizing.
     - 'Remove useless code' now removes some dummy order commands generated by the world editor in the preplaced
       unit creation area

     3.9 :
     - Fixed a bug when strings with a \ followed by a " were present
     - Fixed various grave bugs with Shortest Number representations and Shorter variable names possible concerning ' notation.
     - "Make sure to clean every unused function/variable" Is now way faster than before.
     - "Shortest variable/function names possible" Will no longer automatically consider names of real variables as possible
       identifier names to be used as strings. To make it consider real variables for strings,  a new option called
       "Script uses real variable value events" has been added�
     - Fixed a chance the optimizer had to not add one file to the new map under certain circunstances.
     - 'Remove useless code' now also optimizes gamecache based systems that use an extra function to automatically setup
       their gamecache variables.

     3.8b:
     - Fixed a bug with optimizer not being aware that functions might have extra spaces before their argument lists, and this
       caused a probability for map optimizer to fail.
     - Added a Safe IsUnitType option to let it fix IsUnitType bugs even i the most extreme cases (but it hits performance
       a little I advice against using it unless there are problems.

     3.8 :
     - Fixed a bug that was making the optimizer create 2 files: c:\i.mpq and c:\h.mpq for no reason at all. The
       contents of those files were the original and optimized versions of the map.
     - Fixed a bug with 'Remove Useless Code' that made maps fail when optimized when they had and else before
       an endif just before a line that uses a constant function that didn't take arguments.
     - AntiBJ now changes GetUnitAbilityLevelSwapped to GetUnitAbilityLevel as it was supposed to do.
     - The result map / script now uses 1 character to break lines instead of 2. This saves a pair of kilobytes in maps with big map
       scripts.

     3.7 :
     - Fixed a bug with Merge initializations that could move to the global declaration a value that wasn't
       declared yet and cause script errors.
     - Fixed a bug with the selection of script files that choose commonj twice instead of considering blizzard.j
       which makes me wonder if anybody actually used that option.
     - It is finallly possible to use an auxiliar listfile to help the optimizer browse the map's file.
     - Added an option that allows you to update/create the (attributes) file.
     - An inescrupolous party has been calling the "Make world editor Crash" option a "Map protection", and were
       making "gosu 1337" map unprotection tutorials to get rid of that "Protection" so I just changed the name
       of that option to "Remove As much WE-only data as possible" with a warning that it will cause World Editor
       to crash when openning the map file.
     - Added a "Keep dummy war3mapunits.doo" option that allows the optimizer to keep a dummy war3mapunits.doo
       in the map when using "Remove As much WE-only data as possible" , this is to prevent wc3sear.ch's map
       upload script to mark the map as 'Corrupted by a Third party software'.
     - Various interface changes.
     - Improved the formatting of the readme.html file

     3.6 :
     - "Merge Initialization" , now saves even more script size and its merge globals process got a speed boost.
     - "Optimize BJ functions" now also fixes a leak on GetCurrentCameraSetup and Adds a faster version of
       PolarProjectionBJ.
     - "Clean slks" no longer removes the special classification of units, cause it is actually considered by
       the "Random Creep Unit Type" function.
     - Added "Force Upper Case" option to "shortest variable/function names possible" it should be used to fix
       a very rare bug that may happen in some maps when using that method.

     3.5b:
     - Fixed a chance to LOSE the script file of the map when optimizing widgetized maps, this seems to have
       been caused by a SFMPQ.DLL bug with listfiles when you make plenty of modiffications, or something like
       that.
     - Nothing else besides some minor updates on the readme, Download this version only if you had problems with
       widgetized maps, It might not solve every single problem with widgetized maps, but at least it fixed the
       ones presented in 2 maps I got. More minor updates might be released in the near future until I am sure
       every single bug with widgetizer is fixed.

     3.5:
     - Added 'Keep "Open Source"'  option for Remove Editor Only Files.
     - Fixed a bug with "Remove Editor Only Files" making the optimizer freeze and create a big map file when
       being used on ROC files , special thanks to ShofetHaolam for reporting it. I forgot ROC maps when testing
       this feature, sorry.
     - You can now open the readme file from the about dialog.
     - Fixed a bug with "Merge Initializations" not merging functions that were empty.
     - "Shortest Number Representations" no longer requires you to use "Shortest Variable/function names possible"
       and is also used by "Look for other files to obfuscate"

     3.4b :
     - Fixed a deadly bug: Remove "World Editor only files" was removing some data required in multiplayer!
     - html readme

     3.4 :
     - Fixed a tricky bug that had a chance to appear when using 'Conditions' or 'Remove useless code' , the bug
       was actually blizzard's fault and was really tricky.
     - Fixed bugs with clean BLPs option.
     - Fixed 'Remove Editor only files' not removing the listfile when Buffer size or zlib weren't used.
     - 'Remove Editor only files' now removes the WE data fro item/unit tables, forces, upgrades and ability
       availability.
     - Changed the way 'Make world editor crash' works, it no longers turns the map into an infinite loop but it
       adds less space.

     3.3 :
     - Added clean BLPs option.
     - Script optimization removes a lot of more useless spaces than before.
     - Fixed a bug with Remove Editor Suffixes, in some rare situations it could disable an ability. It was
       actually blizzard's fault and seems to be caused by a change in patch 1.18.
     - Fixed various bugs with the "Conditions" method.
     - Improved "Conditions" method now avoids to add unnecesary parenthesis/spaces.
     - Fixed a logic flaw that was making the "Shortest names possible" work only if the "Make sure to clean
       every unused function" method is checked. And it stopped the map from working if you checked the
       Optimize BJ functions method.
     - Merged the "Merge" obfuscation methods (Merge initialization functions, merge global initializations and
       merge arrays init) into one method called "Merge initializations".
     - Fixed a bug wit the "Shortest names possible" method combined with functions that had local variable names
       that started with array, causing map corruption (This is the kind of bug you would only note when optimizing a WEU map)
     - Fixed a bug that was disabling the optimizer to fix a map correctly if it didn't have a war3map.wts (Mostly
       the case of a special kind of widgetized map)

     - By popular demand added "Make World Editor Crash" option.

     3.2 :
     - New Script Obfuscation Method : "Shortest Number Representations"
     - Fixed a bug with the "Optimize BJ Functions" method that was literally crippling the purpose of the
        enter/leave rect(region) registration functions.
     - Optimize BJ Functions optimizes the CountLivingPlayerUnitsOfTypeId function to a really improved
       version of it.
     - "Merge initialization functions" now also merges InitTechTree and InitUpgrades.
     - Remove useless code also removes !=false

     3.1 :
     - New Script Optimization Method: "Optimize BJ Functions"

     - Fixed Merge Globals obfuscation method, now it avoids merging values that shouldn't be merged (like bj
       variables that were not initialized)
     - "Remove useless files" and "Remove unit position data were merged" into Remove Editor-Only Files.

     3.0b :
     - Fixed the damned crash

     3.0 :
     - Fixed a lame bug with map scripts that had strings that were x and some number (for example "x3")
     - Fixed a bug with Clean SLKs when reading SLKs that were made using Microsoft Excel.
     - Fixed a bug when optimizing strings and certain interface error messages.

     2.9 :
     - Fixed a bug with the script loader and AntiBJ combined that sometimes stopped the map from working.
     - Fixed a bug with AntiBJ actually stopping the Set Unit Ability level function for GUI from working at all.
     - String Optimizing / Remove editor suffixes should work for object strings files too.
     - New Script optimizing method: Option to make sure to clean every unused function/variable.
     - New Map optimizing option: SLK cleaning.
     - Fixed some typos in this file.

     2.8 :
     - Works on Widgetized maps without halting now.
     - Fixed bugs with scripts that had \\ at the end of strings.
     - Conditions obfuscation method is faster.
     - No longer loads the map script again when using the 'shortest' obfuscation method
     - Fixed a bug that was reducing compression ratio a lot and was kind of lame, the script file was getting duplicated? , and even worse the duplicated was the unobfuscated version.

     2.7 :
     - Fixed major bugs with maps that had scripts that used /" inside strings.
     - Fixed a bug with shortest variable/function names possible combined with conditions obfuscation
     - Will now consider the strings used on war3map.wtg and war3map.wct in case protection and map preview are unchecked.

     2.6 :
     - New map optimization option that allows to move the strings from the wts file into the files that use them, this is effective for reducing loading time and also allows you to remove the editor suffixes to save some extra kilobytes.
     - Rebuildin the map with new buffer size or making Zlib compression should be much faster now.
     - Simple string file optimization is much faster.
     - Fixed a bug when copying the map, was copying the map twice, so it halved the time used for that.

     2.5 :
     - New important obfuscation method that replaces the names of variables/ functions in the map with really small names, this makes the map smaller and much faster.
     - Fixed a small bug, maps would generally lose some extra bytes now.

     2.4 :
     - AntiBJ and remove useless code now optimize patch 1.18 stuff.
     - Compatibility with other languages, again.
     - Now uses the right places to save options and temporal files (Would fix problems with user restrictions and that stuff in some windows versions)

     2.3 :
     - Fixed a horrible bug that would cause total corruption when you had a comment with a " inside in your map.
     - Fixed a with codifications that inserted '?' signs at the start of the maps.
     - Fixed a bug with 'AntiBJ' not working in certain situations
     - Fixed a bug with 'Merge array initializations' not working in certain situations

     - It will tell you how much bytes it saved besides of the percentage now.

     2.2 :
     - Fixed a horrible bug that happened when a string finished with a carriage return in the JASS script, making the program to 'eat' some of the remaining code.
     - There was a chance of odd I/O errors on certain maps, that was fixed.
     - Fixed a bug with the merge array initializations method.
     - Hopefully now works 100% allright with maps that use 'Foreign' characters. The only way to test this I had was the � I had from spanish, but it should work with the other languages.

     - Added AUTODETECT to the buffer size level option, and fixed a bug with it, (it wasn't actually using the values you wanted).
     - Merged the Constant function purge method with the remove useless code method.
     - The Remove Useless code method will also merge variable sets with function calls.
     - AntiBJ now deals with calls to BJ swapped functions.
     - The merge array initializations method is now incredibly fast, so fast that in most of the cases you don't even note the moment it is called.

     2.1 :
     - Fixed an evil bug with the purge constant functions method that was making any map unplayable
     - Fixed an evil bug, yet not that important that was happening with Big script files.

     2.0 :
     - My logic was flawed, again, figured that a function that has a return statement shouldn't be merged, fixed that now.
     - Another Flawed logic issue, it can't just add a -1 to the arguments because it would screw becase * has priority in the evaluation order, if you were having problems in certain triggers and you love using Convert Player to index and the convert index to player, then the cause of that issue was fixed.
     - Fixed another bug with AntiBJ, there was a slight chance that it wouldn't change certain functions.
     - Fixed another problem, the merge array initializations method wasn't actually working if the merge functions option was enabled, now its fixed.

     - Added the Purge constant functions method.

     1.9 :
     - My logic was flawed, I found a big problem with the way I was merging functions with locals, now the initial value of the local variable would be set in the right place (putting it in the declaration would cause problems in certain situations)
     - Fixed a rather small frozen time before starting the global merge method.
     - The merge initialization functions method got a major speed boost.
     - Other methods excepting the Merge Array Initializations and the conditions obfuscation were improved speed wise too.

     1.8 :
     - Fixed a bug that was causing the merge Initialization functions option to make the map unplayable under certain circunstances.
     - Fixed various bugs in the merge Initialization functions options when strings had carriage returns.
     - The "merge global initializations with declarations" options got a major speed boost, used to be the slowest method and now is the fastest, similar improvements will be done with the other methods.
     - Fixed some stuff in the readme file (this file)

     1.7 :
     - The function merge methods now are able to merge functions that use local variables, excepting some weird cases.
     - The function merging methods were all merged into one option, this is because they all use the same function afterall, so if one is bugged all the other ones will too, and it will save you 2 clicking times.
     - More functions are merged, at this time it will end with a gigantic main function that contains everything from global initializations to triggers, including unit creation.
     - Maps that use the Remove weather effect action, can now use Anti BJ without problems, in other words I fixed the bug with Anti BJ.

     1.6 :
     - Fixed a bug with the conditions obfuscation method, thanks Karukef for the feedback that helped finding it.
     - Fixed problems with "foreign" characters , thanks a lot to Zoar for this.
     - Reorganized the form so the status label has more space to show information.
     - Hopefully no longer leaves any temp file.

     1.5 :
     - Now you can open map files directly, and the program will automatically fix the strings and obfuscate the script of the map.
     - Also added some map optimization options like changing the buffer size, forcing zlib deflate, and removing useless files, you can get really incredibly file size compression now.
     - The Interface was changed somehow now that it can open maps too.
     - Now the program is called wc3 map optimizer.
     - Script and Wts file fixing without changing the map are still possible when you open that kind of files.
     - Global initialization merge was fixed due to a lot of glitches that certain types cause, even if the map compiled well, now it would only merge certain types or any variable that is initialized with null.
     - Global initialization merge also works with sounds now.
     - Updated AntiBJ, does its work with more functions, and the new BJ dummies that came with 1.17
     - Added The Conditions Obfuscation Method.
     - You can now associate script files or maps with this program.
     - Temporal files are now created on the same directory of this program.

     1.1 :
     - Added the "Merge Global Declarations with initializations" obfuscation method.
     - Added the "Merge Array Initializations" obfuscation method.
     - Added the "Remove useless code" optimization method.

     - Added a check/uncheck all check box, since the options are already too many.

     0.9 :
     - JASS script obfuscating no longer ignores tabs.
     - Added 3 new obfuscation methods based in merging the initialization functions into a giant one.
     - Array brackets are now considered operators as they are supposed to be, so the problem with stuff inside array brackets not being fixed is solved.
     - Fixed a bug in the Anti BJ, was causing it to fix strings instead of non strings after certain circunstances.
     - Anti BJ no longer leaves a temp file.
     - Anti BJ now also replaces the GUI get player number with the native one +1 (so it takes less space)
     - String File Fixer now makes sure it is not removing lines inside the strings.

     - The program now tells you how much the file size was reduced.
     - Added a progress bar, new obfuscating methods were too time consuming for me.

     0.3 :
     - Added the Anti BJ obfuscation method, still at beta stage so it can ruin your map, my tests of the method didn't show problems though.

     0.2 :
     - I recently discovered that strings might have a weird behaviur in JASS syntax, and this program wasn't aware of that either, just fixed it, so there aren't bugs with strings that have carriage returns inside.

     0.1 :  (first version)