GetNifTypeIndex

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

This is a command from NifSE.

Syntax

(short:typeID) GetNifTypeIndex string:typeName

Returns the Type Index corresponding to the passed string. In some cases, will match incorrect strings to the nearest correct type - in an effort to optimize the efficiency of this function, it will test each letter of the string in sequence, and if a string starts with a series of letters that can only refer to one Type, it will return that Type's index - even if the rest of the string is wrong.

By the same token, the more Types that share the same beginning characters, the less efficient this function is. It is generally suggested that Type indices be stored in variables for later use, rather than calling this function repeatedly. In many cases this function is very quick but in others it is not (though even in the slowest cases it would have to be called many, many times per frame to negatively affect performance), so best practice is just to always store the value.