UnrealScript Language Reference
UnrealScript Language Reference
This page and its subpages make up a document by Tim Sweeney. The Unreal Wiki has been granted permission to host it. Please don't make any edits to these pages other than basic formatting of the text. If you have more to say on a topic here, please start a new Wiki page on it, for example from UnrealScript or Unreal Engine, and then add a "related topics" section to the very end of a page here.
Tim Sweeney
Epic MegaGames, Inc.
tim@epicgames.com
http://www.epicgames.com
Introduction
Purpose of this document
This is a technical document describing the UnrealScript language. It's not a tutorial, nor does it provide detailed examples of useful UnrealScript code. For examples of UnrealScript prior to release of Unreal, the reader is referred to the source code to the Unreal scripts, which provides tens of thousands of lines of working UnrealScript code which solves many problems such as AI, movement, inventory, and triggers. A good way to get started is by printing out the "Actor", "Object", "Pawn", "Inventory", and "Weapon" scripts.
This document assumes that the reader has a working knowledge of C/C++, is familiar with object-oriented programming, has played Unreal and has used the UnrealEd editing environment.
For programmers who are new to OOP, I highly recommend going to [Amazon.com] or a bookstore and buying an introductory book on Java programming. Java is very similar to UnrealScript, and is an excellent language to learn about due to its clean and simple approach.
Contents
- /Introduction
- Design goals of UnrealScript
- Example program structure
- The Unreal Virtual Machine
- Class overview
- The class declaration
- /Variables
- /Expressions
- /Functions
- Declaration
- Function parameter specifiers
- Overriding functions
- Advanced function specifiers
- /Program Structure
- Loops (for, while, do)
- Goto
- Conditional statements (if, switch)
- /States
- /Language Functionality
- Built-in operators and precedence
- General purpose functions
- /Advanced Language Features
- Foreach and iterators
- Default values of variables
- /Advanced Technical Issues
- UnrealScript binary compatibility issues
- Programming strategy