Differences
This shows you the differences between two versions of the page.
— |
guidelines:ue1_undocumented_unreal [2011/12/22 15:14] (current) michal.bida created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== unDocumented unRealScript (UE1) ====== | ||
+ | |||
+ | **Note:** I've found this online - it is for unreal engine 1 as far as I know - still may hold some interesting stuff. | ||
+ | |||
+ | |||
+ | Bob Berry | ||
+ | |||
+ | Digitalo Studios, Inc. | ||
+ | |||
+ | bob@digitalo.com | ||
+ | |||
+ | http:// | ||
+ | |||
+ | Last Updated: 07/24/00 | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | This document describes some of the hidden treasures UnrealScript while simultaneously exposing some entirely useless information. | ||
+ | |||
+ | |||
+ | |||
+ | ===== Variable Declaration ===== | ||
+ | |||
+ | |||
+ | |||
+ | ==== · EditConst ==== | ||
+ | |||
+ | |||
+ | Variable is displayed, but can not be changed in UnrealED’s default properties window. | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | var(Object) native const editconst class Class; | ||
+ | |||
+ | var() editconst foo CantTouchThis; | ||
+ | </ | ||
+ | |||
+ | ==== · Skip ==== | ||
+ | |||
+ | |||
+ | Used to short-circuit a function call by treating the parameter as an expression to be evaluated. | ||
+ | |||
+ | |||
+ | ==== · Array< | ||
+ | |||
+ | |||
+ | There is some good news and some bad news here. The good news is variable length arrays are supported using the Array specifier. | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | var Array< | ||
+ | |||
+ | var Array< | ||
+ | </ | ||
+ | |||
+ | |||
+ | The bad news is that they aren’t fully implemented in UnrealScript (as of UT420). | ||
+ | |||
+ | ==== · Map ==== | ||
+ | |||
+ | |||
+ | There are plans for UnrealScript to support map variables (such as in Perl), however the implementation is only partially complete. | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | var map< | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== · Travel ==== | ||
+ | |||
+ | Specifies that this property can travel across levels and servers (persistent). | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | var travel int Health; | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Class Declaration ===== | ||
+ | |||
+ | |||
+ | ==== · NativeReplication ==== | ||
+ | |||
+ | |||
+ | This tag specifies that the native C++ code for the given UnrealScript class should be responsible for handling replication. | ||
+ | |||
+ | |||
+ | |||
+ | * Native replication is enabled/ | ||
+ | |||
+ | * C++ native replication functions work just like the correspinding " | ||
+ | |||
+ | * UnrealScript or native replication code only defines replication for the variables declared _in_that_class_file_. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== · NoUserCreate ==== | ||
+ | |||
+ | |||
+ | Users may not instantiate these classes in UnrealED. | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | class Wookie extends Actor NoUserCreate; | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | If you select the Wookie class in the class browser, right click in the viewport, and select “Add Wookie Here” from the context menu you will receive a log message stating that “You can't add actors of this class to the world.” | ||
+ | ==== | ||
+ | · SafeReplace ==== | ||
+ | |||
+ | |||
+ | Specifies that a reference to this class may safely be set to Null or default if the class object can’t be found in any packages. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== · PerObjectConfig ==== | ||
+ | |||
+ | |||
+ | Stores configuration information on a per-object basis rather than a per-class basis. | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | class Wookie extends WalkingCarpet PerObjectConfig; | ||
+ | </ | ||
+ | |||
+ | |||
+ | This says that each wookie object should have a separate configuration section (in the configuration file) based on its name. | ||
+ | |||
+ | |||
+ | ==== · Within ==== | ||
+ | |||
+ | |||
+ | Specifies that this class can only be instantiated within the context of another class. | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | class Chewbacca extends Wookie Within Smuggler; | ||
+ | </ | ||
+ | |||
+ | |||
+ | Note that this specifier does not currently (UT420) work, but can be made to do so with a few minor code changes in UnScrCom.cpp. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Flow Control ===== | ||
+ | |||
+ | |||
+ | |||
+ | ==== · Stop ==== | ||
+ | |||
+ | |||
+ | Immediately stops executing state code. | ||
+ | |||
+ | |||
+ | ==== · Assert ==== | ||
+ | |||
+ | |||
+ | Just like a C++ assertion, if the expression within the assert call evaluates to false, the program will terminate with an descriptive error message. | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | function StopUnreal() | ||
+ | |||
+ | { | ||
+ | |||
+ | assert(1==0); | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | |||
+ | This function is called “StopUnreal” because the assert statement will always fail because 1 is always not equal to 0. Because it fails, execution of Unreal stops with an error message stating that the assertion failed and lets you know in which source file and on which line the assert statement was found. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Miscellaneous Tidbits ===== | ||
+ | |||
+ | ==== · Import / From ==== | ||
+ | |||
+ | |||
+ | Allows you to import a package, enum, or struct for referencing. | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | import package Botpack; | ||
+ | |||
+ | import enum EInputKey From Engine; | ||
+ | </ | ||
+ | |||
+ | ==== · New ==== | ||
+ | |||
+ | Used to construct descendant classes of Object, but not descendants of Actor. | ||
+ | |||
+ | |||
+ | < | ||
+ | object new(Object, Name, Int) class NewClass; | ||
+ | </ | ||
+ | |||
+ | |||
+ | The 3 optional “function” parameters of this operator specify the parent object, the object name, and the object flags respectively. | ||
+ | |||
+ | |||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | local TestObj to; | ||
+ | |||
+ | to = new(self, ‘MyFoo’, | ||
+ | </ | ||
+ | |||
+ | |||
+ | Note that the parameters are completely optional including the parenthesis surrounding them. Thus, a call to new could look like this: | ||
+ | |||
+ | |||
+ | < | ||
+ | To = new class’TestObj’; | ||
+ | </ | ||
+ | |||
+ | ==== · ArrayCount ==== | ||
+ | |||
+ | |||
+ | Returns the number of elements in an array. | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | local int NumElements; | ||
+ | |||
+ | local int foo[40]; | ||
+ | |||
+ | NumElements = ArrayCount(foo); | ||
+ | </ | ||
+ | |||
+ | |||
+ | In this case, NumElements is equal to 40. | ||
+ | |||
+ | |||
+ | ==== · EnumCount ==== | ||
+ | |||
+ | |||
+ | Returns the number of elements in an enum. | ||
+ | |||
+ | e.g. | ||
+ | < | ||
+ | enum EWookies | ||
+ | { | ||
+ | Chewbacca, | ||
+ | ChewysDad, | ||
+ | ChewysMom | ||
+ | }; | ||
+ | |||
+ | function int GetNumWookies() | ||
+ | { | ||
+ | |||
+ | return Ewookies.EnumCount; | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | |||
+ | In this case, the useless function GetNumWookies returns 3. This function is useless because it always return 3 since enumerations can’t be modified at run-time. | ||