StringToObject( string )

From NWN Lexicon
Revision as of 00:05, 17 September 2020 by Jasperre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Nwnee logo.jpg Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.
Convert sHex, a string containing a hexadecimal object id, into a object reference.
object StringToObject(
    string sHex


A string containing a hexadecimal object id.


Convert sHex, a string containing a hexadecimal object id, into an object reference. Counterpart to ObjectToString.


Since this converts from ObjectToString (which outputs a string such as "0x040105001") the obvious use is being able to store objects as strings for later use. This mainly applies to the newest SQLite database functionality where the concept of an "object" isn't available.

Of course if you are using this function it is recommended to use GetIsObjectValid not != OBJECT_INVALID to check it is a valid reference, and possibly GetObjectType to check it is of the expected type. Running this on old objects stored with ObjectToString after a module reset is not recommended at all since all object IDs will be reset.


This function was added in 1.80.8193.14 of NWN:EE.


Information icon.png This article is in need of examples. You can help the NWN Lexicon by showing how to use this code effectively.

See Also

functions: ObjectToString SqlBindString SqlGetString

 author: Shadguy