I would like to write a script that does the following:
I press 1 down
The script presses Ctrl down
It waits a moment
Then presses 1 down
I release 1
It releases Ctrl and 1
Background
In the game, the godly powers are triggered by prvy case Ctrl) and a power-specific key (1-5). While you can rebind both the modifier and the power keys, it is not possible to unbind the modifier and trigger the powers with one button only. Which is why I would like to have a single button (1 in this case) trigger Ctr+1. Now for the complications.
Delay
Simply sending Ctrl+1 does not work, because the game expects you to press ctrl, then takes a moment to animate the godly powers UI and only then can you press 1. So I need to introduce a delay between Ctrl and 1.
Hold
The game differentiates between Ctrl + 1 (Tap) and Ctrl + 1 (Hold). Since I need both functionalities, I need to write the script in such a way that it keeps those two buttons pressed as long as I keep the button pressed that I want to map this to.
Current Attempt
My current idea ist something like this:
Code: Select all
1::
SendEvent {Ctrl Down}
Sleep 1000
SendEvent {1 Down}
1 Up::
SendEvent {Ctrl Up}{1 Up}
Hold
This solution does not behave as if I was holding Ctrl+1 down, but as if i was pressing them again and again.
Release
When I tap 1 instead of holding it, ctrl is released before 1 is pressed down, resulting in 1 being pressed on its own. I would like to only react to the 1 Up-Event when the Ctrl+Sleep+1 command has run its course.
Any help, also in the form of concepts that I should look into would be greatly appreciated.