Tap-hold for Gaming

I’ve been trying to figure out how to configure my spacebar to perform two functions on one key. This is specific to games with seperate dodge and jump mechanics. Helldivers 2 has this baked in to its controller configuration, I want to emulate the same behaviour in other games.

Desired behaviour:

Tap key, dodge (timing is more critical as this is normally a combat function)
Hold key, jump (less critical)

I have niavely tried:

tapKey space
holdKey ;

Unfortunately, both both ‘space’ and ‘;’ trigger immediately, so it would seem there is something wrong with my undestanding of ‘tapKey’

Any advice would be apprciated.

Those are commands, not conditionals. They both execute, one after another, the only difference being that holdKey holds the key (scancode) for as long as the activation key (i.e., physical key) is held, while tapKey just briefly activates and then immediately releases.

For timeout based conditional, you may want to use secondary roles with the advanced configuration (disable both triggerByPress and triggerByRelease, making it trigger by timeout only). With 4.x Agent you can do this all using gui. Although this has the problem that it will activate the dodge on key release rather than press, which is probably something you don’t want.

Admittedly, I should introduce some abstraction for hold conditional. But it would have the same timing drawbacks as the above.

How about Secondary role - non modifiers / Superkeys - #7 by mlac ?

Try something like:

ifPrimary final tapKey space
holdKey ;

As @kareltucek already wrote, your macro commands will be executed in order. If you want to make a distinction between a primary function (short tap on key) and a secondary function (holding the key), you need to be explicit about this.

You will also need to set the criteria for the distinction, i.e. the time interval that differenciates between primary (tap) and secondary (hold) function.

1 Like

(Indeed! I have forgotten that gui allows only modifier secondaries.)

Thank you, I’ll try this out.