Compiling UScript in Linux
Tools That You Need
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.
Head 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: link.
When 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\ut... or you may want to manually add the partition on the drives tab. E.G. mine is in H:\
Next you will need UCC.EXE and the DLLs from the Windows UT disk, so copy them from the CD into your ut/System folder.
A Quick Test
cd into your ut/System folder and type wine ucc 2>/dev/null. You should see a message:
======================================= ucc.exe: UnrealOS execution environment Copyright 1999 Epic Games Inc ======================================= 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.
The command line is:
wine ucc batchexport PACKAGE class .uc UTDir\\PACKAGE\\Classes
You need double \\ or wine will not find the directories. So for example to export all scripts in BotPack do:
Wine ucc batchexport BotPack.u class .uc h:\\ut\\BotPack\\Classes
Replace h:\\ut with the path to UT 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 classes
.uc is the file extension we want
h:\\ut\\BotPack\\Classes tells ucc where to save files to
After issuing this command you should see a list of classes fly past and finally at the end:
Success - 0 error(s), 0 warnings
Now we can cd up a directory and check that there is in fact a BotPack directory with a subdirectory of Classes, containing all the .uc files from BotPack. So far, so good.
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:
Also, you must rename/delete any 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 e.g.
Now we are good to go. The command line is:
wine ucc make
Now you should either have a success message, or a load 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 play with your new toy.
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/ut/System/PackageName.u wine /path/to/ut/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.
I also have a uccexport script:
#!/bin/sh wine h:\\ut\\System\\ucc batchexport $1.u class .uc \ h:\\ut\\$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.