Difference between revisions of "BuildRef"

67 bytes added ,  06:50, 23 July 2014
m
minor
imported>Odessa
(added info to avoid a CTD)
imported>Odessa
m (minor)
Line 26: Line 26:


==Avoiding CTDs==
==Avoiding CTDs==
If one uses an invalid decimal form ID then it will likely crash the game. 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.
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:
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:
Line 65: Line 65:
*[[GetModIndex]]
*[[GetModIndex]]
*[[GetLocalRefIndex]]
*[[GetLocalRefIndex]]
*[[Causes of CTDs]]
*[[IsFormValid]], [[IsReference]], [[IsActor]], [[GetType]]
*[[IsFormValid]], [[IsReference]], [[IsActor]], [[GetType]]
*[[Eval]]
*[[Eval]]
[[Category:Functions_(NVSE)]]
[[Category:Functions_(NVSE)]]
Anonymous user