Generating Compiled Scripts

From Mod Wiki

Overview

Compiled scripts are automatically generated from the game's interpreted script files. They use less memory, and run more quickly than interpreted scripts. Interpreted scripts have the advantage of quick turnaround when developing. For a final release of a mod, you should consider using compiled scripts.

Exporting the Scripts

Start the game up, and when it has finished loading and you are at the main menu, bring down the console and enter "exportScript", minus the quotes. Make sure to check there are no errors on the console. If there are none, you can exit the game.

This process will have added several .cpp and .h files to "base/src".

Compiling the Scripts

Open the "base/src/base" folder. Inside this folder is a file called "compiledscriptx86.sln", which you can open with Visual Studio.

Once opened, there should be a drop down box on the toolbar, ensure this is set to "Release". After this, select "Build Solution" from the "Build" menu. Once completed the build console should state that is is completed with 0 errors and warnings.

If not, you should seek a programmer's help.The most likely case for this happening is that the project file is out of date when someone has added or removed a script class, but this should not be a common occurrence.

After Compiling the Scripts

Assuming the compile process has completed successfully, you can find your compiled script DLL in base/src/base/build/win32/release/. Copy CompiledScriptx86.dll to your mod's base folder.

Using Compiled Scripts

After you've placed CompiledScriptx86.dll where the game can find it, ensure that g_useCompiledScript is set to 1 before loading a map. The game should automatically load your custom script dll.