Author Topic: Advanced Script Compiler for NWN1 release thread  (Read 7371 times)

Legacy_Agmorion

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #45 on: May 18, 2012, 11:17:03 pm »


               Hi Skywing,

I was very interested in this new script compiler for continuing development in NWN1.  I have a lot of scripts I wrote for the Bard Tale 1 module rebuild I did in the vault some years ago, and I've been now tinkering with the Bard's Tale 2: The Destiny Knight module(s) when I stumbled across this great new tool.

But for some reason it crashes when compiling the scripts I've written in the past.

To get straight to the point, I have a very simple script that crashes the compiler without much ceremony.  I'll include it here as it's pretty small.  Perhaps you can let me know what's wrong with it.

#include "NW_I0_GENERIC"
int StartingConditional()
{
    return (GetAssociateState( NW_ASC_DISARM_TRAPS ) == FALSE) ? TRUE : FALSE;
}

The command line I'm using is:
NWNScriptCompiler -1cl -r . -n G:\\NeverwinterNights\\nwn testscript.nss

Any help would be greatly appreciated.

-Agmorion
               
               

               
            

Legacy_Alex Warren

  • Sr. Member
  • ****
  • Posts: 326
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #46 on: May 20, 2012, 10:45:41 am »


               Could you try this script:

#include "NW_I0_GENERIC"
int StartingConditional()
{
   return (!GetAssociateState( NW_ASC_DISARM_TRAPS ));
}

it's a bit simplier and it will work exactly the same as your script.
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #47 on: May 21, 2012, 08:42:43 am »


               Thanks for the report - always interested in compiler crashes.

This doesn't repro with the NWN2 includes using the current compiler drop.

Can you link me a zip that includes all of the latest .nss files (including nwscript.nss) that ship with the current NWN1 patch?  I don't think that I have the current version of these handy, and the repro might be dependant on something in the include set.
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #48 on: May 24, 2012, 04:40:51 am »


               Release 12 posted.  Direct download link (same as always):
http://www.nynaeve.n...iptCompiler.zip

Release 12:
-----------

- The pcode dump mode now works again for the standalone compiler.

- The compiler now allows compiled scripts to be up to 64MB, versus up to the
 old limit of 512K.  It is strongly recommended that scripts be kept under
 512K compiled size for both compile-time and runtime performance reasons.

- The compiler now provides a proper compile time error (NSC1036) if a script
 exceeded the maximum compiled script size.  Previously, the compiler asserted
 in this condition.

Release 11:
-----------

- In compatibility mode, the compiler will now terminate an unterminated
 comment block at the end of an include file.  This improves compatibility
 with certain ill-formed third party scripts.  In compiler version 1.70 or
 higher, the fixup is not performed.
               
               

               
            

Legacy_Dark_Ansem

  • Full Member
  • ***
  • Posts: 148
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #49 on: May 26, 2012, 11:37:34 am »


               wait, I thought this was for NWN2 only= we can use the dll extension also for NWN1?
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #50 on: May 26, 2012, 07:26:37 pm »


               You can use the toolset plugin module (NWNScriptCompilerDll.ndl) with virusman's NWNTX for NWN1 as well.

The standalone compiler (NWNScriptCompiler.exe) can be used with NWN1 or NWN2 (or other games using NWScript).
               
               

               
            

Legacy_Dark_Ansem

  • Full Member
  • ***
  • Posts: 148
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #51 on: May 26, 2012, 08:41:05 pm »


               thank you. would any module done with it require the NWNTX extension to be played?
               
               

               
            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #52 on: May 27, 2012, 12:58:53 am »


               No
               
               

               
            

Legacy_Sherincall

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #53 on: June 09, 2012, 04:48:52 pm »


               Wonderful stuff! #define is awesome, I even use it as typedef.

Would it be possible to add another optional layer of code processing to the compiler, either before or after macro expansion.. I want to add syntax support for a few things (for example, arrays). I could run that program before the compiler for every script, but then I won't be able to use it in NWNTX.

A simple ini option to specify the program to parse the script before the compiler would do wonders, and then just send the script as stdin and get the result as stdout of that program.. Or if it's easier, specify an interface and load the parsers from a dynamic library.

One more question.. Does the new #include work like in C/C++, or does it add only the symbols that were used. What about multiple definition? Do we need include guards?

