There is no spoon

Legacy:GUIUserKeyBinding

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT2003 :: Object >> GUI >> GUIUserKeyBinding (Package: XInterface)

As of build 2181, allows mod authors to add their own key bindings to the standard key binder dialog.

Usage[edit]

  1. Subclass GUIUserKeyBinding.
  1. Add entries to the KeyData array:
  2. * Put the name of a section heading or a key binding in the KeyLabel structure element.
  3. * Set the bIsSection structure element to True if this entry is a section label and not a key binding.
  4. * 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[edit]

  • 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[edit]