Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The NWN script debugger is used to...debug scripts! well it's kinda an old Windows-only utility (that runs in WINE) that can be used with SpawnScriptDebugger to see the variables a script have and step through a bit of code step by step.

Debugger

You can debug NWN nss scripts. It's sure not pretty, and for most users PostString will be a lot easier to debug things, but may be useful to some.

NWN:EE 8193.23 and higher now includes an updated DebugServer.exe file (which works with newer types of thing like sqlquery), but if your install missing it use this NWvault copy. If you use this copy uou need to create a folder called "utils" in the path just above the main game exe files. For instance: D:\Steam\steamapps\common\Neverwinter Nights\bin\win32\utils

Next step: go to your NWN:EE's options and enable the debugger:

Image Added

You can adjust he port and address here too. Obviously we're not...in 2001 so we can use both applications on the same device so 127.0.0.1 is fine.

Then we need to generate the debug files. Use the script compiler referenced in this guide with the flag -g which is "Enable generation of .ndb debug symbols file". Or you can enable it in the toolset using this checkbox:

Image Added

Once ticked it will generate .ndb files alongside the .ncs versions. Both are needed.

You then need a way to spawn in the debugger! This is the function SpawnScriptDebugger. As noted in the description of the function do not use this needlessly or without the debugger present, it just slows things down.

Now start the debugger application, and use the port suggested above. It looks like this when opened and must be set to "On". The game should be able to open it by itself mind you when it hits SpawnScriptDebugger.

Image Added

Now run your module, from the toolset or in game, with the debugger in the background. I recommend running it in windowed mode. On 1.69 set the Fullscreen=0 and AllowWindowed=1 options. In NWN:EE you can press ALT+Enter or change it in the options.

Once it hits the given SpawnScriptDebugger start point the window should pop up with the debugger allowing you to view all the variable and step through the script.

Image Added

Once closed the script will continue as usual.

API/Protocol

If you want to write your own version of DebugServer.exe it'll need the API info, which is below:

The protocol is token-based, with the following tokens:

...