UnrealScript

related topics
{system, computer, user}
{math, number, function}
{game, team, player}
{group, member, jewish}
{language, word, form}
{rate, high, increase}

UnrealScript (often abbreviated to UScript) is the scripting language of the Unreal Engine and is used for authoring game code and gameplay events.

Similar in basic design principles to Java, UnrealScript has object-oriented features but does not support multiple inheritance: classes all inherit from a common Object class and are defined in individual files named after each class. Unlike Java, UnrealScript is case-insensitive, and does not have object wrappers for primitive types. Interfaces are only supported in Unreal Engine generation 3 and a few Unreal Engine 2 games. UnrealScript supports operator overloading, but not method overloading, except for optional parameters.

The language was also designed for simple, high-level game programming[3]. The UnrealScript interpreter was programmed by Tim Sweeney, who had also created an earlier game scripting language called ZZT-oop.

By making the process of modifying the game easier, UnrealScript helped enable the growth of a large community of people on the Internet dedicated to modifying Unreal. This ability greatly added to the overall longevity of Unreal and provided an incentive for new development.

Contents

Syntax

Code comments

UnrealScript uses two commenting styles, a single-line comment (beginning with // until the end of the line) and a multi-line comment (delimited by /* and */).

// Single-line comment
class Foo extends Object;
 
/* Multi-line
   comment */
var Object Foo;

[edit] Functions

UnrealScript uses functions similar to C/C++. Functions are declared buy the keyword: function, the variable type: int, the name: example_function, and finally the function parameters enclosed in parenthesis: (int example_number).

The body is enclosed in brackets { example_number = 5; }.

Before the final bracket, a return function can be called, returning the a value to the original caller.

function int example_function (int example_number)
{
   example_number = 1;
   return example_number;
}

This function takes the integer example_number, changes its value to 5, then returns its value to the caller.

[edit] "Hello, world" example

The following is a hello world example using the syntax of UnrealScript.[4]

class HelloWorld extends GameInfo;
 
event InitGame( string Options, out string Error )
{
    `log( "Hello, world!" );
}

The following text will be printed to the output console when HelloWorld is initializing:

Hello, world!

[edit] See also

[edit] References

[edit] External links


Full article ▸

related documents
Numbering plan
Foobar
Shotgun debugging
ObjectPAL
Object-oriented programming language
Steelman language requirements
Kilobyte
SuperMemo
Facade pattern
CORC
A-law algorithm
BIND
Input
Java Development Kit
Quick-and-dirty
Unavailability
Yacc
Typed link
Small-C
Djbdns
Metaphone
Structure and Interpretation of Computer Programs
Java Transaction API
Warchalking
Z88DK
UseModWiki
Common Language Runtime
Common Intermediate Language
ChatZilla
SISAL