RANDOM FORTUNE:

Think of it! With VLSI we can pack 100 ENIACs in 1 sq. cm.!

## Compiling UScript in Linux

This howto assumes that Unreal Tournament is installed in a directory named 'ut99'. Wherever you read that, susbtitute it for your real install directory.

This howto should also work with other games using the Unreal engine.

### Tools

First of all, you cannot compile or export UScript with the native Linux UCC. You need the DLLs and EXEs from the Windows version of the game and wine.

For Slackware, see my wine SlackBuild: http://slackbuilds.org/repository/14.2/system/wine/
For other distros, hop over to http://www.winehq.com and look for a package for your distro or else get the source and compile and install manually.

You will also need to be running either a 32bit OS, or 64bit with multilib (sometimes known as compat32) libraries installed. This is because UT was only ever released as a 32bit application.

alienBOB has multilib libraries for Slackware: http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:multilib.

Also, see my helper script to install/upgrade multilb packages http://dawoodfall.net/scripts/slackware/

Once wine is installed, open up winecfg (type 'winecfg' in a terminal) and have a look at your drive letters. The reason for this is we will need to tell wine where UT is installed later on. You may likely need a path like z:\path\to\ut99 or you may want to manually add the partition on the drives tab. E.G. mine is in h:\

(It usually takes a good while for the winecfg window to appear the first time you run it, as it is populating your local ~/.wine directory.)

Next you will need UCC.EXE and the DLLs from the Windows UT disk, so copy them from the CD into your ut99/System folder.

### A Quick Test

cd into your ut99/System folder and type:

wine ucc 2>/dev/null

Output:

=======================================
ucc.exe: UnrealOS execution environment
=======================================

Use "ucc help" for help

The '2>/dev/null' will suppress any wine errors. So long as you get the welcome message above, all is well.

### Exporting Code

The command line is:

wine ucc batchexport <PACKAGE> class .uc <UTDIR>\\<PACKAGE>\\Classes

Substitute <PACKAGE> and <UTDIR> as appropriate. You need double \\ or wine will not find the directories. So for example to export all scripts in the BotPack package do:

wine ucc batchexport BotPack.u class .uc h:\\ut99\\BotPack\\Classes

(Replace h:\\ut99 with the path to UT that you noted from winecfg earlier.)

### The Command Line Explained

'Batchexport' tells ucc we want to export something.
'BotPack.u' is the name of the package we want to export.
'Class' tells ucc that we want class (code) files.
'.uc' is the file extension we want.
'h:\\ut99\\BotPack\\Classes' tells ucc where to save the files to.

After issuing this command you should see a list of classes fly past as they are exported, and then finally at the end:

Success - 0 error(s), 0 warnings

Now we can list the UT directory and check that there is in fact a BotPack/Classes subdirectory, containing all the .uc files. So far, so good.

### Compiling Code

OK, so you have some code that you want to compile. It must be in a subdirectory 'Classes' of a subdirectory of your package name, which is a subdirectory of the main UT directory. For example:

ut99/MyPackage/Classes/MyScript.uc

Also, you must rename/delete the older compiled package from the System directory before compiling, or your new code will not compile.

Next add your package to the bottom of the EditPackages list in UnrealTournament.ini:

EditPackages=MyPackage

Now we are good to go. The command line is:

wine ucc make

Now you should either have a success message, or a lot of errors. If you get errors, ucc is usually kind enough to point you to where they are in the code. If everything went OK you can boot up UT and test your new toy.

### Automating

Wouldn't it be nice not to have to type a whole lot of commands to do this? Yes it would. So I have a few scripts that make decompiling and compiling a lot easier.

My 'uccmake' script:

#!/bin/sh

rm -f /path/to/ut99/System/PackageName.u
wine /path/to/ut99/System/ucc make 2>/dev/null

Now when I'm working on a package I edit the script with the package name, and then I can just run 'uccmake' in a terminal when I need to rebuild it.

I also have a small 'uccexport' script:

#!/bin/sh

wine h:\\ut99\\System\\ucc batchexport $1.u class .uc \ h:\\ut99\\$1\\Classes 2>/dev/null

Typing 'uccexport PackageName' will export the classes for PackageName, passed as an argument to the script. Note that I have used normal Linux paths in one script, and Windows style paths in the other. Using Linux paths has limited success with UCC.EXE, so if one way doesn't work, try the other method.

### Other Resources

Unfortunately, the old beyondunreal Wiki that went into great depth about programming in UScript seems to have gone. You may have some luck on the various internet archives such as the way back machine.

There are still some communities where you can get help with coding though. One of these is ut99.org:

https://ut99.org

You may also find information from the Old Unreal site, although this is more aimed at Unreal 1, the single player version:

https://www.oldunreal.com