Customizing Key Bindings

From Multiverse

Jump to: navigation, search

Contents

Overview

The Multiverse Client comes configured with a set of default key bindings. You can also customize key bindings for your gameworld.

Two files in a world's asset repository Interface\FrameXML directory control key bindings:

  • The action definition file, Bindings.xml
  • The key map file, bindings.txt

The sampleworld asset repository and the Client asset repository both contain examples of these files. For more information on asset repositories, see Setting Up an Asset Repository.

To set up a custom key binding:

  1. Define the action in the action definition file, Bindings.xml. This file associates a logical name with Python code that performs the action. It also includes some information about how the key event is handled.
  2. Map a key to the logical name in the key map file, bindings.txt.

Defining actions

The action definition file, Bindings.xml, associates logical action names with Python code. When the user presses a key mapped to an action name, the Multiverse Client runs the associated code.

The action definition file is an XML file with a single <Bindings> tag that contains any number of <Binding> tags, each of which defines one binding.

Action binding

An action binding defines a logical name, some associated Python code, and other (<Binding> tag), maps a looks like this:

<Binding name="actionName" runOnUp=["true"|"false"] header="groupName">
   ...Python code...
</Binding>

Where:

  • name=actionName - is the logical action name, a unique string
  • runOnUp=["true"|"false"] - If true, the action will be invoked on both key down and key up events. In this case, the script will have a keystate variable available which can be used to determine whether it is being invoked as a result of a "key down" or "key up" event.
  • header=groupName - a logical group name for the event (Not Yet Implemented)
  • Python code - Any number of lines of Python code that are executed when the event occurs.

For example:

<Binding name="MOVEFORWARD" runOnUp="true" header="MOVEMENT">
    if ( keystate == "down" ):
        ClientAPI.InputHandler.MoveForward(True)
    else:
        ClientAPI.InputHandler.MoveForward(False)
</Binding>

Mapping keys

The The key map file, bindings.txt, is a text file that maps logical action names to keys. Each line in the file has a key combination. and an action name, separated by a space. So, the format for each line is:

keyCombo actionName

The action name matches an action name defined in Bindings.xml.

For example, the following lines in the SampleWorld asset repository specify the keys for the MOVEFORWARD action name:

SHIFT-UP MOVEFORWARD
UP MOVEFORWARD
NUMPAD8 MOVEFORWARD
W MOVEFORWARD

Thus, the user can perform the MOVEFORWARD action by pressing the shift-up arrow key, up arrow key, num pad 8 key, or w key.

Here is the full SampleWorld bindings.txt file:

SPACE JUMP
1 ACTIONBUTTON1
ALT-Z TOGGLEUI
/ OPENCHATSLASH
ENTER OPENCHAT
CTRL-P OPENCHAT
T ATTACK
L TOGGLEQUESTLOG
B TOGGLEBACKPACK
N TOGGLESTATUS
TAB TOGGLEACTIONBAR
C TOGGLECHARACTER
SHIFT-UP MOVEFORWARD
ESCAPE TOGGLEGAMEMENU
# movement keys
UP MOVEFORWARD
NUMPAD8 MOVEFORWARD
W MOVEFORWARD
LEFT TURNLEFT
NUMPAD4 TURNLEFT
A TURNLEFT
DOWN MOVEBACKWARD
NUMPAD2 MOVEBACKWARD
S MOVEBACKWARD
RIGHT TURNRIGHT
NUMPAD6 TURNRIGHT
D TURNRIGHT
NUMPAD7 STRAFELEFT
Q STRAFELEFT
NUMPAD9 STRAFERIGHT
E STRAFERIGHT
NUMLOCK TOGGLEAUTORUN
# insert/delete for PITCHUP/PITCHDOWN
PRINTSCREEN SCREENSHOT
CTRL-R TOGGLERENDERMODE
CTRL-T TOGGLETEXTURE
CTRL-B TOGGLEBOUNDINGBOX
CTRL-H TOGGLERENDERCOLLISIONVOLUME
ALT-CTRL-SHIFT-M TOGGLEMETERING
ALT-CTRL-SHIFT-N METERONEFRAME
F1 CHARSELECT
F2 DANCE
F3 WAVE
F4 LAUGH
F5 CLAP
F6 CHEER
F7 CRY
F8 FIGHT
F11 HELP
F12 QUIT

Modifiers precede the key and should occur in the following order: ALT CTRL SHIFT. For example:

ALT-CTRL-SHIFT-N METERONEFRAME
Personal tools