UnrealScript
![]() |
Paradigm | Object-oriented, generic |
---|---|
Developer | Tim Sweeney |
First appeared | 1998 |
Typing discipline | Static, strong, safe |
OS | Cross-platform (multi-platform) |
Filename extensions | .uc .uci .upkg |
Website | udn.epicgames.com |
Influenced by | |
C++, Java |
UnrealScript (often abbreviated to UScript) is the scripting language of the Unreal Engine and is used for authoring game code and gameplay events. The language was designed for simple, high-level game programming.[1] The UnrealScript interpreter was programmed by Tim Sweeney, who also created an earlier game scripting language, ZZT-oop.
Similar to Java, UnrealScript is object-oriented without multiple inheritance (classes all inherit from a common Object class), and class are defined in individual files named for the class they define. 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.
By making the process of modifying the game easier, UnrealScript helped enable the growth of a large modding community around Unreal. This greatly added to the overall longevity of Unreal and provided an incentive for new development.
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;
Functions
UnrealScript uses functions similar to C/C++. Functions are declared by the keyword: function, the return 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 = 5;
return example_number;
}
This function takes the integer example_number, changes its value to 5, then returns its value to the caller.
"Hello, world" example
The following is a hello world example using the syntax of UnrealScript.[2]
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!
See also
- WOTgreal - Integrated development environment for UnrealScript
- nFringe - A Microsoft Visual Studio plug-in for UnrealScript[3]
- UnCodeX - An application to browse source code of UnrealScript[4]
- Unreal Writer - A basic UnrealScript editor for Mac OS X[5]
- Unreal X-Editor - A Free UnrealScript Editor developed by Satheesh P.V (a.k.a RyanJon2040)[6]
- Unreal Script Wizard - A Free Unreal Script Wizard developed by Satheesh P.V (a.k.a RyanJon2040) that helps create basic Weapon Script. More classes such as Character, Game etc. will be added soon.
References
- ^ http://udn.epicgames.com/Three/UnrealScriptReference.html#Design%20goals%20of%20_UnrealScript
- ^ http://udn.epicgames.com/Three/MakingACommandlet.html#How%20To%20Make%20a%20Commandlet%20in%20Script
- ^ http://wiki.pixelminegames.com/index.php?title=Tools:nFringe
- ^ http://udn.epicgames.com/Three/UnCodeX.html
- ^ http://www.apple.com/downloads/macosx/games/utilities/unrealwriter.html
- ^ http://unrealxeditor.wordpress.com/
External links