Skip to main content

n3 Code Console

The n3 Code Console is a disabled-by-default, hidden developer plugin that runs small, controlled n3 command scripts from a Swing panel. It avoids compiling or executing arbitrary Java, shell commands, or persisted scripts.

Enablement

  • Plugin entrypoint: com.n3plugins.codeconsole.CodeConsolePlugin
  • RuneLite panel tooltip: n3 Code Console
  • Bundle registration: runelite-plugin.properties
  • Descriptor: hidden = true (session/developer console, excluded from default user plugin list unless enabled via internal/hidden plugin configurations)
The side panel opens from the RuneLite toolbar after the plugin starts.

UI Controls

  • Commands: session-only script editor.
  • Output: structured status and command result log.
  • Run: parses the entire editor first, then queues the script if it is valid.
  • Stop: requests a safe stop. The active script stops on the next console tick.
  • Clear: clears output text only.
  • Ctrl+Enter: same as Run.
  • Status: shows idle, queued, running, stopping, or parse-error state.
Command text, output, and history persist in-memory only for v1. The plugin saves nothing to disk. The output limit is 500 lines, and command history retains 25 scripts.

Script Rules

  • One command per line.
  • The parser ignores blank lines.
  • # starts a comment unless it appears inside quotes.
  • Use double quotes for multi-word arguments.
  • Item and NPC targets accept names or numeric IDs where the command supports both.
  • Boolean arguments accept true, false, noted, item, on, and off where noted/item mode applies.
  • The parser validates the full script before executing commands.
  • Unknown commands, wrong argument counts, unclosed quotes, and invalid numbers stop the script from queueing.
Example:

Execution Model

The executor runs one script at a time from RuneLite game ticks. Run and Stop button events schedule executor state changes through ClientThreadBridge.invokeLater, keeping executor mutation on the client-thread path with tick execution. Each command returns a StepResult:
  • SUCCESS: log the result and advance to the next command.
  • WAIT: delay by the requested number of ticks, then continue.
  • RETRY: retry the same command up to the bounded retry limit.
  • FAILED: stop the script and log the failure.
  • RESET: return to the first command.
Game-client reads and actions route through existing client-thread-safe project APIs, primarily ClientThreadBridge and result-aware Api.actions wrappers.

Commands

Command names ignore case. The console passes names and actions to the existing interaction APIs, so exact available actions depend on the current widget, item, NPC, and RuneLite state.

Bank

Examples:
The command enforces the optional third bank.withdraw argument per call. noted, true, and on switch to noted mode before withdrawing; item, false, and off switch back to item mode before withdrawing.

Inventory

Examples:

NPC

Examples:

Object

Examples:

Tile Item

Examples:

Prayer

inv.use requires the Inventory tab to be visible, and prayer.set requires the Prayer tab when a state change is needed. The console propagates WIDGET_HIDDEN; it does not select tabs automatically. Open the required tab in the client before running the dependent line.
Examples:

Walk

Examples:

State And Vars

Examples:

Flow Control

Examples:

Safety Boundaries

The v1 console excludes:
  • arbitrary Java evaluation
  • dynamic compilation
  • shell execution
  • global System.out / System.err redirection
  • unsafe thread stopping
  • saved script files
Add new command surfaces by extending CodeConsoleCommandAdapter, DefaultCodeConsoleCommandAdapter, and CodeConsoleParser. Then test parser dispatch and executor behavior under src/test/java/com/n3plugins/codeconsole.

Verification

After changing the console, run:
The fat jar includes com/n3plugins/codeconsole/CodeConsolePlugin.class, and runelite-plugin.properties lists com.n3plugins.codeconsole.CodeConsolePlugin.