Commandlet

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 01:42, 8 May 2010 by Shambler (talk | contribs)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Object >> Commandlet
Direct subclass:
HelloWorldCommandlet
This class in other games:

Commandlets are executed from the ucc.exe command line utility, using the following syntax:

ucc.exe package_name.commandlet_class_name [parm=value]...

As a convenience, if a user tries to run a commandlet and the exact name he types isn't found, then ucc.exe appends the text "commandlet" to the name and tries again. Additionally, typically used commandlets do not need their package name specified. This allows users to just type ucc server ... instead of ucc Engine.ServerCommandlet .... Games that do not come with ucc.exe (e.g. very early Unreal Engine 1 games and any Unreal Engine 3 games) can execute commandlets via the main executable of the game. Unreal Engine 3 may require the parameter run for non-native commandlets, e.g.:

UT3.exe run package_name.commandlet_class_name [parm=value]...

Any param=value options on the commandline are parsed and values for parameters matching variable names of the commandlet class are assigned to those variables.

Important commandlets

BatchExportCommandlet
Exports resources from Unreal packages.
CompressCommandlet
Compresses Unreal packages for redirected downloads.
HelpCommandlet
Displays help for other commandlets. (ucc help commandletname)
MakeCommandlet
Compiles UnrealScript code.
MasterCommandlet
Creates UMOD files.
PkgCommandlet
A tool for editing Unreal packages from the commandline.
ServerCommandlet
Runs a dedicated game server.
UncompressCommandlet
Decompresses files created by the CompressCommandlet.

Native functions

Main

native event int Main (string Params)

Entry point for your commandlet. Override this function without calling Super.Main()! The default implementation of this function calls the native C++ Main() function with the specified parameter string, which in turn calls this UnrealScript Main() function by default, resulting in an infinite recursion.

One might expect the return value becomes the exit value of the UCC process, but it is actually discarded. UCC always exits with code 0 (no error), unless any errors (not warnings) were logged, which causes UCC to exit with code 1. An exception to this is the UDK, which correctly returns the given value.

Parameters:

  • Params - the string containing the parameters for the commandlet