UnrealScript Syntax
Author: Robert J. Martin
This is intended as a quick reference for someone who is very familiar with Java/C++ style OO languages and is at least somewat familiar with UnrealScript in general. In particular, it is directed at those using UScript for academic purposes. I don't go in to a great amount of detail for many things, especially for things found in the UScript reference, READ THAT FIRST!!!. Please Contact me if you see any mistakes, need for extra clarification on anything, or have any contributions to make.
class MyGame expands TournamentGameInfo;
class MyGame extends TournamentGameInfo;
var int myInt;
var int myInt = 100;
example
function myFunction( ) {
local int myInt;
}
x = 0.314
; x = .314
; function keyEvent(Byte key);
function keyEvent(EInputKey key);
string s;
s = "hello";
string s, t;
s = "Rocks";
t = "UT" $s $"MyWorld"; // t = "UTRocksMyWorld"
SniperRifle12
, TMale2
, etc...if (other == 'Commander13') { ... }
var int myArray[10];
var int myArray[x];
Console C;
C = new (none) class 'myNewConsole'; /* instantiate a new Console
of type myNewConsole */
myActor.MoveTo(myAmmo.location);
local Actor A;
A = enemy; //get this classes current enemy pawn
A = PlayerPawn(A); // cast A as a playerPawn.
super(ancestorClass).ancestorVersion( ); // calls the
function of this class's ancestor of type "ancestorClass"
notice that there are no single quotes around ancestorClass
in this context
Actor A; // called from an actor
A = spawn(class 'BoomStick', self, , location, rotation);
var class<Pawn> C; // code from within in an Actor
class
C = other.class; //will return null if not of type pawn.
var( ) int MyInteger; // Declare an editable integer in the
default category.
var(MyCategory) bool MyBool; // Declare an editable integer
in "MyCategory".
if(Actor != none) { ... }
if(Actor) { ... }
if(true) x = 10;
if(true) { x = 10; y = 12; }
int i; for( i = 0; ....)
for( int i = 0; ....)
Actor A;
foreach AllActors( class 'PlayerPawn', A) { //iterate
through PlayerPawns
Log(A.location) // Log their location
}
function bool bNoArgs(int j, string s, Actor A) {
if( (j == 0) && (s == "") && (A == none)
)
return true;
}
}
Class MyClass = MyObject.class;
MyClass.myStaticFunction;
state myState {
ignores Bump;
}
ThisValue=100
ThisValue = 100;
myArray(0)=5
myArray[0]=5
String myClassName = "myPackage.myClass";
Class myClassObject = DynamicLoadObject(myClassName, class 'Class');
baseClass myObject = spawn (class <baseClass> myClassObject);
int myVar = 300;
String sValue = getPropertyText( "myVar" ); // sValue
is equal to "300"
exec function myFunction(coerce string s) { }
bool isFunctionThere; //optional
isFunctionThere = ConsoleCommand("myFunction myArgument");
static final operator(40) XMLObject $ ( XMLObject A , string
B ) { ... }