nwnnsscomp is a compiler/decompiler for use with Star Wars: Knights of the Old Republic
(KotOR) and Star Wars: Knights of the Old Republic: The Sith Lords (KotOR:TSL).
It is was originally written by Edward T. Smith for compiling NeverWinter Nights scripts.
It has been updated since that time by Fred Tetra to work with KotOR and KotOR:TSL.
Setting up the environment
-----------------------------
There are several cases that might apply to the way you want to work with the compiler:
Case 1: Compiling KotOR I script files with only KotOR I installed
No special setup is needed. The compiler will use the nwscript.nss file contained in
the game's scripts.bif file.
Case 2: Compiling KotOR I script files without KotOR I installed
Some users may wish to compile scripts on a different machine from where KotOR is
installed. You will need to use a utility such as Kotor Tool to extract the nwscript.nss
file from scripts.bif and put it in the same folder as nwnnsscomp.
Case 3: Compiling KotOR:TSL script files with only KotOR:TSL installed
If you have the US version of the game, You will need to use a utility such
as Kotor Tool to extract the nwscript.nss file from scripts.bif and put it in the same
folder as nwnnsscomp. If you have a non-US version, there is a syntax error in the
nwscript.nss file; you will have to either extract the file and fix the error or obtain
a copy with it corrected first.
Case 4: Compiling KotOR:TSL script files only without KotOR:TSL installed
Some users may wish to compile scripts on a different machine from where KotOR:TSL is
installed. If you have the US version of the game, You will need to use a utility such
as Kotor Tool to extract the nwscript.nss file from scripts.bif and put it in the same
folder as nwnnsscomp. If you have a non-US version, there is a syntax error in the
nwscript.nss file; you will have to either extract the file and fix the error or obtain
a copy with it corrected first.
Case 5: Compiling KotOR I and KotOR:TSL script files with both games installed.
If you are compiling script files for KotOR I and KotOR:TSL installed, perform the
following steps:
Extract the nwscript.nss file from KotOR I's scripts.bif into KotOR I's Override folder
US version of KotOR:TSL:
if you have a US version of KotOR:TSL, extract the nwscript.nss file from KotOR:TSL's
scripts.bif into KotOR:TSL's Override folder. If the Override folder doesn't already
exist, create it first.
Non-US version of KotOR:TSL:
There is a syntax error in the nwscript.nss file; you will have to either extract the file
from KotOR:TSL's scripts.bif and fix the error or obtain a copy with it corrected first.
Copy the file to KotOR:TSL's Override folder.
Examples
-----------
Compile multiple source files for KotOR:TSL, putting the output files all in one directory:
NeverWinter Nights Script Compiler/Decompiler
Copyright 2002-2003, Edward T. Smith
Rewritten for Star Wars: Knights of the Old Republic
by Fred Tetra to work with Kotor Tool
"You want to help everyone who asks for aid, answer all of their questions, write that crucial bit of code for which they're searching, and be the hero who saves the day (and their job), but there comes a point when you realize that sleep is sometimes necessary."
—Stephen Toub
"You want to help everyone who asks for aid, answer all of their questions, write that crucial bit of code for which they're searching, and be the hero who saves the day (and their job), but there comes a point when you realize that sleep is sometimes necessary."
—Stephen Toub
I have question. Say I am following the instrcutions for Case #4 as you describe it above. Does nwnnsscomp still require the -g 2 parameter even though the extracted TSL nwscript.nss is in the same directory?
I have question. Say I am following the instrcutions for Case #4 as you describe it above. Does nwnnsscomp still require the -g 2 parameter even though the extracted TSL nwscript.nss is in the same directory?
No, it doesn't, since the default behavior is for the compiler to look in it's own directory first.
The -g switch is so that you can do things like put the nwscript.nss for each game in it's respective override folder and specify which one will be used.
"You want to help everyone who asks for aid, answer all of their questions, write that crucial bit of code for which they're searching, and be the hero who saves the day (and their job), but there comes a point when you realize that sleep is sometimes necessary."
—Stephen Toub
"Beware the form-fitting black armor-clad Drow hottie with twin Mineral II Greensteel Khopeshes!"
"Liella d'Orien says, '"You're the fool, Devil. -- Witness the power of this fully ARMED and OPERATIONAL Titan!"'"
"You want to help everyone who asks for aid, answer all of their questions, write that crucial bit of code for which they're searching, and be the hero who saves the day (and their job), but there comes a point when you realize that sleep is sometimes necessary."
—Stephen Toub
Working so, we will learn history as a tree knows it; we will climb into shapes printed in the seed; we will become time made visible, years made fragrant; we will make of concentric memory a stem of praise; we will inhabit daylight at a trees own speed; we will be travelers who remain, patriots to this ground.
OMG I only rank 62.13018% geek or a Extreme Geek as it is referred to on the geektest at Geektest [TSL]Holowan Plugin
Originally posted by Uchiha Itachi It seems I attract problems.....
I downloaded this new version and was about to test it when I got this error, I made an output:
Lookup path root set to: C:/NeverwinterNights/Nwn/
Error: Couldn't initialize the NwnStdLoader
Any ideas on what could have caused this?
In the folder its the nwnnsscomp, the nwscript.nss and my script.
I simply opened a command propt on a folder using the way tk102 described once.
The error you see could happen for a number of reasons. What is the command line you entered?
"You want to help everyone who asks for aid, answer all of their questions, write that crucial bit of code for which they're searching, and be the hero who saves the day (and their job), but there comes a point when you realize that sleep is sometimes necessary."
—Stephen Toub
There is one thing I didn’t like with this version and that is that I have to set the path and name of the file to compile. With the previous NWNNSSCOMP I just dropped the NWNNSSCOMP and my bat file in a directory and compiled the scripts that was in that directory.
My bat file had this in it: NWNNSSCOMP -c Source\* Override\
This way I had the NWNNSSCOMP in the top directory, the source files in the source directory and the compiled files was put in the Override directory. And all files was compiled
Is it possible to change this? Or is this just a preference that I like
is this only to be used with KT?? cuz if so i cant figure out how... if not.. than i get a real funky thing when i run the exe... i get a dos prompt that scrolls through ... what looks like this line nwnnsscomp {-c|-d} [--outputdir <Directory Path>] [-o <File Name>] [-g
<Game number>] [--optimize] [--] [-v] [-h] <file name> ...
Originally posted by sketch42 is this only to be used with KT?? cuz if so i cant figure out how... if not.. than i get a real funky thing when i run the exe... i get a dos prompt that scrolls through ... what looks like this line nwnnsscomp {-c|-d} [--outputdir <Directory Path>] [-o <File Name>] [-g
<Game number>] [--optimize] [--] [-v] [-h] <file name> ...
a million times an never stops
So you mean when you open a command window (Start | Programs | Accessories | Command Prompt) and type nwnnsscomp (the rest of your commandline here), it just shows the help over and over again?
Don't see how that could happen.
Here's what it should look like when you run nwnnsscomp from the commandline:
"You want to help everyone who asks for aid, answer all of their questions, write that crucial bit of code for which they're searching, and be the hero who saves the day (and their job), but there comes a point when you realize that sleep is sometimes necessary."
—Stephen Toub
nwnnsscomp is a compiler/decompiler for use with Star Wars: Knights of the Old Republic
(KotOR) and Star Wars: Knights of the Old Republic: The Sith Lords (KotOR:TSL).
It is was originally written by Edward T. Smith for compiling NeverWinter Nights scripts.
It has been updated since that time by Fred Tetra to work with KotOR and KotOR:TSL.
nwnnsscomp is a command-line only tool; no Windows GUI is present and it must be run
from the Command Prompt.
Setting up the environment
--------------------------
There are several cases that might apply to the way you want to work with the compiler:
Case 1: Compiling KotOR I script files with only KotOR I installed
No special setup is needed. The compiler will use the nwscript.nss file contained in
the game's scripts.bif file.
Case 2: Compiling KotOR I script files without KotOR I installed
Some users may wish to compile scripts on a different machine from where KotOR is
installed. You will need to use a utility such as Kotor Tool to extract the nwscript.nss
file from scripts.bif and put it in the same folder as nwnnsscomp.
Case 3: Compiling KotOR:TSL script files with only KotOR:TSL installed
If you have the US version of the game, You will need to use a utility such
as Kotor Tool to extract the nwscript.nss file from scripts.bif and put it in the same
folder as nwnnsscomp. If you have a non-US version, there is a syntax error in the
nwscript.nss file; you will have to either extract the file and fix the error or obtain
a copy with it corrected first.
Case 4: Compiling KotOR:TSL script files only without KotOR:TSL installed
Some users may wish to compile scripts on a different machine from where KotOR:TSL is
installed. If you have the US version of the game, You will need to use a utility such
as Kotor Tool to extract the nwscript.nss file from scripts.bif and put it in the same
folder as nwnnsscomp. If you have a non-US version, there is a syntax error in the
nwscript.nss file; you will have to either extract the file and fix the error or obtain
a copy with it corrected first.
Case 5: Compiling KotOR I and KotOR:TSL script files with both games installed.
If you are compiling script files for KotOR I and KotOR:TSL installed, perform the
following steps:
Extract the nwscript.nss file from KotOR I's scripts.bif into KotOR I's Override folder
US version of KotOR:TSL:
if you have a US version of KotOR:TSL, extract the nwscript.nss file from KotOR:TSL's
scripts.bif into KotOR:TSL's Override folder. If the Override folder doesn't already
exist, create it first.
Non-US version of KotOR:TSL:
There is a syntax error in the nwscript.nss file; you will have to either extract the file
from KotOR:TSL's scripts.bif and fix the error or obtain a copy with it corrected first.
Copy the file to KotOR:TSL's Override folder.
Examples
--------
Compile multiple source files for KotOR:TSL, putting the output files all in one directory:
Release history
---------------
1.03 - 2005-3-16
Adjusted a feature in TCLAP (Command Line Parser) that prevented proper wildcard
handling of .nss files
1.02 - 2005-3-4
Updated to work with KotOR II:TSL, supporting override folder look-up for nwscript.nss
1.01 - 2004-10-29
Initial version rewritten for Star Wars: Knights of the Old Republic by Fred Tetra
to work with Kotor Tool
NeverWinter Nights Script Compiler/Decompiler
Copyright 2002-2003, Edward T. Smith
Rewritten for Star Wars: Knights of the Old Republic
by Fred Tetra to work with Kotor Tool
"You want to help everyone who asks for aid, answer all of their questions, write that crucial bit of code for which they're searching, and be the hero who saves the day (and their job), but there comes a point when you realize that sleep is sometimes necessary."
—Stephen Toub
Originally posted by Fred Tetra
No, it doesn't, since the default behavior is for the compiler to look in it's own directory first.
I think this is still true, but the output of the .exe is lying to me.
Here's the experiment I tried:
My computer where the registry contains SWKOTOR path of "D:\SWKOTOR" (and the game files are present relative to that path).
I have a script that looks like this:
Code:
void main() { ActionSwitchWeapons(); }
(note this function is a TSL-only function.
I then place TSL's nwscript.nss in the same folder as my .nss and execute nwnsscomp.exe with only -c myscript.nss as parameters.
The output is the following:
Code:
Lookup path root set to: d:\swkotor\
Compiling: myscript.nss
Total Execution time = 30 ms
and the .ncs is generated. (So it must have used the TSL nwscript.nss though it said it used the KotOR version.) And of course, if I remove nwscript.nss from the folder I get errors due the unidentified function.
If you're wondering, I'm trying to modify the nsscomp.bat file to accommodate the new syntax for your version.
Originally posted by tk102 I think this is still true, but the output of the .exe is lying to me.
Here's the experiment I tried:
My computer where the registry contains SWKOTOR path of "D:\SWKOTOR" (and the game files are present relative to that path).
I have a script that looks like this:
Code:
void main() { ActionSwitchWeapons(); }
(note this function is a TSL-only function.
I then place TSL's nwscript.nss in the same folder as my .nss and execute nwnsscomp.exe with only -c myscript.nss as parameters.
The output is the following:
Code:
Lookup path root set to: d:\swkotor\
Compiling: myscript.nss
Total Execution time = 30 ms
and the .ncs is generated. (So it must have used the TSL nwscript.nss though it said it used the KotOR version.) And of course, if I remove nwscript.nss from the folder I get errors due the unidentified function.
If you're wondering, I'm trying to modify the nsscomp.bat file to accommodate the new syntax for your version.
Ah, I see what you're saying.
The
Code:
Lookup path root set to: d:\swkotor\
message means that the compiler is using that path as the one to look in for the chitin.key file and override folder. This is the default behavior - choosing KotOR as the game version - as the default value for the 'g' argument is 1. Since you supplied the nwscript.nss file locally, that takes precedence.
The search order the compiler uses (in order of precedence) is:
Local directory
The override folder for the game specified by the -g argument
The file referenced in the chitin.key file for the game specified by the -g argument
I hope that clears it up a bit. The compiler can actually search other places, too, but those are more relevant to NWN.
"You want to help everyone who asks for aid, answer all of their questions, write that crucial bit of code for which they're searching, and be the hero who saves the day (and their job), but there comes a point when you realize that sleep is sometimes necessary."
—Stephen Toub
I tried to do it through project manager, I followed everything you say, but it gives me a [continue] [exit] error stating it cannot find C:/Program Files/LucasArts....... k_inc_force.ncs
why is it looking for ncs file???
"Definition: "Love" is making a shot to the knees of a target 120 kilometers away using an Aratech sniper rifle with a tri-light scope." HK-47
Originally posted by Arlen Treesong I tried to do it through project manager, I followed everything you say, but it gives me a [continue] [exit] error stating it cannot find C:/Program Files/LucasArts....... k_inc_force.ncs
k_inc_force in an include file and is not compiled as a stand-alone script. You need to place k_sp1_generic.nss in that folder and compile it instead. (It has the #include "k_inc_force" directive in it.)
Originally posted by envida Sweet, not having wildcard prevented me from using this version
Thank you
You're welcome!
It was just a matter of getting the time to figure out what was causing the error and fixing it. (Like always!)
In this case, the problem was the TCLAP code that processes the command line. Since it is intended to work in environments where the shell expands wildcarded names before the commandline is processed, it was using the '*' character for another purpose (which we don't care about). I substituted a '$' for that purpose, allowing the '*' in file names to work right. (obviously, this is the short explanation, heh heh).
"You want to help everyone who asks for aid, answer all of their questions, write that crucial bit of code for which they're searching, and be the hero who saves the day (and their job), but there comes a point when you realize that sleep is sometimes necessary."
—Stephen Toub
I just reformatted my computer, so I'm guessing there's some file that I've forgotten to download, or I haven't done something I needed to do, because I'm getting this when I try to compile a script:
'nwnnsscomp' is not recognized as an internal or external command,
operable program or batch file.
Originally posted by Mono_Giganto I just reformatted my computer, so I'm guessing there's some file that I've forgotten to download, or I haven't done something I needed to do, because I'm getting this when I try to compile a script:
'nwnnsscomp' is not recognized as an internal or external command,
operable program or batch file.
Can anyone point me in the right direction here?
You'll see this message when the command interpreter could not find what you wanted to execute in neither the local directory nor in andy of the directories in your PATH environment variable. If you type PATH in a command window, you'll see all of the directories that will be searched.
For me, I usually just place the compiler and the scripts in the same place, CD there, and execute the command line.
Nwnnsscomp 1.03 can reside in a different directory from both the source and output files, as you can specify paths for both of those separately. Just CD to the directory where nwnnsscomp is, then exeute a command line like one of the examples in the readme.txt file.
Email me if you have further questions.
(P.S. You can always is the Project Mananger in Kotor Tool, too, if you like GUI's better)
"You want to help everyone who asks for aid, answer all of their questions, write that crucial bit of code for which they're searching, and be the hero who saves the day (and their job), but there comes a point when you realize that sleep is sometimes necessary."
—Stephen Toub
Can you please help me to get this working? I can't seem to get it to do anything, it won't even find the files(they're sat next to it in the same folder of course), let alone compile them into an .ncs.
Needless to say, the first and most obvious question is how do I know if the nwscript.nss file is the right one? You say in the opening post that it has a syntax error, yet what that error might be, and how to correct it...
...can anyone elaborate?
Secondly, how can I test if mine is the bugged one? I didn't extract it from KotoR II myself, as I haven't a clue how to do that, but I found it in my Override folder, evidently left in the Source Scripts by a scripter who'd uploaded work and left it in. Needless to say, if he/she has created scripts that I've DL'd, that would suggest at least that this nwnscript file is ok. Afterall, if his/her file had the syntax error, he'd never have been able to compile his/her scripts and finish his/her mod... n'est pas?
So... if for the moment we can assume that this nwscript file IS ok, can you help me to understand how to get this tool to work?
At present, I have the compiler, my .nss UNcompiled script, and the nwscript.nss file all in exactly the same folder... so it shouldn't have difficulty finding the script.
Now, I go to Start, and choose "Run", and I type in: "C:\Program Files\LucasArts\SWKotOR2\nwnnsscomp.exe -c ss-peragus-items.nss", but I get a Windows error "thump", saying, "Windows cannot find file "Program". Please make sure you typed in the name correctly" etc.
Ok, so it can't handle spaces in a filepath, I guess. Seems a bit odd to me, since I was led to believe that "Program Files" is the default folder into which software such as games get installed, so I'd have figured more people would've had this error.
Regardless, I moved the relevant files UPwards, and put them in "C:\Compiler". No spaces there, and a short filepath that should be easy to find. This time I type, "C:\Compiler\nwnnsscomp.exe". Still it tells me it cannot find it.
Please can you help? I've tried so many different things. Double-clicking the .exe is of course right out(tried that). And the maddening thing really is that I'm only trying to compile ONE simple script. All the batch functions, wildcard facilities and so on, and all the fiendishly clever features that I genuinely appreciate you must've worked really hard on, are far beyond my own modest requirements. I simply want it to look in one folder(where the compiler is), and and find one .nss script, and create a compiled version in the same folder.
But I can't even get Windows to execute the compiler.
Any chance you can help? I'd really appreciate it.
I know if the nwscript.nss file is the right one? You say in the opening post that it has a syntax error, yet what that error might be, and how to correct it...
There should be a link in this thread to a corrected version of nwscript.nss. I don't remember exactly what the problem was.
Quote:
Originally Posted by Thraxwhirl
At present, I have the compiler, my .nss UNcompiled script, and the nwscript.nss file all in exactly the same folder... so it shouldn't have difficulty finding the script.
Since I don't use KotorTool's version of nwnnsscomp I don't remember for sure, but I think you need to stick the nwscript.nss file and any include files used in the game's override folder for it to find them.
(Personally I prefer tk102's version of nwnnsscomp which keeps the nwscript.nss file in the same folder as the compiler and any include files in the same folder as the script being compiled. Makes it easier to organize projects in folders and such, and to integrate the compiler with a text editor. Personally I like using UltraEdit to write scripts since it allows you to run the compiler with the press of a button, and presents any error messages allowing you to click on one to go to that line in the script. Makes it much nicer to work with than having to fiddle with the command line all the time Like:
Show spoiler
)
Quote:
Originally Posted by Thraxwhirl
Now, I go to Start, and choose "Run", and I type in: "C:\Program Files\LucasArts\SWKotOR2\nwnnsscomp.exe -c ss-peragus-items.nss", but I get a Windows error "thump", saying, "Windows cannot find file "Program". Please make sure you typed in the name correctly" etc.
You should probably run it via a batch file with a pause (like more) following it, or from the commandline (type cmd in the Run box], otherwise you won't see any feedback or error messages the compiler outputs before the window closes.
As for your problems to run the compiler it's hard to tell what might cause it without knowing what you are doing and how exactly.
Thank you so much for your helpful reply. It turns out that what you posted has proven FAR more useful, and indeed simple, than you might have imagined. I followed your link to the thread where I can DL the newer file, and it also gave instructions for using KotoR Tool to compile scripts. It's incredibly simple, and it works! Even a techno-iliterate such as myself can follow it, and KotoR Tool compiles scripts quite handsomely in no time at all.
Given how easy it is to use KotoR Tool to do this, and given that - unless I am mistaken - it's written by the same author(ie. Fred Tatra), it does leave me wondering why anyone would still use the NW Compiler. Seems a little obsolete to me, not to mention very complicated and difficult to use... but I guess some folk do have their reasons for sticking to this method. As I say, I'm not the most techno-literate of folk, so I'm probably missing something obvious.
Regardless, KotoR tool does it perfectly satisfactorily, and I am very grateful to you for providing that link. Many thanks.