ResManFindPrefix(string, int, int, int, string)

From NWN Lexicon
Jump to navigationJump to 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.

Finds the nNth available resref starting with sPrefix.

string ResManFindPrefix(
    string sPrefix,
    int nResType,
    int nNth = 1,
    int bSearchBaseData = FALSE,
    string sOnlyKeyTable = ""


resref prefix to filter resref list with
blueprint RESTYPE constant for the blueprint
blueprint resource index
optional parameter to specify searching base game resrefs
optional parameter to specify keytable to search


Finds the nNth available resref starting with sPrefix.


  • The returned resref does not include the file suffix
  • Set bSearchBaseData to TRUE to also search base game content stored in your game installation directory.
   WARNING: This can be very slow.
   PW/Server Devs: bSearchBaseData, when used in a server-environment, only searches the server's files when producing results. You would need to extract the base game files and add them to the server's override folder for this function to pick up those files.
  • Set sOnlyKeyTable to a specific keytable to only search the given named keytable (e.g. "OVERRIDE:").

Returns "" if no such resref exists.

Does not seem to return the resrefs in any particular order.


This function was added in 1.85.8193.31 of NWN:EE.


// Execute all scripts that start with "load_"
void main()
    int i = 1;
    string sScript = ResManFindPrefix("load_", RESTYPE_NCS, i);
    while (sScript != "")
        ExecuteScript(sScript, OBJECT_SELF);
        sScript = ResManFindPrefix("load_", RESTYPE_NCS, ++i);

See Also

functions: ResManGetAliasFor() TemplateToJson()

author: Shadguy