ChangeKey

void ChangeKey(string name, [int input], [bool mouseAx], [bool mouseBut], [bool joyAx], [bool joyBut], [bool keyb])
void ChangeKey(int index, [int input], [bool mouseAx], [bool mouseBut], [bool joyAx], [bool joyBut], [bool keyb])
void ChangeKey(string name, [string primary], [string secondary], [string primaryModifier], [string secondaryModifier])

Parameters

name: The name/description of the action you wish to change.
index: The index number of the action you wish to change. Useful for custom GUIs.
input: Which input to change. 1 for primary. 2 for secondary. Defaults to 1.
mouseAx: Allow mouse axes for input? Defaults to false.
mouseBut: Allow mouse buttons for input? Defaults to true.
joyAx: Allow gamepad axes (analog sticks/buttons) for input? Defaults to true.
joyBut: Allow gamepad buttons for input? Defaults to true.
keyb: Allow keyboard buttons for input? Defaults to true.

Description

Waits for player input, then assigns that input to trigger this action. All inputs are monitored by default except mouse axes. All arguments except name or index are optional and will use their default values if not explicitly passed in.

Note that you can also use ChangeKey() in the same way as SetKey() to change an action immediately via script instead of waiting for player input.

Example

// the next input pressed will be assigned as the primary input for "Pause" cInput.ChangeKey("Pause"); cInput.ChangeKey("Pause", 1); // this does the same thing as the previous line // the next input pressed will be assigned as the secondary input for "Pause" cInput.ChangeKey("Pause", 2); // only gamepad axes and buttons will be accepted for the primary "Accelerate" input cInput.ChangeKey("Accelerate", false, false, true, true, false); // only the keyboard can be used for the secondary "Jump" input cInput.ChangeKey("Jump", 2, false, false, false, false, true); // using ChangeKey like SetKey to change the primary and secondary inputs for "Up" cInput.ChangeKey("Up", "W", Keys.UpArrow);

results matching ""

    No results matching ""