Hey guys, I’m in desperate need of some help here. I’ve been struggling with compiling a bunch of scripts using nwnsc tool and I’m about to slice my wrists I have no idea how my .bat file should look like.
I’m on Windows, NWN:EE, steam version.
nwnsc.exe is placed in my game folder: 'C:\Users\MYUSERNAME\Documents\Neverwinter Nights\
I’ve created nwnsc.bat file in the same directory as above.
My scripts are placed: 'C:\Users\MYUSERNAME\Documents\Neverwinter Nights\modules\scripts
in separate subfolders, e.g.: \scripts\includes\ \scripts\spells\ \scripts\feats\
etc.
Anyone here familiar with this tool and could help me out with the content of that .bat file to make it work?
I’d be grateful for your time and patience.
@echo off
setlocal enabledelayedexpansion
color a
echo Please wait...
cd "C:\Users\MYUSERNAME\Documents\Neverwinter Nights"
for /r "%~dp0\modules\scripts" %%f in (*.nss) do (
color a
echo Compiling "%%f"
nwnsc.exe -i "modules\scripts\includes" -o "%%f"
)
pause
Compiling "C:\Users\MYUSERNAME\Documents\Neverwinter Nights\scripts\spells\MYFILENAME.nss" 'nwnsc.exe' is not recognized as an internal or external command, operable program or batch file.
Got one more question. Hopefully the last one. Do I have to put every include script in ‘includes’ folder? Is there any way to make the compiler somehow check for those default game scripts wherever they are in installation folder?
I mean those base scripts like x0_i0_campaign.nss etc., that I don’t have to manually grab and compile in toolset, when I’m compiling my scripts there.
-b batchoutdir - Supplies the location where batch mode places output files
-h homedir - Per-user NWN home directory (i.e. Documents\Neverwinter Nights)
-i pathspec - Semicolon separated list of folders to search for additional includes
-n installdir - Neverwinter Nights install folder. Use to load base game includes
-m mode - Compiler mode 1.69 or 1.74 - (default 1.74)
-x errprefix - Prefix string to prepend to compiler errors (default “Error”)
So in my example replace
nwnsc.exe -i "modules\scripts\includes" -o "%%f"
with
nwnsc.exe -i "modules\scripts\includes" -n "full path to the game root directory" -o "%%f"
"full path to the game root directory" = "C:\Games\Neverwinter Nights Diamond", for example.
No, *includes* cannot be compiled technically by themselves (and there’s no reason to compile them at all), they don’t have the entry point - the main() function. You can only attach them to the actual scripts with the main() function.
…but there’s a small trick, if you want to check your includes for errors before using them as includes: add temporarily the empty main() function into them and then try to compile them. If there’re any errors, compiler will tell you about that. If an include compiles successfully, comment out or remove those empy main() function statements (otherwise you will get an error if you try to use such include in the actual script).