# Debug Protocol

The game has a debug protocol which can be instantiated by running the game with the "-net" commandline parameter. This lets you interact with the game with other programs.

The address of this socket is <http://localhost:37010/>. It even has an unfinished https debug page but since it isn't finished it can't really be used for anything:

![Debug page](http://i.imgur.com/mUZPufZ.png)

The debug protocol has some various features some of which is utilized in script studio:

* Reload
  * This will recompile and reload all scripts. `self.w3net.send(Request().utf8("scripts").utf8("reload").end())`
* Modlist
  * This returns the list of installed mods. `self.w3net.send(Request().pkglist().end())`
* Rootpath
  * This returns the rooth path of the game. `self.w3net.send(Request().sc_root_path().end())`
* Execute(command)
  * This will execute "command" as if you would input it into the console. `self.w3net.send(Request().remote(cmd).end())`
* Opcode(self, funcname, classname=None)
  * This will return the opcodes for "funcname". `self.w3net.send(Request().opcode(funcname, classname).end())`
* Varlist(self, section="", name="")
  * Searches for config variables. `self.w3net.send(Request().varlist(section, name).end())`
* UnfilteredLocals(self, value)
  * Enables/disables the filtering of the list of locals received from the game `self.w3net.send(Request().sd_unfiltered_locals(value).end())`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.redmodding.org/redengine3-research/debug-protocol.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
