nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
128 stars 91 forks source link

Add GetModuleFile() to the Util functions #1666

Closed ID99374836576228 closed 1 year ago

ID99374836576228 commented 1 year ago

Cloned GetModuleMTime() and return just the name of the file. The function returns the stripped (short name) of the currently running module or empty string if it's a save game.

summonFox commented 1 year ago

To note in case it got overlooked in the discord conversation, you can get the module filename with basegame functions. Could be handy for anyone looking to do such without nwnx:

string sModFileName = GetSubString(ResManGetAliasFor("module", RESTYPE_IFO), 12, -1);
ID99374836576228 commented 1 year ago

Manual test

Module: NWNX-test.mod OnClientEnter

#include "nwnx_util"

void main()
{
    SendMessageToPC(GetFirstPC(), "Modfile:" + NWNX_Util_GetModuleFile());
}

Result

inst