Witcher Wiki

Enabling Debugging[]

Debugging can be turned on by launching the Witcher 3 with the flags -net -debugscripts. An easy way to do this is to create a shortcut to %GAMEFOLDER%\bin\x64\witcher3.exe, right clicking the shortcut, and entering the "Properties" menu. Add the flags at the end of the "Target" field so it looks something like (your path may be different):

Target: "D:\Games\The Witcher 3 Wild Hunt\bin\x64\witcher3.exe" -net -debugscripts

This will enable logging, as well as let Script Studio connect to the game. Script Studio can do line by line debugging and profiling as well as allow you to recompile the scripts without relaunching the game. More information will be available in the Script Studio article.

Line by Line Debugging[]

Logging[]

With the game running with the -debugscripts flag, the game will write out debug messages to:

\My Documents\The Witcher 3\scriptlog.txt

You can use several global functions to generate debug messages, though most modders will want to use the LogChannel(channel : name, text : string) function. It is recommended to use your mod name as the channel, so that your logs are easily recognizable to yourself, and potentially, other modders. Example invocation:

LogChannel('modMyMod', "Hello World")

However, be warned, the vanilla scripts have a lot of debug messages being written out, at least in 1.12, including several that can be extremely spammy. Here is a mod that disables all of the vanilla messages.

You may encounter a problem with logging, where scriptslog will be created, but it will be empty. To fix this:

  1. Go to content/content0
  2. Delete (or move somewhere else) .redscripts files (there are 3 of them)
  3. Start the game with -debuscripts parameter, it will regenerate scripts with logging. 

Monitoring scriptlog.txt[]

SnakeTailExample

Using SnakeTail to monitor scriptlog.txt

Since the game writes out to the script log in real time, you can monitor the file using anything that can read files as they're being written to. One such utility is SnakeTail, a very simple and quick way to monitor log files, the features are listed on the download page, but several of the features that make it useful for monitoring the scriptlog:

  • highlight lines that contain certain text
  • jump between highlights using a hotkey
  • standard find text dialog
  • if at bottom of a file, will "tail" the file (scroll down so that the most recent item is at bottom)
  • can have it show always on top
  • very quick update speed
  • no install

Other utilities also offer many of these features and more, so if you've got a favorite program for monitoring log files, use that!