Client Key Bindings

From Wurmpedia
Jump to navigation Jump to search

Introduction

The autorun.bsh fine defines the key bindings used by Wurm. The file should be in the directory you specified when you ran wurm for the first time. This is the directory containing the packs directory. Everything in the autorun.bsh file will be automatically executed when Wurm is started. If you ever mess up this file and need to reset it to the default values, just delete it and restart wurm.

How to bind a command to a key

Open the autorun.bsh in your favorite text editer. Add a line in the following format: keys.bind(<key event>, "<command>"); where <key event> is the key event and <command> is the command as defined below.

for example: keys.bind(KeyEvent.VK_BACK_SPACE, "wurm.rebuildTextures()");

Wurm Commands

Weather

  • weather.bolt()
  • weather.showConsole()

Renderer

  • renderer.dumpPerf()
  • renderer.lock()
  • renderer.rebuildTextures()
  • renderer.screenshot()
  • renderer.toggleHud()

Console

  • console.toggle()
  • console.toggleFullscreen()

Wurm Movement Commands

  • wurm.toggleWalkProtection()

Note that although these are called Keys they are actually commands.

  • Keys.KEY_MOVE_FRONT
  • Keys.KEY_MOVE_LEFT
  • Keys.KEY_MOVE_BACK
  • Keys.KEY_MOVE_RIGHT
  • Keys.KEY_TURN_LEFT
  • Keys.KEY_TURN_RIGHT
  • Keys.KEY_AUTO_RUN
  • Keys.KEY_CENTER_VIEW
  • Keys.KEY_STRAFE
  • Keys.KEY_TURN_UP
  • Keys.KEY_TURN_DOWN

Key Events

Letter Keys

KeyEvent.VK_A ... KeyEvent.VK_Z [edit] Number Pad / Arroy keys

  • KeyEvent.VK_BACK_SPACE
  • KeyEvent.VK_UP
  • KeyEvent.VK_DOWN
  • KeyEvent.VK_LEFT
  • KeyEvent.VK_RIGHT
  • KeyEvent.VK_PAGE_UP
  • KeyEvent.VK_PAGE_DOWN
  • KeyEvent.VK_END
  • KeyEvent.VK_INSERT

Function Keys

KeyEvent.VK_F1 ... KeyEvent.VK_F12

Miscellaneous

From a commnt in the wurm forums: For those of you having problems with textures getting broken: When 1.0.5a comes out, add the following to your autorun.bsh:

keys.bind(KeyEvent.VK_BACK_SPACE, "wurm.rebuildTextures()");

that way you can press backspace to force all textures to get rebuilt

Sample autorun.bsh

/**
 * Everything in this file will be automatically executed when Wurm is started.
 * If you ever mess up this file and need to reset it to the default values,
 * just delete it and restart wurm.
 */

import com.wurmonline.client.api.*;

System.out.println("Running autorun.bsh");


// WASD movement

keys.bind(KeyEvent.VK_W, Keys.KEY_MOVE_FRONT);
keys.bind(KeyEvent.VK_A, Keys.KEY_MOVE_LEFT);
keys.bind(KeyEvent.VK_S, Keys.KEY_MOVE_BACK);
keys.bind(KeyEvent.VK_D, Keys.KEY_MOVE_RIGHT);
keys.bind(KeyEvent.VK_Q, Keys.KEY_TURN_LEFT);
keys.bind(KeyEvent.VK_E, Keys.KEY_TURN_RIGHT);
keys.bind(KeyEvent.VK_X, Keys.KEY_AUTO_RUN);
keys.bind(KeyEvent.VK_C, Keys.KEY_CENTER_VIEW);

// Numpad/arrow movement

keys.bind(KeyEvent.VK_UP, Keys.KEY_MOVE_FRONT);
keys.bind(KeyEvent.VK_DOWN, Keys.KEY_MOVE_BACK);
keys.bind(KeyEvent.VK_LEFT, Keys.KEY_TURN_LEFT);
keys.bind(KeyEvent.VK_RIGHT, Keys.KEY_TURN_RIGHT);
keys.bind(KeyEvent.VK_PAGE_UP, Keys.KEY_AUTO_RUN);
keys.bind(KeyEvent.VK_PAGE_DOWN, Keys.KEY_CENTER_VIEW);
keys.bind(KeyEvent.VK_HOME, Keys.KEY_TURN_UP);
keys.bind(KeyEvent.VK_END, Keys.KEY_TURN_DOWN);
keys.bind(KeyEvent.VK_INSERT, Keys.KEY_STRAFE);

// For those of you having problems with textures getting broken:
// you can press F7 to force all textures to get rebuilt
keys.bind(KeyEvent.VK_F7, "renderer.rebuildTextures()");

keys.bind(KeyEvent.VK_B, "weather.bolt()");
keys.bind(KeyEvent.VK_F8, "console.toggleFullscreen()");
keys.bind(KeyEvent.VK_F9, "weather.showConsole()");
keys.bind(KeyEvent.VK_F10, "renderer.toggleHud()");
keys.bind(KeyEvent.VK_F11, "renderer.screenshot()");