Skip to main content

n3 Code Console

The n3 Code Console is a disabled-by-default RuneLite plugin for running small, controlled n3 command scripts from a Swing panel. It does not compile or execute arbitrary Java, shell commands, or persisted scripts.

For copyable recipes and DSL usage patterns, see Code Console DSL Examples.

Enablement

  • Plugin entrypoint: com.n3plugins.codeconsole.CodeConsolePlugin
  • Config group: n3codeconsole
  • RuneLite panel tooltip: n3 Code Console
  • Bundle registration: runelite-plugin.properties

Enable Code Console from the RuneLite plugin list. With Packet Utils running, the shared plugin-list decorator should show the bundled n3 icon, not a visible [n3] marker. 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 are in-memory only for v1. Nothing is saved to disk. Output is capped at 500 lines and command history is capped at 25 scripts.

Script Rules

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

Example:

# quick bank and player-state check
bank.isOpen
bank.count coins
state.location
wait 2
npc.interact "Grand Exchange Clerk" Talk-to

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, so executor mutation stays 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 InteractionApi.actions wrappers.

Commands

Command names are case-insensitive. Names and actions are passed to the existing interaction APIs, so exact available actions still depend on the current widget, item, NPC, and RuneLite state.

Bank

bank.isOpen
bank.count <item-id-or-name>
bank.depositInventory
bank.depositEquipment
bank.setNoted <true|false|noted|item|on|off>
bank.withdraw <item-id-or-name> <amount> [true|false|noted|item|on|off]

Examples:

bank.isOpen
bank.count 995
bank.count coins
bank.setNoted noted
bank.withdraw "Law rune" 50
bank.withdraw 385 10 item
bank.depositInventory

The optional third bank.withdraw argument is enforced per command. noted, true, and on switch to noted mode before withdrawing; item, false, and off switch back to item mode before withdrawing.

Inventory

inv.list
inv.count <item-id-or-name>
inv.use <item-id-or-name> <action> [additional-actions...]

Examples:

inv.list
inv.count lobster
inv.use lobster Eat
inv.use "Teleport to house" Break

NPC

npc.interact <npc-id-or-name> <action> [additional-actions...]

Examples:

npc.interact Banker Bank
npc.interact "Grand Exchange Clerk" Talk-to

Object

object.interact <object-id-or-name> <action> [additional-actions...]

Examples:

object.interact "Bank booth" Bank
object.interact Door Open
object.interact 10355 Mine

Tile Item

tileitem.interact <item-id-or-name> <action> [additional-actions...]

Examples:

tileitem.interact Bones Take
tileitem.interact 385 Take

Prayer

prayer.set <prayer-name> <on|off|true|false>

Examples:

prayer.set Piety on
prayer.set Protect_from_Melee off
prayer.set "Protect from Magic" true

Walk

walk <x> <y> [plane]

Examples:

walk 3200 3201
walk 3218 3218 0

State And Vars

state.location
state.tick
varbit <id>
varp <id>

Examples:

state.location
state.tick
varbit 3960
varp 281

Flow Control

wait <ticks>
stop

Examples:

wait 3
stop

Safety Boundaries

The v1 console intentionally does not support:

  • 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 covering parser dispatch and executor behavior under src/test/java/com/n3plugins/codeconsole.

Verification

After changing the console, run:

.\gradlew.bat test --tests com.n3plugins.codeconsole.* --console plain
.\gradlew.bat test --console plain
.\gradlew.bat FatJar --console plain

The fat jar should include com/n3plugins/codeconsole/CodeConsolePlugin.class, and runelite-plugin.properties should list com.n3plugins.codeconsole.CodeConsolePlugin.