Reference functions

From the Oblivion ConstructionSet Wiki
Revision as of 09:00, 25 July 2008 by imported>ShadowDancer (removed object reference link, page doesn't exist)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Most script functions are reference functions. This refers to the fact that they must be run on an object reference. Reference scripts (object scripts and dialogue result scripts) can use implicit reference syntax. For example:

GetDisposition player 

GetDisposition is a reference function -- whose disposition are you asking for? In this case, since we did not specify a reference, it is implied that we are really saying:

thisReference.GetDisposition player 

You can always use explicit reference syntax, meaning that you explicitly specify the reference to run the function on. Non-reference scripts must use explicit reference syntax, since they are not running on an object reference. For example:

JauffreRef.GetDisposition player 

Here we are asking for Jauffe's disposition towards the player. This syntax could be used in any script, because we have made the function's reference explicit.

NOTE: you can also run reference functions on reference variables, just as if they were the object themselves, and refer to the object by its hexadecimal FormID in double-quotes. The object needs to be loaded in-game or a persistent ref. (always loaded) for this to work. For the Jauffre example above:

"1CB98".GetDisposition player 

would accomplish the same thing. This is very useful for controlling persistent refs. that don't have Reference Editor ID names.