Thanks again, for this great toy..
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #54 on: March 02, 2013, 07:35:13 am »


               Release 13 posted. New NWNScriptCompiler.exe and NWNScriptCompilerDll.ndl (toolset plugin compiler core DLL).  Download link on the first post in the thread.

Release 13:
-----------

- Added -j option to standalone compiler to show where an include file was
really picked up from (useful for debugging include priority ordering
problems).

- The compiler now correctly disambiguates between struct tag symbols and other
symbols (improved language conformance with the BioWare compiler).

- Added support for recognizing the GOG.com NWN2 edition installation path.
               
               

               
            

Legacy_Dark_Ansem

  • Full Member
  • ***
  • Posts: 148
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #55 on: March 02, 2013, 08:08:03 am »


               thanks!
               
               

               
            

Legacy_SkywingvL

  • Full Member
  • ***
  • Posts: 115
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #56 on: March 02, 2013, 08:10:32 pm »


               

Sherincall wrote...

Wonderful stuff! #define is awesome, I even use it as typedef.

Would it be possible to add another optional layer of code processing to the compiler, either before or after macro expansion.. I want to add syntax support for a few things (for example, arrays). I could run that program before the compiler for every script, but then I won't be able to use it in NWNTX.

A simple ini option to specify the program to parse the script before the compiler would do wonders, and then just send the script as stdin and get the result as stdout of that program.. Or if it's easier, specify an interface and load the parsers from a dynamic library.

One more question.. Does the new #include work like in C/C++, or does it add only the symbols that were used. What about multiple definition? Do we need include guards?

Thanks again, for this great toy..


Sorry, I hadn't seen this question before.

It would conceivably be possible to define some interface to allow preparsing of the source text if desired.  Drop me a PM if you're interested in this, with more details on what you're looking for.  Language extensions are probably best handled by extending the compiler itself though, particularly if they pertain to parsing more complicated than the preprocessor's very basic functionality.

Include is the same as the pre-existing #include already supported by the standard compiler (and earlier ASC versions); this functionality has not changed.  The way #includes work in NWScript is:

- If this is the first time that the include filename has been observed for this compilation unit, include the source text.
- Otherwise, ignore the #include directive (e.g. if the directive was specified twice).

This isn't as flexible as C-style includes.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #57 on: August 01, 2013, 03:50:20 am »


               I am using the latest SkywingvL's version and now when Im running win7 I got serious issue with compiling scripts.

Newly compiled scripts are names "*.nss.ncs" does anyone know solution for this? Running as administrator neither XP compatibility helped.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #58 on: September 05, 2013, 04:17:33 pm »


               

ShaDoOoW wrote...

I am using the latest SkywingvL's version and now when Im running win7 I got serious issue with compiling scripts.

Newly compiled scripts are names "*.nss.ncs" does anyone know solution for this? Running as administrator neither XP compatibility helped.

turns out its not win7 error, does this as well on my XPs too

also recently installed virtual XPs on my 7s and I cannot run it there, no matter whether i specify the path with -n or not it always throw the SSC1085 error unable to open include file 'standard_nwn_library_file', I copied nwn into standard path and added registry informations but nothing helps, I can run it on my brother's computer with XP fine but not on virtual.

Version: 1.0.0.2.4
batch file:

cd scripts
..\\nwnnsscomp.exe -g -o -e -l -1 -i ../includes -b ../scripts_compiled/ *.nss
pause


Anyway, Im very disappointed with this compiler. If it wasnt be one little bug in the original Torlacks I would never used this one. There are no extra features I would needed, only dozens options for NWN2 issues. First what annoyed me on this one was the need to specify numerous new options to normally run it for NWN1 while the original compiler didnt needed them. I understand the original compiler didnt worked for NWN2 but yours isnt backwards compatible with NWN1. I tried very hard to understand these choices, and keep using it but I always get soon kicked by some bug, missing functionality or incompatibility.

All I need is a Torlack's with the fix for the duplicate global/local structure names.

Does anyone have an older working version of this tool maybe? Author seems to be gone now.

EDIT: added image to the unable to open include file error:
'Posted
               
               

               


                     Modifié par ShaDoOoW, 05 septembre 2013 - 03:30 .
                     
                  


            

Legacy_painofdungeoneternal

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +0/-0
Advanced Script Compiler for NWN1 release thread
« Reply #59 on: September 05, 2013, 06:43:10 pm »


               You might want to try the toolset plugin virusman did, this would mean you don't have to figure out the command line options.
http://www.nwnx.org/...491b1daad57f58b