Skip to content

Setting up Debugging

Tad Hardesty edited this page Dec 15, 2019 · 21 revisions

Setting up Build & Run

  1. Install the DreamMaker Language Client extension for Visual Studio Code.
  2. Press Ctrl+Shift+D to access the Debug view.
  3. Click the gear icon create-launch-json to create the launch configuration.
  4. From now on, pressing F5 will build and run the project.

Setting up debugging

  1. Download a recent extools.dll release and place it alongside your .dme file.
  2. Add this snippet to your codebase and call it early in your initialization, for example at the top of /world/New():
    /world/proc/enable_debugger()
        var/dll = world.GetConfig("env", "EXTOOLS_DLL") || (fexists("./extools.dll") && "./extools.dll")
        if (dll)
            call(dll, "debug_initialize")()
  3. The debugger will automatically activate when the project is run with F5.

Using the debugger

For a general overview, read Debugging in Visual Studio Code.

Advanced configuration

Run without building

Edit launch.json and remove or comment out the "preLaunchTask" line.

Run without debugging

Ctrl+F5 will launch without debugging. The debugging hooks will not be enabled when running from outside Visual Studio Code.

Attach configurations

Activate BACKGROUND or BLOCK mode as described in Environment variables. When editing launch.json, click "Add Configuration" and choose "BYOND: Attach to debugger". Ensure the port numbers match.

Environment variables

The environment variables EXTOOLS_DLL, EXTOOLS_MODE, and EXTOOLS_PORT are set when running from within Visual Studio Code. They can be read with the world.GetConfig proc. The first parameter to debug_initialize will override EXTOOLS_MODE and the second parameter will override EXTOOLS_PORT. The default mode is NONE and the default port is 2448.

The available modes are:

  • LAUNCHED: connect out to the given port.
  • BACKGROUND: listen for connections on the given port in the background.
  • BLOCK: wait for a connection on the given port before resuming.

EXTOOLS_DLL is set to a path to a .dll bundled with and compatible with the current version of the language server. It can be overridden by changing the code of enable_debugger.

Clone this wiki locally