Binding Keys
To bind a key means to assign an in-game command with that of a button on a keyboard, mouse or joystick (or other input device).
An alias is a group of in-game commands. Therefore binding a key to an alias would assign that key with multiple in-game commands.
The syntax is generally:
<key>=<in-game command> | <optional second command> | <optional third command, etc
Note - if you wish to bind only one command to a button, you do not need to specify the pipes ("|").
All UT Engine Versions
Binding keys with ini files:
Z=Behindview 1 | OnRelease Behindview 0
Binding keys in-game from the console:
set input Z Behindview 1 | OnRelease Behindview 0
when the 'Z' button is held down, it switch switch to BehindView. When you Release the key, it goes back to normal (first-person) view.
But how do Epic/DE assign keys in the Configure Controls menus?
This differs from version to version of the Unreal Engine. Unreal Tournament has third-party developer (i.e. mod makers) key bind support - this means we can add new keys to the bottom of the pre-existing Configure Key list.
Games such as Deus Ex, if you want to define a new key, you have to replace the entire menu(!) which is a more inefficent use of code. However, both methods work - but you'd be made to replace the entire Configure Key menu in UT!
How to add keybinds to UT
UTExtraKeyBindings - This class allows you to set your button names and aliases so players can configure their own controls.
How to add keybinds to UT2003
As of version 2179, UT2003 now has a similar class - GUIUserKeyBinding.
Content that needs to pay a visit to the UnrealEd Goblin
- Aliases
- Keys must have an alias function name. This alias will call an exec function in your player class if you have one. This is good for one time use functions like QSFire()
- Buttons
- If you need to know when the player releases or is holding a button, you must have an input button variable, and an alias binding.
- Input Button Variable
- the player class must contain your button variables (var input byte bMyButton;)...the button is true when held, false when not.
- Alias Binding
- In order to prevent 'Bad button command' from logging when you press your button, you have to bind it. To do this while inside UT press '~' to bring up your console, then type PREFERENCES <enter> to bring up Advanced Options. Select ADVANCED, KEY ALAISES, ALIASES, then go down to an empty space and enter your alias name and the command parameter BUTTON bMyButton.
Related Topics
Discussion
ZxAnPhOrIaN: I use the menu and windows key on my keyboard for the behindview 0 and 1 commands.
Bcladd: Don't mean to seem dim but I cannot find the class GUIUserKeyBinding anywhere in my 2199 source tree nor is it referenced in any of the source code. I am guessing the reference to it above should probably be eliminated.
PleaseLoveMe: No, it's there. Check Object → GUI → GUIUserKeyBinding in the object tree. I recommend using WOTgreal for editing uscript because it makes it easier to find such things.