lfnetwork.com mark read register faq members calendar

Thread: How to compile scripts?
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 01-31-2005, 12:55 PM   #1
Darth333
Administraterror
 
Darth333's Avatar
 
Status: Administrator
Join Date: Feb 2004
Location: In my secret dungeon...
Posts: 8,292
How to compile scripts?

How to use the script compiler for Dummies * (*note: I was part of the "Dummies" too at some point - maybe I still am - so this is why I wrote this tutorial)

====================================
WARNING! KOTOR 2 TSL : XBOX and NON-AMERICAN/CANADIAN USERS:
there is a mistake in the nwscript.nss file included in the international and xbox versions of the game. If you want to be able to compile your scripts, you have to correct the error first. For more details, see This thread. This error would have been fixed with patch 1.0b. If it,s not, you can also download a ready to use fixed copy of nwscript.nss here.


====================================

note: double clicking on nwnnsscomp.exe won't get you very far: you need to use a command prompt or a .bat file (see below) to run it. If you don't know how to use a command prompt, read this article to get you started: http://www.pcstats.com/articleview.cfm?articleID=1723

====================================

You have 3 options to compile your scripts:

Advanced users: you can also decompile scripts with HazardX's and Fred Tetra's Script compilers but don't expect to get a .nss file: you'll get byte code (this is another reason why modders should release their source code). Check Torlak's page to learn to decipher decompiled scripts, and more particularly, this document contains valuable info.

-----------------------------------------------------------------------
A. How to use Hazardx script compiler/decompiler:

NOTICE CONCERNING TSL: if you are using HazardX script compiler, make sure you have nwscript.nss in the same directory as nwnnsscomp.exe, nwnnsscomp.exe will use it -- otherwise it will try to read it from the KotOR1 scripts.bif using the registry as a guide.

