| Home Page | Recent Changes | Preferences

Commandlet

UT / UT2003 :: Object >> Commandlet (Package: Core)

UnrealScript Commandlet (command-line applet) class.

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

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

for example:

 UCC.exe Core.HelloWorldCommandlet
 UCC.exe Editor.MakeCommandlet

In addition, if you list your commandlet in the public section of your package's .int file (see Engine.int for example), then your commandlet can be executed without requiring a fully qualified name, for example:

 UCC.exe MakeCommandlet

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" onto the name and tries again. Therefore, the following shortcuts perform identically to the above:

 UCC.exe Core.HelloWorld
 UCC.exe Editor.Make
 UCC.exe Make

It is also perfectly valid to call the Main method of a commandlet class directly, for example from within the body of another commandlet.

Commandlets are executed in a "raw" UnrealScript environment, in which the game isn't loaded, the client code isn't loaded, no levels are loaded, and no actors exist.

You can load objects from packages. (e.g. levels, sound packages or code packages, this includes actors used in maps) However, you can only create non-Actor objects because otherwise UCC exits with a general protection fault since there's no level to put the actor in.

This example loads a map and prints out the map's name and author:

class SandboxCommandlet extends Commandlet;

function int Main(string TextParameters) {
  
  local LevelInfo LevelInfo;
  LevelInfo = LevelInfo(DynamicLoadObject(TextParameters $ ".LevelInfo0", class 'LevelInfo'));

  Log("Information about" @ TextParameters $ ":");
  Log("  Title: " @ LevelInfo.Title);
  Log("  Author:" @ LevelInfo.Author);
  }

Output:

> ucc Sandbox.SandboxCommandlet CTF-Face

=======================================
ucc.exe: UnrealOS execution environment
Copyright 1999 Epic Games Inc
=======================================

Executing Class Sandbox.SandboxCommandlet
Information about CTF-Face:
  Title:  Facing Worlds
  Author: Cedric 'Inoxx' Fiorentino

Properties

string HelpCmd (localized)
Command name to show for "ucc help".
string HelpOneLiner (localized)
Command description to show for "ucc help".
string HelpUsage (localized)
Usage template to show for "ucc help".
string HelpWebLink (localized)
Hyperlink for more info.
string HelpParm[16], HelpDesc[16] (localized)
Parameters and descriptions for "ucc help <this command>".
bool LogToStdout
Whether to redirect log output to console stdout. (default is true)
bool IsServer, IsClient, IsEditor
Whether to load objects required in server, client, and editor context. (default is true for all)
bool LazyLoad
Whether to load objects immediately, or only on demand. (default is true)
bool ShowErrorCount
Whether to show standard error and warning count on exit. All calls to Warn() and certain calls to Log() are counted as warnings, e.g.:
log("a warning", 'Error');
log("another warning", 'Warning');
warn("and another one");
(default is false)
bool ShowBanner
Whether to show Unreal banner on startup. (default is true)

Methods

int Main(string Parms) (native)
The main function. Put your code here. (This function is only declared as native event, not as final.)

Sample Commandlet

This is an example included in the Core package of UT.

//=============================================================================
/// UnrealScript "hello world" sample Commandlet.
///
/// Usage:
///     ucc.exe HelloWorld
//=============================================================================
class HelloWorldCommandlet
    extends Commandlet;

var int intparm;
var string strparm;

function int Main( string Parms )
{
    log( "Hello, world!" );
    if( Parms!="" )
        log( "Command line parameters=" $ Parms );
    if( intparm!=0 )
        log( "You specified intparm=" $ intparm );
    if( strparm!="" )
        log( "You specified strparm=" $ strparm );
}

defaultproperties
{
     HelpCmd="HelloWorld"
     HelpOneLiner="Sample"
     HelpUsage="HelloWorld"
     HelpParm(0)="IntParm"
     HelpParm(1)="StrParm"
     HelpDesc(0)="An integer parameter"
     HelpDesc(1)="A string parameter"
}

You can run this commandlet with:

 UCC Core.HelloWorld intparm=123 strparm=bla bla
 UCC Core.HelloWorld intparm=123 strparm="bla bla"

Note: The first one returns only "bla" as strparm, the second one prints out the full string.

Known Subclasses

UnrealScript Commandlets

(not available in UT2003)

  • HelloWorldCommandlet – example commandlet (see above)
  • SimpleCommandlet – a test commandlet

Native Commandlets

  • BatchExportCommandlet – exports objects from packages
  • CheckSumCommandlet
  • ChecksumPackageCommandlet
  • CheckUnicodeCommandlet
  • CompressCommandlet
  • ConformCommandlet – used to make packages network-compatible
  • DataRipCommandlet
  • MakeCommandlet – Compiles UnrealScript sources to .u files
  • MasterCommandlet – can be used to build UMOD installer files
  • MasterServerCommandlet
  • MergeDXTCommandlet
  • PackageFlagCommandlet
  • PS2ConvertCommandlet
  • ServerCommandlet – Runs a dedicated server
  • UpdateServerCommandlet
  • UpdateUModCommandlet – can list or modify the content of a UMOD file

UT2003 Only

  • AnalyzeBuildCommandlet – prints out the content of all packages (only execute if you have lots of time ;))
  • AnalyzePackageCommandlet – prints out information about memory usage of a package (e.g. maps)
  • ConvertMaterialCommandlet
  • DumpIntCommandlet – dumps all localized variables to an .int file (back up the existing .int first!)
  • MasterMD5Commandlet – handles the md5 table for package security
  • UTVCommandlet – used for running a UTV proxy server (requires UTV to be installed, see the [Unreal Tech Page])

(the following are not specified in the .int files, so you need to explicitely specify the package)


Category Class (UT)

Category Class (UT2003)

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In