Input Binding Advanced

We will look at more advanced uses of input binding. For the complete reference of the capabilities of the UDK input system, please see the UDN KeyBinds Reference.

Consider the following line from DefaultInput.ini:

; Removed BaseInput.ini aliases
.Bindings=(Name="GBA_Fire",Command="StartFire | OnRelease StopFire")

Let's note some things here:

  • The name in the binding is GBA_Fire. If we consult our list of udk key binds, we find that GBA_Fire is not one of them. In this case, what is happening is called input aliasing. This means that the command in this binding is being associated with the name GBA_Fire and GBA_Fire could later on in the document be issued as a command. More on this in a second.
  • The command contains a pipe and an OnRelease modifier
    • The net effect is that when GBA_Fire is triggered, StartFire is called once, then when the key is released, StopFire is called once
    • It is possible to call many commands in a key bind by repeated use of the | operator

Input Aliasing

This is best illustrated with an example. Consider the following bind:

.Bindings=(Name="ExampleBind",Command="AddBots 3")

We bound the command AddBots 3, which spawns 3 bots, to the name ExampleBind. Again, since ExampleBind is not a mappable input, this becomes an input alias. This allows us to do the following:

.Bindings=(Name="H",Command="ExampleBind")
.Bindings=(Name="X",Command="ExampleBind")

We've bound the keys H and X to perform our ExampleBind on keypress. Now, if we wanted to change what ExampleBind did, we would have to do it in only one place, while continuing to have multiple inputs all mapping to our ExampleBind.