Importing Scripts

Hello again. Wondering if there’s an easy way to import scripts into a module if they’re not in an .erf file. I work on most of my scripts in a dedicated development environment and my test setup uses NWNX ResMan, so no need to import, but the final product requires the scripts to be imported into the module. I currently do it the difficult way (create a new script in the script editor, copy and paste, compile, save). Is there an easier way?

Thanks,
Ed

If your software allows you to save your scripts with the “.nss” extension, you could then save them to a folder, desktop, thumb drive, etc… then with the toolset open, go to your NWN directory and open the module folder. Then drag and drop the files directly into the “temp 0” folder that is there. Compile in the toolset and save.

Thanks. I thought I tried that with no luck, but maybe I wasn’t paying enough attention. I’ll try again. Thanks!

It’s been a while since I did things this way but I think you may need to save the module then close and re-open it in the toolset to see them files you added behind its back.

There are also tools that let you unpack the module file into a directory and then repack it. For example there is the erf tool (of which I have a linux version in here - I think the original version could build on windows). Combined with an out of box compiler you can do all your scripting outside the toolset and still get it in the module when the time comes.

Also with the erf tool you can package up the scripts into an erf and import them.

I have a solution
I use a batch file that copies the files from the temp0 directory to a git folder on my local - subdividing the files by extension into appropriate folders.
Eg : NSS files go to the nss folder.
I make sure to leave out ncs files.

Anyway, I also have another batch file that does the opposite too
It loops through all files in the subdirectories, and copies them to the temp0 directory.
If your toolset is closed when you do this (you might need to make the temp0 directory manually in that case) - you will get a prompt from toolset when you open it next, saying that a module was recovered.
Click yes to recover it - and then toolset will rebuild the module from the loose files.
When you want to copy your module back to git - build and save your module to a filename - then while the module is open in toolset, run the batch file to copy from temp0 to git directory etc.

del I:\NWN\modules\temp0
mkdir I:\NWN\modules\temp0

for /R I:\nwn_divinity\src\itp %%f in (.itp) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\are %%f in (
.are) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\dlg %%f in (.dlg) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\gic %%f in (
.gic) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\git %%f in (.git) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\ifo %%f in (
.ifo) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\jrl %%f in (.jrl) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\nss %%f in (
.nss) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\utc %%f in (.utc) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\uti %%f in (
.uti) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\utp %%f in (.utp) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\utw %%f in (
.utw) do copy %%f I:\NWN\modules\temp0
for /R I:\nwn_divinity\src\utw %%f in (*.fac) do copy %%f I:\NWN\modules\temp0\

This copies from git to temp0

for /R I:\nwn_divinity\src\are %%f in (.are) do del %%f
for /R I:\nwn_divinity\src\dlg %%f in (
.dlg) do del %%f
for /R I:\nwn_divinity\src\gic %%f in (.gic) do del %%f
for /R I:\nwn_divinity\src\git %%f in (
.git) do del %%f
for /R I:\nwn_divinity\src\ifo %%f in (.ifo) do del %%f
for /R I:\nwn_divinity\src\jrl %%f in (
.jrl) do del %%f
for /R I:\nwn_divinity\src\nss %%f in (.nss) do del %%f
for /R I:\nwn_divinity\src\utc %%f in (
.utc) do del %%f
for /R I:\nwn_divinity\src\uti %%f in (.uti) do del %%f
for /R I:\nwn_divinity\src\utp %%f in (
.utp) do del %%f
for /R I:\nwn_divinity\src\utw %%f in (.utw) do del %%f
for /R I:\nwn_divinity\src\itp %%f in (
.itp) do del %%f
for /R I:\nwn_divinity\src\fac %%f in (*.fac) do del %%f

timeout 5

for /R I:\NWN\modules\temp0 %%f in (.are) do copy %%f I:\nwn_divinity\src\are
for /R I:\NWN\modules\temp0 %%f in (
.dlg) do copy %%f I:\nwn_divinity\src\dlg
for /R I:\NWN\modules\temp0 %%f in (.gic) do copy %%f I:\nwn_divinity\src\gic
for /R I:\NWN\modules\temp0 %%f in (
.git) do copy %%f I:\nwn_divinity\src\git
for /R I:\NWN\modules\temp0 %%f in (.ifo) do copy %%f I:\nwn_divinity\src\ifo
for /R I:\NWN\modules\temp0 %%f in (
.jrl) do copy %%f I:\nwn_divinity\src\jrl
for /R I:\NWN\modules\temp0 %%f in (.nss) do copy %%f I:\nwn_divinity\src\nss
for /R I:\NWN\modules\temp0 %%f in (
.utc) do copy %%f I:\nwn_divinity\src\utc
for /R I:\NWN\modules\temp0 %%f in (.uti) do copy %%f I:\nwn_divinity\src\uti
for /R I:\NWN\modules\temp0 %%f in (
.utp) do copy %%f I:\nwn_divinity\src\utp
for /R I:\NWN\modules\temp0 %%f in (.utw) do copy %%f I:\nwn_divinity\src\utw
for /R I:\NWN\modules\temp0 %%f in (
.itp) do copy %%f I:\nwn_divinity\src\itp
for /R I:\NWN\modules\temp0 %%f in (*.fac) do copy %%f I:\nwn_divinity\src\fac

While the batch file above copies to git.
This setup allows you to incrementally version control and build your module in a CI such as jenkins.

Awesome! Thanks for both of the replies. I haven’t been able to try anything yet today, but I’ll give it a shot tonight. Thanks again!

Yeah, that works too :slight_smile: I find it easier to package the module into a .mod file rather than going through the toolset all the time because I often go straight from scripting to running the module. Add to that the fact that I have to use wine to run to toolset…

But yes, git is the way to go. Also, you can convert the various gff files to a more revision control friendly (i.e. text) format. But that’s a whole different topic …

Thanks for all the pointers. I found an .erf editor that does exactly what I need.