Skip to content

Notepad++ and NWScript

TarotRedhandTarotRedhand Member Posts: 1,481
edited September 2018 in Builders - Scripting
For those that don't know, notepad++ (npp from here onwards) is described as being a programmer's text editor. It has a modern tabbed interface and many features that make it attractive for writing NWScript scripts. I personally use it myself just for composing scripts but it can do more as I'll explain later. While the vanilla version is good its support for plugins and addons make it even better. So let's get started.

First, if you haven't yet got it here is npp's homepage. Once installed you will find, unsurprisingly, that it doesn't know about the syntax highlighting for our scripts. That's OK. We can fix this. What you need is a copy of Fancy Colors found on the vault. Download and extract to a folder of your choice. There is a small, but easily fixed, problem in that an update to the way npp stores this information broke this addon. As I said this is easily fixed.

Open npp. Click on Language in the menu at the top of of npp and scroll all the way to the bottom. There you will see an item called "Define your language...". Click on that. This will open a dialogue box. At the top of this box there are two buttons marked "Import" and "Export" respectively. Click on "Import". Navigate to whereever you put fancy colors. In that folder there is another called "res" and beneath that one called "notepad++". Open that folder. You should now be at something like - fancycolors_20091114_1.00.23.1765\res\notepad++. In this folder you will find a file called "userDefineLang.xml". Open that file and you're done. So now when you open the Language menu item and scroll to the bottom you will see a new item - "NWScript". Select that and you will have syntax highlighting that looks just like the toolset script editor.

There is one more step that is advisable. By default npp uses UTF-8 character encoding. Unfortunately NwN expects ANSI character encoding. To fix this just open "Encoding" on the main menu and change the setting.

As I said earlier npp supports plugins and in fact ships with a small number of them. However, currently there isn't an official plugin manager. Fortunately there is an unofficial one that works well and can be found here. Once installed you can go to the "Plugins" menu item and select "Plugin Manager" followed by "Show Plugin Manager". In the dialogue box that appears you will see a list of available plugins, each ones version number and how stable it is supposed to be. 2 that I have found to be particularly useful are Compare and Snippets. Compare allows you to compare two plain text files (including NWScript) side by side while snippets will let you save and reuse small portions of code.

There is another plugin that you may find useful as well. I have not tried it but I have been told that it does work. This plugin is nppexec. It allows you to launch a second program from within npp. This means that you can launch the stand alone NWScript compiler from within npp. Instructions on using nppexec can be found here. The instructions for NWNSC - NWN Enhanced Edition Script Compiler can be found on its project page on the vault.

Hope you find this of use.

TR
Post edited by TarotRedhand on

Comments

  • SyrusGreycloakSyrusGreycloak Member Posts: 10
    edited July 2020
    Sorry for the necro post, but I thought it'd be more helpful to keep the Notepad++ info together.

    I used to use Textpad, but have just recently switched to Notepad++ for NWScript. Instead of using Fancy Colors as mentioned above, I instead use the Obsidian color profile and set the Language to C. The drawback here is you need to set the language every time you open an NSS file, but you get to choose your color scheme from whatever schemes you have installed for Notepad++.

    To choose a color scheme:
    Settings > Style Configurator. In the Select Theme dropbox, choose the scheme you would like to use. I use Obsidian (it's a nice dark-type theme).
    On this screen I also set my Font to Lucida Console and Font Size to 8.
    I checked the Enable global font and Enable global font size boxes (warning: this affects every file you open - you can use the default for your theme. I found the font used by Obsidian to be rather narrow).
    Click Save & Close when you have things set the way you want.

    To set the language after opening your NSS file:
    Language > C > C ( or Alt+L, two down arrow presses, one right arrow press, Enter)

    Sample:
    erixihwbqao6.png
  • TarotRedhandTarotRedhand Member Posts: 1,481
    Small update to what I said in the first post. Notepad++ does now have an official plug-in manager.

    TR
Sign In or Register to comment.