Difference between revisions of "BuildRef"

67 bytes added ,  05:50, 23 July 2014
m
minor
imported>Odessa
(added info to avoid a CTD)
imported>Odessa
m (minor)
 
==Avoiding CTDs==
If one uses an invalid decimal form ID then it will likely crash the game when you try to use your (mis)built reference. This may be an issue if the form is non existent or different in past or future versions of the referenced module, or if two distinct modules are given the same file name.
 
You can avoid CTDs by ensuring the return is both a valid form, and of the type you expect it to be, using [[IsFormValid]], and functions like [[IsReference]], [[IsActor]] or [[GetType]]. For example, following on from the code above, where we want to get a companion added by an external mod:
*[[GetModIndex]]
*[[GetLocalRefIndex]]
*[[Causes of CTDs]]
*[[IsFormValid]], [[IsReference]], [[IsActor]], [[GetType]]
*[[Eval]]
 
[[Category:Functions_(NVSE)]]
Anonymous user