[TIPs] Button Alias #2: How to emulate a double-tap input by just pressing a gamepad button once?
Some games require directional keys (e.g. W,A,S,D) to be tapped twice quickly (and hold) to make the character run fast instead of walk.
Can I emulate such an input by just pressing the gamepad button once?
Yes, it is possible, but a bit convoluted…
Button Alias function
JoyToKey has a function called “Button Alias”. It’s very powerful and can be used for two different scenarios:
- Assign more (virtual) buttons beyond the number of buttons physically available
- Assign multiple functions for one button input
This page explains how the 2nd scenario can solve double-tap use case, by combining two inputs (quick tap, followed by a long press) for a single button input. For the 1st scenario, please refer to the other page.
- Firstly, Button Alias feature enables you to combine two assignment definitions for a single button. In the screenshot below, both Button1 and Button21 are configured to be triggered when Button1 is pressed.
- Next, configure one button (e.g. Button21) to only trigger the target action for a short duration (e.g. 20 msec), by only assigning “Input1” for a sequential execution.
- Finally, configure the other button (e.g. Button1) to only trigger the target action after a certain duration (e.g. 100 msec), by assigning “Input2” only.
With these configurations, when a gamepad Button1 is pressed, the target action will be
- immediately pressed for 20 msec
- then released
- and then pressed again after 100 msec
- and will be hold until a gamepad button is released