UE2:Object (UT2004): Difference between revisions
Auto-generated page |
m →GotoState: formatting fix: escaped empty name literal |
||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
| package = Core | | package = Core | ||
}} | }} | ||
The base class all objects. Because all other classes directly or indirectly inherit from the Object class, all constants, enums, structs, functions and operators defined here could be called "global" constants, enums, etc. | |||
==Constants== | ==Constants== | ||
Line 40: | Line 38: | ||
'''Value:''' 0x00400000 | '''Value:''' 0x00400000 | ||
Don't load for editor. | |||
====MaxInt==== | ====MaxInt==== | ||
'''Value:''' 0x7fffffff | '''Value:''' 0x7fffffff | ||
< | Maximum possible [[int]] value in [[UnrealScript]]. The minimum possible int value is 0x80000000 or <code>~MaxInt</code>. (That's a tilde, the {{tl|~int||Object operators|bitwise complement operator}}.) | ||
====Pi==== | ====Pi==== | ||
'''Value:''' 3.1415926535897932 | '''Value:''' 3.1415926535897932 | ||
The closest approximation of [[wp:Pi|Pi]] that fits into [[UnrealScript]]'s [[float]] type. | |||
==Properties== | ==Properties== | ||
Line 59: | Line 57: | ||
'''[[Variables#Modifiers|Modifiers]]:''' native, const, editconst, noexport | '''[[Variables#Modifiers|Modifiers]]:''' native, const, editconst, noexport | ||
The name of this object. An object's name is defined when the object is created and it's impossible to change later at runtime. | |||
===Internal variables=== | ===Internal variables=== | ||
Line 67: | Line 65: | ||
'''[[Variables#Modifiers|Modifiers]]:''' native, const, editconst | '''[[Variables#Modifiers|Modifiers]]:''' native, const, editconst | ||
The class of this object. | |||
====ObjectFlags==== | ====ObjectFlags==== | ||
Line 74: | Line 72: | ||
'''[[Variables#Modifiers|Modifiers]]:''' native, const | '''[[Variables#Modifiers|Modifiers]]:''' native, const | ||
Internal flags of this object. | |||
====ObjectInternal==== | ====ObjectInternal==== | ||
Line 83: | Line 81: | ||
'''[[Variables#Modifiers|Modifiers]]:''' native, private, const | '''[[Variables#Modifiers|Modifiers]]:''' native, private, const | ||
Other internal data for this object. | |||
====Outer==== | ====Outer==== | ||
Line 90: | Line 88: | ||
'''[[Variables#Modifiers|Modifiers]]:''' native, const | '''[[Variables#Modifiers|Modifiers]]:''' native, const | ||
The outer object containing this object. For resources like {{cl|Texture}}s this is usually the package or group, for {{cl|Actor}}s this is usually the map package of the level currently being played. | |||
==Enums== | ==Enums== | ||
====EAxis==== | ====EAxis==== | ||
Coordinate axes. | |||
; AXIS_X : | ; AXIS_X : The X axis. | ||
; AXIS_Y : | ; AXIS_Y : The Y axis. | ||
; AXIS_Z : | ; AXIS_Z : The Z axis. | ||
====ECamOrientation==== | ====ECamOrientation==== | ||
Camera orientations. | |||
; CAMORIENT_None : <!-- enter enum value description --> | ; CAMORIENT_None : <!-- enter enum value description --> | ||
; CAMORIENT_LookAtActor : <!-- enter enum value description --> | ; CAMORIENT_LookAtActor : <!-- enter enum value description --> | ||
Line 108: | Line 106: | ||
====EDetailMode==== | ====EDetailMode==== | ||
World and physics detail modes. | |||
; DM_Low : | ; DM_Low : Low detail. | ||
; DM_High : | ; DM_High : Normal detail. | ||
; DM_SuperHigh : | ; DM_SuperHigh : Highest detail. | ||
====EDrawPivot==== | ====EDrawPivot==== | ||
Draw pivot positions, e.g. for aligning text or materials. | |||
; DP_UpperLeft : | ; DP_UpperLeft : Upper left corner. | ||
; DP_UpperMiddle : | ; DP_UpperMiddle : Center of upper side. | ||
; DP_UpperRight : | ; DP_UpperRight : Upper right corner. | ||
; DP_MiddleRight : | ; DP_MiddleRight : Center of right side. | ||
; DP_LowerRight : | ; DP_LowerRight : Lower right corner. | ||
; DP_LowerMiddle : | ; DP_LowerMiddle : Center of lower side. | ||
; DP_LowerLeft : | ; DP_LowerLeft : Lower left corner. | ||
; DP_MiddleLeft : | ; DP_MiddleLeft : Center of left side. | ||
; DP_MiddleMiddle : | ; DP_MiddleMiddle : Center of entire object. | ||
====ESheerAxis==== | ====ESheerAxis==== | ||
<!-- enter enum description --> | <!-- enter enum description --> | ||
; SHEER_None : | |||
; SHEER_XY : | |||
; SHEER_XZ : | |||
; SHEER_YX : | |||
; SHEER_YZ : | |||
; SHEER_ZX : | |||
; SHEER_ZY : | |||
==Structs== | ==Structs== | ||
Line 139: | Line 144: | ||
{{code|static final function '''EatStr''' (out [[string]] '''Dest''', out [[string]] '''Source''', [[int]] '''Num''')}} | {{code|static final function '''EatStr''' (out [[string]] '''Dest''', out [[string]] '''Source''', [[int]] '''Num''')}} | ||
Removes ''Num'' characters from the start of ''Source'' and appends them to ''Dest''. If the source string contains less than the specified number of characters, all of them are appended to the destination string. | |||
====GetItemName==== | ====GetItemName==== | ||
{{code|simulated static function [[string]] '''GetItemName''' ([[string]] '''FullName''')}} | {{code|simulated static function [[string]] '''GetItemName''' ([[string]] '''FullName''')}} | ||
< | Returns the last part of a dot-separated full object name. | ||
Note that <code>GetItemName(string(SomeObjectReference))</code> is the same as <code>string(SomeObjectReference.Name)</code>, as long as the object reference is not ''None''. | |||
====ReplaceText==== | ====ReplaceText==== | ||
{{code|simulated static final function '''ReplaceText''' (out [[string]] '''Text''', [[string]] '''Replace''', [[string]] '''With''')}} | {{code|simulated static final function '''ReplaceText''' (out [[string]] '''Text''', [[string]] '''Replace''', [[string]] '''With''')}} | ||
Modifies ''Text'' by replacing every occurrences of ''Replace'' with ''With''. Only occurrences in the original text are replaced, additional occurrences created as a result of a replacement are ignored. | |||
===Iterator functions=== | ===Iterator functions=== | ||
Line 155: | Line 162: | ||
{{code|native(197) final iterator function '''AllObjects''' ([[Types#Class|Class]] '''baseClass''', out {{cl|Object}} '''obj''')}} | {{code|native(197) final iterator function '''AllObjects''' ([[Types#Class|Class]] '''baseClass''', out {{cl|Object}} '''obj''')}} | ||
Iterates over the engine's internal object list and returns all objects of the specified class and all of its subclasses. | |||
'''Note:''' This iterator is much more expensive than {{tl|AllActors||Actor}}. Use it only when you have no other choice and select the base class very carefully. | |||
===Native functions=== | ===Native functions=== | ||
Line 161: | Line 170: | ||
{{code|native(537) final function '''ClearConfig''' (optional [[string]] '''PropName''')}} | {{code|native(537) final function '''ClearConfig''' (optional [[string]] '''PropName''')}} | ||
Clears the entire config section or only the configuration for the specified property and reloads the default value. For [[PerObjectConfig]] classes, only the config section for this object is cleared. Globalconfig properties are not affected unless they are declared in this object's class. | |||
====Disable==== | ====Disable==== | ||
{{code|native(118) final function '''Disable''' ([[name]] '''ProbeFunc''')}} | {{code|native(118) final function '''Disable''' ([[name]] '''ProbeFunc''')}} | ||
Disables the specified [[probe function]]. Invalid names, including names of non-probe functions, will generate a log warning. | |||
====Enable==== | ====Enable==== | ||
{{code|native(117) final function '''Enable''' ([[name]] '''ProbeFunc''')}} | {{code|native(117) final function '''Enable''' ([[name]] '''ProbeFunc''')}} | ||
Enables the specified [[probe function]]. Invalid names, including names of non-probe functions, will generate a log warning. | |||
====GetPropertyText==== | ====GetPropertyText==== | ||
{{code|native final function [[string]] '''GetPropertyText''' ([[string]] '''PropName''')}} | {{code|native final function [[string]] '''GetPropertyText''' ([[string]] '''PropName''')}} | ||
Returns the value of the specified property as a string. The result may differ from the value [[typecast]]ed to string. Especially arrays and all kinds of structs can be converted to a string representation. This function will return an empty string if the specified property doesn't exist or is not public. | |||
====GetReferencers==== | ====GetReferencers==== | ||
{{code|native final function '''GetReferencers''' ({{cl|Object}} '''Target''', out [[array]]<{{cl|Object}}> '''Referencers''')}} | {{code|native final function '''GetReferencers''' ({{cl|Object}} '''Target''', out [[array]]<{{cl|Object}}> '''Referencers''')}} | ||
Builds a list of objects referencing the specified object. | |||
====GetStateName==== | ====GetStateName==== | ||
{{code|native(284) final function [[name]] '''GetStateName''' ()}} | {{code|native(284) final function [[name]] '''GetStateName''' ()}} | ||
Returns the name of the object's current [[state]]. | |||
====GotoState==== | ====GotoState==== | ||
{{code|native(113) final function '''GotoState''' (optional [[name]] '''NewState''', optional [[name]] '''Label''')}} | {{code|native(113) final function '''GotoState''' (optional [[name]] '''NewState''', optional [[name]] '''Label''')}} | ||
< | Switches to a new [[state]] and optionally starts executing that state's [[state code]] at the specified [[label]]. If the object previously was in a state, that state's {{tl|EndState}}() event is called right before the state switch. If a valid ''NewState'' name was specified, that new state's {{tl|BeginState}}() event is called right after the state switch. | ||
'''Parameters:''' | |||
* ''NewState'' - The new state's name. If the empty name <code><nowiki>''</nowiki></code> was specified, the object will be in the null state after the switch and no BeginState() event is executed. The special name <code>'Auto'</code> is a synonym for the state with the ''auto'' modifier. This parameter defaults to the current state's name if omitted. | |||
* ''Label'' - The state label to begin state code execution at. Defaults to <code>'Begin'</code> if omitted. Unless the label was omitted, an invalid label name will generate a log warning. | |||
====IsA==== | ====IsA==== | ||
{{code|native(303) final function [[bool]] '''IsA''' ([[name]] '''ClassName''')}} | {{code|native(303) final function [[bool]] '''IsA''' ([[name]] '''ClassName''')}} | ||
Returns ''True'' if the object's {{tl|Class}} name equals ''ClassName'' or if the object's class directly or indirectly extends a class with that name. | |||
====IsInState==== | ====IsInState==== | ||
{{code|native(281) final function [[bool]] '''IsInState''' ([[name]] '''TestState''')}} | {{code|native(281) final function [[bool]] '''IsInState''' ([[name]] '''TestState''')}} | ||
Returns ''True'' if the object's current [[state]]'s name equals ''TestState'' or if the current state directly or indirectly extends a parent state with that name. | |||
====IsOnConsole==== | ====IsOnConsole==== | ||
{{code|native final function [[bool]] '''IsOnConsole''' ()}} | {{code|native final function [[bool]] '''IsOnConsole''' ()}} | ||
Returns ''True'' if the game runs on a console platform, e.g. Xbox. | |||
====IsSoaking==== | ====IsSoaking==== | ||
Line 216: | Line 229: | ||
{{code|native final function [[bool]] '''PlatformIs64Bit''' ()}} | {{code|native final function [[bool]] '''PlatformIs64Bit''' ()}} | ||
Returns ''True'' if the game runs through its 64bit binaries. With 32bit game binaries this function always returns ''False'', even if the underlying operating system and hardware are 64bit. | |||
====PlatformIsMacOS==== | ====PlatformIsMacOS==== | ||
{{code|native final function [[bool]] '''PlatformIsMacOS''' ()}} | {{code|native final function [[bool]] '''PlatformIsMacOS''' ()}} | ||
Returns ''True'' if the game runs under MacOS. | |||
====PlatformIsUnix==== | ====PlatformIsUnix==== | ||
{{code|native final function [[bool]] '''PlatformIsUnix''' ()}} | {{code|native final function [[bool]] '''PlatformIsUnix''' ()}} | ||
Returns ''True'' if the game runs on a 32bit or 64bit Unix platform, e.g. Linux. | |||
====PlatformIsWindows==== | ====PlatformIsWindows==== | ||
{{code|native final function [[bool]] '''PlatformIsWindows''' ()}} | {{code|native final function [[bool]] '''PlatformIsWindows''' ()}} | ||
Returns ''True'' if the game runs on a 32bit or 64bit Windows platform. | |||
====SaveConfig==== | ====SaveConfig==== | ||
{{code|native(536) final function '''SaveConfig''' ()}} | {{code|native(536) final function '''SaveConfig''' ()}} | ||
Saves this objects configurable properties. For [[PerObjectConfig]] classes, the values of configurable properties are written to a separate section labeled with this object's name and its class name. For other classes, the values of configurable properties are written to the object's class config section and also become the class default values. Values of globalconfig properties are written to the config section of the class that declared the property. | |||
====SetPropertyText==== | ====SetPropertyText==== | ||
{{code|native final function [[bool]] '''SetPropertyText''' ([[string]] '''PropName''', [[string]] '''PropValue''')}} | {{code|native final function [[bool]] '''SetPropertyText''' ([[string]] '''PropName''', [[string]] '''PropValue''')}} | ||
Sets the value of the specified property. The format of the ''PropValue'' is similar to the return value of the {{tl|GetPropertyText}}() function. If the specfied property doesn't exist, is declared with the ''const'' modifier or not public, no new value is assigned. SetPropertyText() will return ''False'' in this case. | |||
Note that the return value ''True'' does not automatically mean that a valid new value was assigned to the property. An invalidly formatted value string could have unpredictable results. Depending on the type of property, nothing could happen at all, a null value may be assigned or even only a partial value, especially for [[struct]] properties. | |||
===Events=== | ===Events=== | ||
Line 247: | Line 262: | ||
{{code|event '''BeginState''' ()}} | {{code|event '''BeginState''' ()}} | ||
Called for the new [[state]] right after the state switch before {{tl|GotoState}}() returns. | |||
====Created==== | ====Created==== | ||
{{code|event '''Created''' ()}} | {{code|event '''Created''' ()}} | ||
Called for non-{{cl|Actor}} objects right before the [[new]] operator returns. | |||
====EndState==== | ====EndState==== | ||
{{code|event '''EndState''' ()}} | {{code|event '''EndState''' ()}} | ||
Called for the old [[state]] right before the state switch during {{tl|GotoState}}(). | |||
===Other instance functions=== | ===Other instance functions=== | ||
Line 263: | Line 278: | ||
{{code|final function [[float]] '''RandRange''' ([[float]] '''Min''', [[float]] '''Max''')}} | {{code|final function [[float]] '''RandRange''' ([[float]] '''Min''', [[float]] '''Max''')}} | ||
< | Returns a random float value between ''Min'' and ''Max''. Since this is an instance functions, you will have to use {{tl|FRand||Object static native functions}}() to generate the desired range of values: | ||
<uscript>Min + (Max - Min) * FRand()</uscript> | |||
==Operators== | ==Operators== | ||
See {{cl|Object operators}}. | See {{cl|Object operators}}. |
Latest revision as of 11:51, 5 December 2008
- Package:
- Core
- Direct subclasses:
- WebApplication, BrowserFilters, GUI, Actor, AdminBase, AnimEditProps, AnimNotifyProps, AnimNotify, Bitmap, BrushBuilder, CacheManager, CameraEffect, Canvas, ChallengeGame, CheatManager, Commandlet, CrosshairPack, CustomBotConfig, CustomFilter, CustomLadderInfo, DecoText, DrawOpBase, GameConfigSet, GameProfile, PlayerRecordClass, I3DL2Listener, Interactions, KarmaParamsCollision, LIPSincAnimProps, LIPSincControllerProps, LIPSincPrefsProps, LadderInfo, LevelSummary, ListItem, Locale, LogEntry, Manifest, MapVoteHistory, MaplistRecord, MatObject, MatchConfig, MatchInfo, MaterialFactory, Material, MeshObject, NotifyProperties, ONSPowerLinkCustomSetup, ObjectArray, ObjectPool, Palette, ParticleEmitter, PlayInfo, PlayerInput, Player, PropertyManagerBase, ReachSpec, Resource, RosterEntry, SPHighScoreBase, SPProfileExporter, SVehicleWheel, ScriptedAction, SequEditProps, SkaarjMeshes, SkelPrefsEditProps, Sound, SpeciesType, Spline, StreamBase, StringArray, Subsystem, TextToSpeechAlias, Time, UT2K4RosterGroup, WeaponFire, WebRequest, WebResponse, WebSkin, XAdminBase, XPawnGibGroup, XPawnSoundGroup, XPrivilegeBase, XUtil, Primitive, Factory, Font, MeshAnimation
- Known custom subclasses:
- Crusha/UltimateMappingTools, Crusha/UltimateMappingTools/UltimateMathAux
- This class in other games:
The base class all objects. Because all other classes directly or indirectly inherit from the Object class, all constants, enums, structs, functions and operators defined here could be called "global" constants, enums, etc.
Constants
RF_Transactional
Value: 0x00000001
Supports editor undo/redo.
RF_Public
Value: 0x00000004
Can be referenced by external package files.
RF_Transient
Value: 0x00004000
Can't be saved or loaded.
RF_Standalone
Value: 0x00080000
Keep object around for editing even if unreferenced.
RF_NotForClient
Value: 0x00100000
Don't load for game client.
RF_NotForServer
Value: 0x00200000
Don't load for game server.
RF_NotForEdit
Value: 0x00400000
Don't load for editor.
MaxInt
Value: 0x7fffffff
Maximum possible int value in UnrealScript. The minimum possible int value is 0x80000000 or ~MaxInt
. (That's a tilde, the bitwise complement operator.)
Pi
Value: 3.1415926535897932
The closest approximation of Pi that fits into UnrealScript's float type.
Properties
Property group 'Object'
Name
Type: name
Modifiers: native, const, editconst, noexport
The name of this object. An object's name is defined when the object is created and it's impossible to change later at runtime.
Internal variables
Class
Type: Class
Modifiers: native, const, editconst
The class of this object.
ObjectFlags
Type: int
Modifiers: native, const
Internal flags of this object.
ObjectInternal
Type: pointer
Array size: 7
Modifiers: native, private, const
Other internal data for this object.
Outer
Type: Object
Modifiers: native, const
The outer object containing this object. For resources like Textures this is usually the package or group, for Actors this is usually the map package of the level currently being played.
Enums
EAxis
Coordinate axes.
- AXIS_X
- The X axis.
- AXIS_Y
- The Y axis.
- AXIS_Z
- The Z axis.
ECamOrientation
Camera orientations.
- CAMORIENT_None
- CAMORIENT_LookAtActor
- CAMORIENT_FacePath
- CAMORIENT_Interpolate
- CAMORIENT_Dolly
EDetailMode
World and physics detail modes.
- DM_Low
- Low detail.
- DM_High
- Normal detail.
- DM_SuperHigh
- Highest detail.
EDrawPivot
Draw pivot positions, e.g. for aligning text or materials.
- DP_UpperLeft
- Upper left corner.
- DP_UpperMiddle
- Center of upper side.
- DP_UpperRight
- Upper right corner.
- DP_MiddleRight
- Center of right side.
- DP_LowerRight
- Lower right corner.
- DP_LowerMiddle
- Center of lower side.
- DP_LowerLeft
- Lower left corner.
- DP_MiddleLeft
- Center of left side.
- DP_MiddleMiddle
- Center of entire object.
ESheerAxis
- SHEER_None
- SHEER_XY
- SHEER_XZ
- SHEER_YX
- SHEER_YZ
- SHEER_ZX
- SHEER_ZY
Structs
See Object structs.
Functions
Static native functions
See Object static native functions.
Other static functions
EatStr
Removes Num characters from the start of Source and appends them to Dest. If the source string contains less than the specified number of characters, all of them are appended to the destination string.
GetItemName
Returns the last part of a dot-separated full object name.
Note that GetItemName(string(SomeObjectReference))
is the same as string(SomeObjectReference.Name)
, as long as the object reference is not None.
ReplaceText
Modifies Text by replacing every occurrences of Replace with With. Only occurrences in the original text are replaced, additional occurrences created as a result of a replacement are ignored.
Iterator functions
AllObjects
Iterates over the engine's internal object list and returns all objects of the specified class and all of its subclasses.
Note: This iterator is much more expensive than AllActors. Use it only when you have no other choice and select the base class very carefully.
Native functions
ClearConfig
Clears the entire config section or only the configuration for the specified property and reloads the default value. For PerObjectConfig classes, only the config section for this object is cleared. Globalconfig properties are not affected unless they are declared in this object's class.
Disable
Disables the specified probe function. Invalid names, including names of non-probe functions, will generate a log warning.
Enable
Enables the specified probe function. Invalid names, including names of non-probe functions, will generate a log warning.
GetPropertyText
Returns the value of the specified property as a string. The result may differ from the value typecasted to string. Especially arrays and all kinds of structs can be converted to a string representation. This function will return an empty string if the specified property doesn't exist or is not public.
GetReferencers
Builds a list of objects referencing the specified object.
GetStateName
Returns the name of the object's current state.
GotoState
Switches to a new state and optionally starts executing that state's state code at the specified label. If the object previously was in a state, that state's EndState() event is called right before the state switch. If a valid NewState name was specified, that new state's BeginState() event is called right after the state switch.
Parameters:
- NewState - The new state's name. If the empty name
''
was specified, the object will be in the null state after the switch and no BeginState() event is executed. The special name'Auto'
is a synonym for the state with the auto modifier. This parameter defaults to the current state's name if omitted. - Label - The state label to begin state code execution at. Defaults to
'Begin'
if omitted. Unless the label was omitted, an invalid label name will generate a log warning.
IsA
Returns True if the object's Class name equals ClassName or if the object's class directly or indirectly extends a class with that name.
IsInState
Returns True if the object's current state's name equals TestState or if the current state directly or indirectly extends a parent state with that name.
IsOnConsole
Returns True if the game runs on a console platform, e.g. Xbox.
IsSoaking
PlatformIs64Bit
Returns True if the game runs through its 64bit binaries. With 32bit game binaries this function always returns False, even if the underlying operating system and hardware are 64bit.
PlatformIsMacOS
Returns True if the game runs under MacOS.
PlatformIsUnix
Returns True if the game runs on a 32bit or 64bit Unix platform, e.g. Linux.
PlatformIsWindows
Returns True if the game runs on a 32bit or 64bit Windows platform.
SaveConfig
Saves this objects configurable properties. For PerObjectConfig classes, the values of configurable properties are written to a separate section labeled with this object's name and its class name. For other classes, the values of configurable properties are written to the object's class config section and also become the class default values. Values of globalconfig properties are written to the config section of the class that declared the property.
SetPropertyText
Sets the value of the specified property. The format of the PropValue is similar to the return value of the GetPropertyText() function. If the specfied property doesn't exist, is declared with the const modifier or not public, no new value is assigned. SetPropertyText() will return False in this case.
Note that the return value True does not automatically mean that a valid new value was assigned to the property. An invalidly formatted value string could have unpredictable results. Depending on the type of property, nothing could happen at all, a null value may be assigned or even only a partial value, especially for struct properties.
Events
BeginState
Called for the new state right after the state switch before GotoState() returns.
Created
Called for non-Actor objects right before the new operator returns.
EndState
Called for the old state right before the state switch during GotoState().
Other instance functions
RandRange
Returns a random float value between Min and Max. Since this is an instance functions, you will have to use FRand() to generate the desired range of values: <uscript>Min + (Max - Min) * FRand()</uscript>
Operators
See Object operators.