Jump to content

Home

New version of nwnnsscomp!


Recommended Posts

I have updated nwnnsscomp to better support KotOR:TSL.

 

Users can now specify which game the compiler should use when looking for the nwscript.nss file.

 

You can download it here:

 

nwnnsscomp 1.02

 

 

From the readme.txt:

 

nwnnsscomp Version 1.02 2005-3-4 Fred Tetra

 

Introduction

---------------

 

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:

 

nwnnsscomp.exe -c -g 2 --outputdir "C:\test output" script1.nss script2.nss script3.nss

 

 

 

Compile one source file for KotOR, putting putting the output file in the same directory:

 

nwnnsscomp.exe -c script1.nss

 

-or-

 

nwnnsscomp.exe -c -g 1 script1.nss

 

 

 

Compile one source file for KotOR:TSL, putting the output file in a directory and

specifying a different filename for it:

 

nwnnsscomp.exe -c -g 2 --outputdir "C:\test output" -o foo.ncs ft_invoke.nss

 

 

 

Command Line Reference

---------------------------

 

USAGE:

 

nwnnsscomp {-c|-d} [--outputdir <Directory Path>] [-o <File Name>] [-g

<Game number>] [--optimize] [--] [-v] [-h] <file name> ...

 

 

Where:

 

-c, --compile

(OR required) Compile an NSS file

-- OR --

-d, --decompile

(OR required) Decompile an NCS file to byte code

 

 

--outputdir <Directory Path>

(value required) Output directory for compiled/decompiled files

 

-o <File Name>, --outputfile <File Name>

(value required) Output file

 

-g <Game number>, --game <Game number>

(value required) KotOR Game Version: 1=KotOR, 2=KotOR:TSL; default=1

 

--optimize

Turn on code optimizations

 

--, --ignore_rest

Ignores the rest of the labeled arguments following this flag.

 

-v, --version

Displays version information and exits.

 

-h, --help

Displays usage information and exits.

 

<file name> (accepted multiple times)

(value required) file name(s) to compile/decompile

 

 

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

 

Version 1.02 2005-3-4 Fred Tetra

Link to comment
Share on other sites

Yes thank you Fred.

 

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?

Link to comment
Share on other sites

Originally posted by tk102

Yes thank you Fred.

 

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.

Link to comment
Share on other sites

Originally posted by Fred Tetra

I hope it helps all of you who like script coding as much as I enjoy making the tools available!

Thank's Fred! As I have to start getting into scripting now, this will definitely help reduce the headaches I'm sure to get ;)

 

BTW, I hope you're playing TSL too during your tools development. You've got more than enough "go for its" here:

 

http://www.lucasforums.com/showthread.php?s=&threadid=145117

 

Afterall, we'd hate to have to put you in "Time Out" for not getting to enjoy the game for a full playthrough .. hehe

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Thanks for this :)

 

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 :p

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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:

 

 

nwnnsscomp5sp.th.gif

(Click to go to the larger version)

Link to comment
Share on other sites

I have updated nwnnsscomp so that it properly handles wildcarded file names.

 

 

You can download it here:

 

nwnnsscomp 1.03

 

 

From the readme.txt:

 

nwnnsscomp Version 1.03 2005-3-16 Fred Tetra

 

Introduction

------------

 

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:

 

nwnnsscomp.exe -c -g 2 --outputdir "C:\test output" script1.nss script2.nss script3.nss

 

 

 

Compile one source file for KotOR, putting putting the output file in the same directory:

 

nwnnsscomp.exe -c script1.nss

 

-or-

 

nwnnsscomp.exe -c -g 1 script1.nss

 

 

 

Compile one source file for KotOR:TSL, putting the output file in a directory and

specifying a different filename for it:

 

nwnnsscomp.exe -c -g 2 --outputdir "C:\test output" -o foo.ncs ft_invoke.nss

 

 

 

To compile a .nss file with the .ncs output file going in the same directory:

 

nwnnsscomp -c mysource.nss

 

 

 

To compile a .nss file with a differently named .ncs output file going in the same directory:

 

nwnnsscomp -c --outputdir d:\myoutput\ mysource.nss

 

 

 

To compile a .nss file with a differently named .ncs output file going in a different directory:

 

nwnnsscomp -c -o d:\myoutput\mycompiledfile.ncs mysource.nss

 

OR

 

nwnnsscomp -c --outputdir d:\myoutput\ -o mycompiledfile.ncs mysource.nss

 

 

 

To compile a list of .nss files with the .ncs output files going in the same directory:

 

nwnnsscomp -c mysource1.nss mysource2.nss mysource3.nss

 

OR

 

nwnnsscomp -c *.nss

 

 

To compile many .nss files in the current directory via a wildcard with the .ncs output

files going in a different directory:

 

nwnnsscomp -c --outputdir d:\myoutput\ *.nss

 

 

To compile many .nss files in one directory via a wildcard with the .ncs output files

going in a different directory:

 

nwnnsscomp -c --outputdir d:\myoutput\ c:\sourcfiles\*.nss

 

 

 

NOTE: Any path that has spaces in it must be surrounded by double quote marks (").

For example:

 

nwnnsscomp -c --outputdir "d:\my output files\" *.nss

 

 

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

 

 

Command Line Reference

----------------------

 

 

USAGE:

 

nwnnsscomp {-c|-d} [--outputdir <Directory Path>] [-o <File Name>] [-g

<Game number>] [--optimize] [--] [-v] [-h] <file name> ...

 

 

Where:

 

-c, --compile

(OR required) Compile an NSS file

-- OR --

-d, --decompile

(OR required) Decompile an NCS file to byte code

 

 

--outputdir <Directory Path>

(value required) Output directory for compiled/decompiled files

 

-o <File Name>, --outputfile <File Name>

(value required) Output file

 

-g <Game number>, --game <Game number>

(value required) KotOR Game Version: 1=KotOR, 2=KotOR:TSL; default=1

 

--optimize

Turn on code optimizations

 

--, --ignore_rest

Ignores the rest of the labeled arguments following this flag.

 

-v, --version

Displays version information and exits.

 

-h, --help

Displays usage information and exits.

 

<file name> (accepted multiple times)

(value required) file name(s) to compile/decompile

 

 

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

 

Version 1.03 2005-3-16 Fred Tetra

 

Link to comment
Share on other sites

Originally posted by Fred Tetra

I have updated nwnnsscomp so that it properly handles wildcarded file names.

Bless you Fred, :worship:

 

I was about to start cussing my machine because I thought my .bat file was wanting to "......" with me (I had a wildcard entry line) :fist:

 

Maybe after I get home and download this one, I'll teach my machine "who's boss" ;)

 

yeah ok, I talk big when my computer isn't around.. hehehe..

Link to comment
Share on other sites

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:

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:

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. :)

Link to comment
Share on other sites

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:

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:

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

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...