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 that Unreal Engine used for authoring game code and gameplay events before the release of Unreal Engine 4. 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 classes are defined in individual files named for the class they define. Unlike Java, UnrealScript 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 games easier, UnrealScript helped enable the growth of a large modding community around the Unreal series. 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;
Data types
Primitive types
- Bool - A boolean that allows the values true, and false, which are the same to 1 and 0
- Byte - An unsigned 8-bit integer value
- Enum
- Float
- Int - A signed 32-bit integer value
- Name - A more restricted version of String, only allowing the following characters
([a-zA-Z0-9_\- ]*)
as expressed in regex. e.g. 'name_example' - String - A series of Unicode characters such as "A B C"
Reference types
- Class
- Delegate
- Interface
- Object
- Pointer
Composite types
- Array
- Struct
Functions
UnrealScript uses functions similar to C/C++/Java. Functions are declared by the keyword: function, followed by an optional return type, its required name, and finally its function parameters.
The declaration of a function can look like this:
[modifiers] function [[modifiers] datatype] name( [parameters] ) [const];
the semicolon is only necessary if the function has no body.
An example of a very simple additive function in UnrealScript:
function int Add( int a, int b )
{
return a + b;
}
"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
- IDEs
- Unreal X-Editor - An UnrealScript Editor[3]
- WOTgreal - An integrated development environment for UnrealScript
- nFringe - A Microsoft Visual Studio plug-in for UnrealScript[4]
- Unreal Writer - A basic UnrealScript editor for Mac OS X[5]
- Unreal Script IDE A UnrealScript IDE using Microsoft Visual Studio shell
- UnrealScript IDE for Sublime Text 2 - A Plugin for Sublime Text 2
- Unreal Sed - An IDE for Unreal, Unreal 2, UT, UT2003, UT2004, UT3, and UDK.
- Utilities
- UnCodeX - An application to browse source code of UnrealScript[6]
- UTPT - An application to decompile, and export sounds, textures, and meshes from Unreal Engine 1, and 2's packages
- UE Viewer - An application to export sounds, textures, and meshes from Unreal Engine 1, 2, and 3's packages
- UE Explorer - An application to decompile UnrealScript from Unreal Engine 1, 2, and 3's packages
Template:Multicol-end Template:Multicol
- Other
- Unreal Developer Network - The official wiki
- UnrealWiki - The unofficial wiki
References
- ^ "UDN - Three - UnrealScriptReference". Udn.epicgames.com. Retrieved 2013-06-26.
- ^ "UDN - Three - MakingACommandlet". Udn.epicgames.com. Retrieved 2013-06-26.
- ^ "Unreal X-Editor | Free Script Editor for Unreal Development Kit (UDK)". Unrealxeditor.wordpress.com. 2013-04-29. Retrieved 2013-06-26.
- ^ "Tools:nFringe - Pixel Mine Games Wiki". Wiki.pixelminegames.com. 2009-04-05. Retrieved 2013-06-26.
- ^ "Downloads". Apple. Retrieved 2013-06-26.
- ^ "UDN - Three - UnCodeX". Udn.epicgames.com. Retrieved 2013-06-26.
Further reading
- John P. Flynt & Chris Caviness (May 2006). UnrealScript Game Programming All in One. Thomson Course Technology. ISBN 978-1-598-63148-7
- Jason Busby, Zak Parrish & Jeff Wilson (January 2011). Mastering Unreal Technology, Volume III: Introduction to UnrealScript with Unreal Engine 3. Sams Publishing. ISBN 978-0-672-33082-7
- Rachel Cordone (December 2011). Unreal Development Kit Game Programming with Unrealscript: Beginner's Guide. Packt Publishing. ISBN 978-1-849-69192-5
External links
- UnrealScript Language Reference for UE2
- UnrealScript Language Reference for UE3
- UnrealScript Language Reference circa 1998 (Original Unreal) (Archive link from June 2011)
- UnrealWiki's link for the original Unreal script reference.
- UnrealWiki: UnrealScript