How can I use VSCode to edit custom module scripts?

Hi everyone! I’m trying to get back into mod creating for NWN:EE and I forgot just how bad the script editor is! I would love to use VSCode as my script editor but it looks like all the .nss files are bundled in the .mod and I’m not sure how I could set up a good workflow for editing these because of this, but it sounds like some of you on here are using VSCode happily so I was hoping you could share some instructions on how to get VSCode up and working as an editor for the custom scripts in my mods, and any useful tips you might have to help the workflow not be too painful?

Most builders who claims toolset has bad script editor never explored/learned all its features and options.

And I will never understand what is the advantage of coding in external tool and need to compile scripts manually via another tool or copy them into module, open toolset editor and compile them there only to find out you made an error. But that is just me…


I’m not sure how external editors help, but the easy way to do that is

  • Open the module in the toolset
  • Use the external editor to change the .nss files in modules\temp0
  • Make a trivial change in the toolset to enable save

This works because a toolset save bundles whatever it finds in the temp0 folder into the new .mod file.


Here’s a tutorial about setting up VSCode + NWNSC for NWNEE:

Well, in general you’re right. There is just one thing I hate: the editor is a bounded form, I can’t open anything else, while I editing code (save other scripts).

“So, how was this @!/&%$ Tag of this &%/!!@ item again??”

Sometimes I simply forget to write down all the Tags and blueprit-ID,'s etc (with separate notepad) I need for coding and have to abort the editor to have a look elsewhere.
Maybe I havn’t seen all features as well. How do you handle this problem?

1 Like

This is exactly what I was hoping for! Thank you very much!

Well, from what I understand, you should be able to setup VSCode to compile on save just like the in game editor, which should fix that issue. Mostly I’m just looking for quality of life improvements though. Dark mode, multi-select highlighting, hell even just find and replace! Probably the most frustrating is the way the in game editor handles white space. I use my keyboard to navigate while editing code a lot and constantly find myself out in no man’s land in this editor, forcing me to reposition my insert with my mouse. Maybe there’s some special commands to get a lot of features out of the in game editor but I never learned vim, why would I want to take the time to learn this editor?

The point of an external editor is to complement the inbox editor (which gets the job done and has only a few quirks), not to replace it. For example, for multi-file pattern matching and replacement. For advanced users, configuring an IDE to do a one-click compilation with nwnsc is also possible. There are solutions in the Vault for that too.

This is the best approach in terms of not using any additional programs - the toolset does all packing and unpacking. Smart IDEs should also detect changes to the extracted files if one of them is edited inside the toolset.

There is only one catch: because modern editors may assume UTF-8, script source in temp0 must be explicitly opened with ISO-8859-1 (aka Latin-1) encoding to avoid garbling the characters outside the 7-bit ASCII range on save (mostly color tags).

Some of us are professional software developers who have used real editors for code for years. Using such instead of the toolset editor is much faster and more efficient. Muscle memory for key strokes and the like as well as multiple files views, better highlighting, easier text search and manipulation, etc. You can get auto complete in some editors as well. I use sublime text with emacs key bindings and it will auto complete most nwnscript functions constants and variables.

Also the toolset editor has some issues when used in wine. In some cases the fonts is messed up and you can’t tell where the cursor actually is, deletes characters and spaces you don’t want.
Plus on most unix/linux systems cut and paste is hightlight with mouse and middle button. No ctrl-c/ctrl-v needed.

In addition, using an external editor encourages good practices like source control.

I just find the toolset editor to be almost unusable. But clearly others are okay with it :slight_smile:

I wish other scripting editors I worked with over years had the features of nwn toolset. The only annoyance is that the script editor prevents working on areas/blueprints when opened.

Anyway, VS is pretty good editor, if you can get intellisense working, show functions headers, autocomplete that nwn toolset has (indeed not as powerful as VS but it is there and I basically don’t code without it), and set it up so it compiles on pressing F7, that might be really worth it.

But over the time most of these ppls just coded in notepad++ or similar text editor that offers absolutely nothing of this other than syntax hilite (which nwn toolset has as well). So I never understood what is the point.

I guess my experience is so different because I am not professional software developer and I basically started with NWN1 Script Editor…

darkmode - check
find&replace - check

both of these are in top icons menu, search replace can be executed via CTRL+R which is pretty standard in windows, search CTRL+F in fact the if you hover over the icons in top menu and there aren’t many of them it tells you what they do and if they have a shortcut.

F2 - autocomplete
TAB/SHIFT-TAB - code indentation, works with multiple rows selected as well
double click on the function or constant in code - shows the function parameters and description in bottom “status bar” or constant value (EE only) or variable type

I don’t understand your issue with spaces, perhaps it is something linux related? As windows user I have the opposite problem with linux text editors :slight_smile:

I use npp for practically all plain text operations not just coding. Apart from the tabs and the rich set of tools that’s built in, there are also the plug-ins (there’s loads of them). The ones relative to NwN that I currently have installed are -

  • Compare - compare the contents of 2 tabs. Can produce diff files for SVN (subversion) and Git. Can also identify the difference between the currently loaded file and its previous incarnation.
  • DSpellcheck - a programmers spellchecker. Only checks the spelling of things between double quotes.
  • NppExport - Convert the currently open tab to either RTF or HTML.
  • TortoiseSVN - Full integration with that version control program. Only drawback is that you need to have TortoiseSVN installed as well as npp.
  • Snippets - Snippet manager wherein you can store and retrieve regularly used pieces of code.

I do have others installed but they’re not relevant to this discussion. I currently haven’t needed to use NppExec which lets you call an external program (e.g. an external compiler) without leaving npp. As far as the syntax highlighting is concerned, you actually need an external set of rules such as fancy colours to achieve that.

But that’s just me. At the end of the day it’s what you feel most comfortable with using to achieve what you want.


Yeah another functionality that is natively in toolset editor :wink: , but ok NWN:EE install doesn’t come with base templates anymore so to the newer coder this might not look obvious how to use/what is this.

If the code to do it is still in the toolset, why not make a set of templates and post them on here with instructions for those not aware of the feature?


Honestly I never needed this functionality nor any other from your list. I mean, yes sure files comparing that something I use every day but I don’t think it has anything to do with scripting.

CTRL+C and CTRL+V is sufficient for me enough for this purpose. And with autocomplete it is not so big deal to write “classic” loops (where I can imagine this could come handy) either.

If you’d like to setup a development environment that minimizes the use of the toolset, look into nasher combined with vscode. With these two tools, you’ll never need to open the toolset unless you’re editing gff resources, and even some of those can edited in vscode. It’s a great combination. I’m available via PM or on discord if you need help with it.

As I said, it’s wine related. Wine is the not-an-emulator layer that allows the toolset to run on Linux. Since there is and will never be a native toolset that’s pretty much the only way to do it. This last point is key too though. There not being a native toolset, I do all the work I can outside of the toolset so that I can use native apps and tools. That basically means I use the toolset to create areas and paint things in those areas. Occasionally, I do a conversation that is not scripted with zdialog and that I use the toolset for. Everything else I can do with native tools.

As a Windows user why are you using Linux text editors? :slight_smile: As a Linux user my only way to run the toolset is to run the windows toolset with all its windows-isms (plus translated through wine).

There’s one more advantage of editing scripts outside the toolset.

When the toolset is not the active window, it ceases to update the 3D view, significantly reducing its CPU load (in foreground, it run at 100% even if no area is displayed). This may prevent fans from spinning, making one’s PC / laptop less noisy (and wasting less energy in the process).