Difference between revisions of "GetForm - Game"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Sirtaj
(Note on GetForm reliability with higher-ordered mods.)
imported>DavidJCobb
Line 26: Line 26:
* Scripts should always be blind to the contents of data files, and rely on [[Variables and Properties|properties]] as the interface through which they access data from data files. As such, this function should only ever be used for debugging purposes.
* Scripts should always be blind to the contents of data files, and rely on [[Variables and Properties|properties]] as the interface through which they access data from data files. As such, this function should only ever be used for debugging purposes.
* As the FormID is intended to be a 32-bit unsigned integer and Papyrus uses signed integers, this function is not reliable for forms from higher-ordered mods. Specifically, any FormID with the MSB set (load order 0x80 and above) will fail to return a valid object.
* As the FormID is intended to be a 32-bit unsigned integer and Papyrus uses signed integers, this function is not reliable for forms from higher-ordered mods. Specifically, any FormID with the MSB set (load order 0x80 and above) will fail to return a valid object.
* This function cannot retrieve an ObjectReference by form ID if that reference is not loaded.


== See Also ==
== See Also ==

Revision as of 20:39, 13 May 2016

Member of: Game Script

Obtains the form specified by its form ID number.

Syntax

Form Function GetForm(int aiFormID) native global

Parameters

  • aiFormID: The form ID number of the form we want. (FormID proceeded by 0x) For example Form ID "0001DA07" is given as: 0x0001DA07

Return Value

The requested Form, or None if the form ID is not valid.

Examples

; Obtain whatever form 0001DA07 is
Form someForm = Game.GetForm(0x0001DA07)

Notes

  • Scripts should always be blind to the contents of data files, and rely on properties as the interface through which they access data from data files. As such, this function should only ever be used for debugging purposes.
  • As the FormID is intended to be a 32-bit unsigned integer and Papyrus uses signed integers, this function is not reliable for forms from higher-ordered mods. Specifically, any FormID with the MSB set (load order 0x80 and above) will fail to return a valid object.
  • This function cannot retrieve an ObjectReference by form ID if that reference is not loaded.

See Also