- for more information, read the readme that comes with the compiler -
  • Method 1: (use command prompt)

    1. Make a new folder anywhere on your PC or use the game Override directory and drop nwnnsscomp.exe along with your scripts (.nss files) and for Kotor 2, also add nwscript.nss in that folder.
    2. Open a command prompt in that folder and to compile all the scripts in your folder type
    Code:
    nwnnsscomp -v1.00 *.nss
    or, for a single script, type:
    Code:
    nwnnsscomp -v1.00 my_script.nss
    If you chose to open the command promt from the Start menu, make sure the path to the folder is correct. Example:
    Code:
     nwnnsscomp -v1.00 "c:\program files\blahblah\blah.nss"
    Note: all scripts need to use the -v1.00 switch when compiling with HazardX script compiler.

    You will find a practical trick to easily get to a command prompt from Windows Explorer right here - now you have no excuses to fear the little black window
  • Method 2: (make your own batch file)

    1. Create a new folder called Kotor_scripts (or whatever you want) or use the game's Override folder.
    2. Open notepad and paste the text :
    Code:
    NWNNSSCOMP -v1.00 *.nss
    del *.ndb
    pause
    then save it as Compile.bat and put the new Compile.bat in the same folder as the scripts you want to compile.
    3. Put NWNNSSCOMP.exe in same folder as the scripts you want to compile (in the folder Kotor_scripts or, as the case may be, in your Override directory)
    5. Double click the Compile.bat file (You should see a black command prompt popping out and if the script has compiled successfully you'll see:
    Quote:
    Compiling: blahblah.nss
    Total Execution time = 75ms (or whatever times it takes)
    6. press any key to close the command prompt.
    7 . Look into your folder where you initially put your scripts (Kotor_scripts - or if you used the Override directory, in the Override directory). You should now see the following files:
    - blahblah.nss (you don't need this one anymore but keep it for reference purposes and include it if you upload your mod somewhere!)
    - blahblah.ncs (this is the compiled script that you need)
  • Method 3: (pre-made .bat file)

    1. Make a new folder anywhere on your PC or use the game Override directory and drop nwnnsscomp.exe along with your scripts (.nss files).
    2. Download this premade .bat file attached at the bottom of the present thread.
    3. Unzip the .bat into the same directory as your scripts (.nss files) and the nwnnsscomp.exe file.
    4. Double-click the .bat file or run it from the command line.

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

B. How to use Fred Tetra's script compiler/decompiler:

-for more possibilities and if you have only one game installed, see this thread.
  • Method 1: (use command prompt)
    - Make a new folder anywhere on your PC or use the game override folder and drop nwnnsscomp.exe along with your scripts (.nss files).

    For Kotor 2 TSL

    1. For non U.S. versions of the game (everywhere in the world save USA and Canada): there is a syntax error in the nwscript.nss file. Fix that and put the corrected version of nwscript.nss into your KotOR 2:TSL's Override folder.
    2. Open a command prompt in that folder and to compile all the scripts in your folder type
    Code:
    nwnnsscomp -c -g 2 *.nss
    or, for a single script, type:
    Code:
    nwnnsscomp -c -g 2 my_script.nss
    If you chose to open the command promt from the Start menu, make sure the path to the folder is correct. Example:
    Code:
     nwnnsscomp -c -g 2 "c:\program files\blahblah\myscript.nss"
    For Kotor 1
    - Open a command prompt in that folder and to compile all the scripts in your folder type
    Code:
    nwnnsscomp -c -g 1 *.nss
    or, for a single script, type:
    Code:
    nwnnsscomp -c -g 1 my_script.nss
    (If you chose to open the command promt from the Start menu, make sure the path to the folder is correct. Example:
    Code:
     nwnnsscomp -c -g 1 "c:\program files\blahblah\myscript.nss"
    You will find a practical trick to easily get to a command prompt from Windows Explorer right here - now you have no excuses to fear the little black window
  • Method 2: (make your own batch file)

    1. Create a new folder called Kotor_scripts (or whatever you want)
    2. Open notepad and paste the text :

    - For Kotor 2:TSL: (note: this method cannot be used if you have a version of the game other than the American/Canadian version because of a syntax error in nwscript.nss)
    Code:
    @echo off
    nwnnsscomp -c -g 2 *.nss
    pause
    (note: For non U.S. versions of the game (everywhere in the world save USA and Canada): there is a syntax error in the nwscript.nss file. Fix that and put the corrected version of nwscript.nss into your KotOR 2:TSL's Override folder before compiling)

    - For Kotor 1:
    Code:
    @echo off
    nwnnsscomp -c -g 1 *.nss
    pause
    then save it as Compile.bat and put the new Compile.bat file in the same folder as the scripts you want to compile.

    3. Put NWNNSSCOMP.exe in same folder as the scripts you want to compile (in the folder Kotor_scripts)
    5. Double click the Compile.bat file (You should see a black command prompt popping out and if the script has compiled successfully you'll see:
    Quote:
    Compiling: blahblah.nss
    Total Execution time = 75ms (or whatever times it takes)
    6. press any key to close the command prompt.
    7 . Look into your folder where you initially put your scripts (Kotor_scripts). You should now see the following files:
    - blahblah.nss (you don't need this one anymore but keep it for reference purposes - and include it if you upload your mod somewhere!)
    - blahblah.ncs (this is the compiled script that you need)
Darth333 is offline   you may: quote & reply,
Old 01-31-2005, 12:56 PM   #2
Darth333
Administraterror
 
Darth333's Avatar
 
Status: Administrator
Join Date: Feb 2004
Location: In my secret dungeon...
Posts: 8,292
Compiling scripts with Kotor tool:

Before anything else, make sure you have enabled the view extensions option in Windows. If you haven't, open Windows Explorer and go to the Tools menu > Folder Options> View and uncheck "Hide extensions of known file types" and click OK.


1. Go to the tools menu
2. Select the text editor.
3. Then in the text editor window, go to the script menu, select your game (kotor 1 or kotor 2)
4. make your script, save with a .nss extension.
5. Either go to the script menu and select compile or simply press F5
6. The compilation should output a .ncs file.
7. Drop the .ncs file in the override folder (or pack it into a .mod file if you are creating a new module)
8. (optional but strongly recommended) If you distribute your mod, please include the source code (*.nss files) in the download package so others can see how it was done (that's how the Holowan labs forums were built: sharing info on modding)


Compiling scripts on a machine that doesn't have Kotor installed

Download NWNSSCOMP port for KotOR Script Compiler by stoffe and tk102.

Drop it in the same folder as your scripts and use:
Code:
 nwnnsscomp -c myscript.nss
or for several scripts:
Code:
 nwnnsscomp -c *.nss
Darth333 is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Tutorials: Scripting > How to compile scripts?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:28 PM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.