Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetModuleFile() to the Util functions #1666

Merged
merged 11 commits into from
Jul 3, 2023

Conversation

ID99374836576228
Copy link
Contributor

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.

Cloned `GetModuleMTime()` and return just the name of the file
 Gets the module short file name and returns as a string.
Added NWNX_Util_GetModuleFile()
Change for NWNX_Util_GetModuleFile() documentation
Checks if the module name is not empty
Added tests for GetModuleFile()
@summonFox
Copy link
Contributor

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);

Unlike mtime it makes sense for that to work
@ID99374836576228
Copy link
Contributor Author

ID99374836576228 commented Jun 6, 2023

Manual test

Module: NWNX-test.mod
OnClientEnter

#include "nwnx_util"

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

Result

inst

@mtijanic mtijanic merged commit df02562 into nwnxee:master Jul 3, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants