Script Compiler for Enhanced Edition
Glorwinger
Member Posts: 41
*** UPDATE ***
I just posted an UPDATED script compiler to the vault and Github that works with NWN EE and the packed game files. This one is based on the Skywing compiler engine and is more robust and faster. There are a few things left on the ToDo list - visit the source repository below to see or add bugs and issues.
This has been tested on Windows, Linux, and Mac for both 1.74 (EE) and older 1.69 and things seem i order so far...
https://neverwintervault.org/project/nwn1/other/tool/nwnsc-nwn-enhanced-edition-script-compiler
Source code... https://gitlab.com/glorwinger/nwnsc
I just posted an UPDATED script compiler to the vault and Github that works with NWN EE and the packed game files. This one is based on the Skywing compiler engine and is more robust and faster. There are a few things left on the ToDo list - visit the source repository below to see or add bugs and issues.
This has been tested on Windows, Linux, and Mac for both 1.74 (EE) and older 1.69 and things seem i order so far...
https://neverwintervault.org/project/nwn1/other/tool/nwnsc-nwn-enhanced-edition-script-compiler
Source code... https://gitlab.com/glorwinger/nwnsc
Post edited by Glorwinger on
4
Comments
Thank you. It sounds like this may be a separate branch from Skywing's work, based on the same source. Is my understanding correct? [ Reference: https://neverwintervault.org/project/nwn2/other/tool/advanced-script-compiler-nwn2 ]
-Dave
-Dave
This is really awesome, also using Visual Studio Code now for nwscript and made a build task with your compiler.
Really awesome!!!
I put the nwnnss.exe in C:\Users\username\Documents\Neverwinter Nights
Then I created a .bat in the same directory with the following in it since that was the example on the NWVault page:
@ECHO OFF
nwnnss compile -p /Applications/Beamdog/00829 -u "/Users/username/Documents/Neverwinter Nights/" *.nss
PAUSE
And it always errors out with:
"Unable to locate or open Neverwinter Nights"
What am I doing wrong?
Something like `-p C:\Applications\Beamdog\00829`
Lastly, if you update your client in beam dog client the last directory name (00829) will change, so need to update your script everytime you update.
Give this one a try and report any issues here or better in the Issue tracker via the link above.
• Fixed several null pointers and segmentation faults
• Improved speed with compile optimizations
• Redundant -l command line option not required when passing -n
• When building for NWN EE the installdir ovr folder (override) will be processed for includes before the .bif files
• Added -M to create Makefile compatible dependency files
Changes - 1.0.0
$ /nwnsc -p /steam/steamapps/common/Neverwinter\ Nights/data/ temp0/*.nss Segmentation fault (core dumped)
I have tried all partial paths and no luck. strace tells me the following:
access("/steam/steamapps/common/Neverwinter Nights/data/", F_OK) = 0 open("/steam/steamapps/common/Neverwinter Nights/data/", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 fstat64(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 _llseek(3, 0, [2147483647], SEEK_END) = 0 _llseek(3, 0, [0], SEEK_SET) = 0 mmap2(NULL, 2147483647, PROT_READ, MAP_SHARED, 3, 0) = -1 ENODEV (No such device) mmap2(NULL, 2147487744, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x77514000 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xffffffff} ---
I wonder what is the directory I should point to the compiler?
nwnsc -m $(VER) -n $(NWN_INSTALL_DIR) -h $(NWN_HOME_DIR) *.nss
...
NSC1085: Unable to open the include file "zep_inc_main"
which will be on one of the CEP 2.65 haks. I am using version 1.0.0 - built Jun 2 2018 18:03:29 on linux. The above is from a makefile and the variables point to the right places.
PS-Hi GDL!
This may seem like a stupid question, but why can't we have a compiler like this
The compiler being discussed here is a command line compiler. Though limited, the compiler in the toolset has a gui. While this command line compiler may well be better at its job, I would much rather stick with a gui unless I have a pressing need for compiled code.
@Bohuntin I don't think this compiler has the ability to look inside haks. I certainly can't see such an option on the project page. The reason that the toolset script compiler can do so is because the toolset itself needs to open hak files so that you can use their contents when building a module. I suppose you could open your project in the toolset and then look in the temporary folder that the toolset creates when it opens a module but I don't know if the include file will be in there.
TR
I've been runnig it the same way for a few versions now, nothing changed on my side, code or command line; other than upgrading to NWN:EE 1.80 though BeamDog client
command line used
What is strange is that 1) it doesn't happen every time 2) when it does happen, it's usually a different file.
Everything compiles cleanly in toolset and with nwnsc.exe using NWN:EE < 1.80 version.
8193.7 was when they did the packing of the /ovr into the keyfiles - so I assume it is related.
Interesting, thanks for sharing. Have you found a work around ?
Does yours happened "randomly" too ? Works sometimes, but not others.
Only workaround I got so far is changing base game back to 8193.5 to compile, which is obviously a bit of a drag. I've heard there's changes to nwnsc that are only currently in the docker version which fix the issue, but haven't had time to extract and confirm that.
My current workaround is to just repeatedly run the command until it compiles everything without the "bad allocation" error. Usually takes 20-40 tries.
I am aware of the Docker container compiler, but installing Docker on my development machine is not an option right now.
I can't really account for why it worked before and not now. Maybe the binary that was on neverwintervault is an older one that doesn't have the EE escape chars in it - and the new patch released some content/scripts that triggered this?
I am not. Anyone have a link?