Page 1 of 1

Remapping z to Ctrl+z but space + z = z

Posted: 20 Jan 2022, 08:17
by Speedster448
Hi I am trying to setup hotkeys for Starcraft 2 but some of the hotkey setting functions do not have the double hotkey feature enabled for example adding an attachment to a building to work around this I was trying to make a script that binds the z key to perform z+ctrl
so:
z = z+ctrl

but if spacebar is pressed
space + z = z (allowing the z key alone to still be triggered)

i am going to do the same for x, c & v keys, it seems like some general knowledge of this language is needed to perform this, so help would be appreciated thank you.

Re: Remapping z to Ctrl+z but space + z = z

Posted: 20 Jan 2022, 08:48
by Speedster448
i got this to work through trial and error

Code: Select all

z:: send ^z
space & z:: z
that seems to be one solution
however is there a way to fancy it up be creating an if statement so that in psedo-code would be something like:

Code: Select all

if(!space{not pressed})
z:: send ^z
else(space{held/pressed})
z :: z
?? Thanks for any help again

Re: Remapping z to Ctrl+z but space + z = z

Posted: 20 Jan 2022, 12:33
by Rohwedder
Hallo,
try:

Code: Select all

*z::Send,% GetKeyState(A_Space,"P")?"z":"^z"