Difference between revisions of "Client Key Bindings"

From Wurmpedia
Jump to navigation Jump to search
m
m (→‎How to bind a command to a key: looks like a key, no? :))
Line 14: Line 14:
 
bind <key> <Action>
 
bind <key> <Action>
  
eg bind x move_forward
+
eg bind {{Keyboardkey|keytext=x}} move_forward
  
 
==New Bind file ==  
 
==New Bind file ==  

Revision as of 10:04, 5 August 2006


Introduction

The autorun.txt file 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.txt 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.txt file in your favourite text editor. Add a line in the following format: bind <key> <command> where <key> is the key event and <command> is the command as defined below.

For example: bind <key> <Action>

eg bind Template:Keyboardkey move_forward

New Bind file

// If you ever manage to mess up this file, just delete it, and wurm with
// replace it with a new one.
// <------------------------------------------------------------------------>
// Default movement keys. Allows both WASD and arrow key movement
// You can bind these keys to any KeyEvent.VK_* key
// (see http://java.sun.com/j2se/1.4.2/docs/api/java/awt/event/KeyEvent.html)
bind w move_forward
bind s move_back
bind a move_left
bind d move_right
bind q turn_left
bind e turn_right
bind x autorun
bind z center_view

bind up move_forward
bind down move_back
bind left turn_left
bind right turn_right
bind page_up autorun
bind page_down center_view
bind insert strafe
bind home turn_up
bind end turn_down

bind numpad8 move_forward
bind numpad2 move_back
bind numpad4 turn_left
bind numpad6 turn_right
bind numpad9 autorun
bind numpad3 center_view
bind numpad0 strafe
bind numpad7 turn_up
bind numpad1 turn_down

// Misc keys
bind enter toggle_chat
bind t toggle_chat
bind tab next_tab
bind f12 "quit"

// Window toggles
bind f1 "toggle console"
bind f2 "toggle skills"
bind f3 "toggle inventory"

// Some various toggles we want to enable
toggle keyboard_hints
// toggle stats

Little Tips

Add:

// Window toggles
bind f1 "toggle console"
bind f2 "toggle skills"
bind f3 "toggle inventory"
bind k "toggle skills"
bind i "toggle inventory"
bind ` "toggle stats"
// Change "`" to whatever you prefer, it's just below the escape key on most keyboards though. 
to autorun.txt so you can use 'I' for inventory etc, much easier than using the function keys. Template:Smiley

Old Bind File Autorun.bsh (Obsolete)

Wurm Commands

Weather

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

Renderer

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

Console

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

In-Game Windows

  • wurm.showInventory()
  • wurm.showSkills()

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

Function keys

KeyEvent.VK_F1 ... KeyEvent.VK_F12

Arrow keys

  • KeyEvent.VK_UP
  • KeyEvent.VK_DOWN
  • KeyEvent.VK_LEFT
  • KeyEvent.VK_RIGHT

Other keys

  • KeyEvent.VK_BACK_SPACE
  • KeyEvent.VK_END
  • KeyEvent.VK_INSERT
  • KeyEvent.VK_PAGE_UP
  • KeyEvent.VK_PAGE_DOWN

Miscellaneous

From a comment 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()");