GUIUserKeyBinding
As of build 2181, allows mod authors to add their own key bindings to the standard key binder dialog.
Usage
- Subclass GUIUserKeyBinding.
- Add entries to the KeyData array:
- Put the name of a section heading or a key binding in the KeyLabel structure element.
- Set the bIsSection structure element to True if this entry is a section label and not a key binding.
- Put the console command you want to bind in the Alias structure element.
Make a MyPackage.int file with the following data in it:
[Public] Object=(Name=MyPackage.MyKeyBindings,Class=Class,MetaClass=XInterface.GUIUserKeyBinding)
The corresponding MyKeyBinding class:
class MyKeyBindings extends GUIUserKeyBinding; // Warning: Don't add any extra spaces between elements in struct variable defaults! defaultproperties { KeyData[0]=(KeyLabel="Capture the Mage",bIsSection=True) KeyData[1]=(KeyLabel="Cast Spell",Alias="castspell") KeyData[2]=(KeyLabel="Activate Shield",Alias="activateshield") }
Caveats
- As of build 2199, UT2003 only supports a limited number of custom key bindings in its standard dialog. Any key bindings going beyond that limit will be ignored.
BigJohn: I have tested this and it doesn't seem to be an issue anymore with ut2004
- Key bindings created with this method are global in UT2003. To make per-mod key bindings (without resorting to workarounds like using a custom .ini file), you can intercept key press and release events with an Interaction.
- Note that the sample line stated in the comment header of GUIUserKeyBinding is incorrect.
Object=(Class=class;MetaClass=Xinterface.GUIUserKeyBinding,Name=<classname>) - WRONG! Object=(Class=class,MetaClass=Xinterface.GUIUserKeyBinding,Name=<classname>) - correct
Related Topics
- UTExtraKeyBindings – a similar facility in UT
- Keypress Interactions – how to intercept previously bound keys
- InputKeyMap – list of key mapping and default bindings
- Binding Keys – ways to set up the bindings