Double tapping ^+5 behaves differently when I remap it to ~Space & 5 Topic is solved

Ask gaming related questions (AHK v1.1 and older)
autohotkey_avatar
Posts: 27
Joined: 04 Aug 2022, 02:51

Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by autohotkey_avatar » 26 Jan 2023, 16:46

In a game I'm playing, when I hold down Ctrl+Shift, and double tap 5 quickly, an action will occur. The hotkey of the action is displayed as "Ctrl+Shift+5 [x2]" in-game, meaning I need to press it twice to activate. There's a separate hotkey which is just "Ctrl+Shift+5" in-game, meaning that needs to be pressed once only to activate.

I'm trying to change the Ctrl+Shift modifier to Space, using autohotkey:

Code: Select all

~Space & 5::
	Sendinput, ^+5
return
I've also tried:

Code: Select all

Space & 5::
	Sendinput, ^+5
return
Now, in-game, if I hold down Space, and double tap 5 quickly, it fails to register that Ctrl+Shift+5 was tapped twice. The game knows I'm pressing the key twice, because a little sound effect will go off each time I hit the 5 key. It just doesn't recognize it as a double-tap of Ctrl+Shift+5. The game will pretend that I have pressed Ctrl+Shift+5 once (and a separate action will occur, which is mapped to a single press of Ctrl+Shift+5) despite the fact that I've tapped Space+5 twice. I've tried tapping Space+5 once or twice or three times, it only ever registers as a single press of Ctrl+Shift+5 in-game despite the in-game sound effect going off the appropriate number of times. How to fix?

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by mikeyww » 26 Jan 2023, 17:16

Does it work in Notepad instead of your game?

autohotkey_avatar
Posts: 27
Joined: 04 Aug 2022, 02:51

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by autohotkey_avatar » 26 Jan 2023, 17:18

mikeyww wrote:
26 Jan 2023, 17:16
Does it work in Notepad instead of your game?
How do I try this? When I open notepad and press Ctrl+Shift+5 (or Space+5 after running my above ahk script, for that matter), nothing shows up.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by mikeyww » 26 Jan 2023, 17:30

Try something similar.

Code: Select all

#Requires AutoHotkey v1.1.33
F4::KeyHistory
Space & 5::
Send +5
Return
You can also then examine the :arrow: KeyHistory.

Code: Select all

#Requires AutoHotkey v1.1.33
F4::KeyHistory
^+5::Send y
Space & 5::
Send ^+5
Return

autohotkey_avatar
Posts: 27
Joined: 04 Aug 2022, 02:51

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by autohotkey_avatar » 26 Jan 2023, 19:53

mikeyww wrote:
26 Jan 2023, 17:30
Try something similar.

Code: Select all

#Requires AutoHotkey v1.1.33
F4::KeyHistory
Space & 5::
Send +5
Return
You can also then examine the :arrow: KeyHistory.

Code: Select all

#Requires AutoHotkey v1.1.33
F4::KeyHistory
^+5::Send y
Space & 5::
Send ^+5
Return

This is the output when I'm holding Space and tapping 5:
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 i d 0.00 5
35 006 i u 0.00 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
59 015 i d 0.00 y
59 015 i u 0.00 y
35 006 s u 0.08 5
35 006 h d 0.13 5
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 i d 0.00 5
35 006 i u 0.00 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
59 015 i d 0.00 y
59 015 i u 0.00 y
35 006 s u 0.09 5
35 006 h d 0.06 5
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 i d 0.00 5
35 006 i u 0.00 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
59 015 i d 0.00 y
59 015 i u 0.00 y
20 039 u 0.13 Space
35 006 s u 0.00 5
73 03E d 0.25 F4

Compared to when I'm holding CTRL+SHIFT and tapping 5:
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 u 0.08 5
35 006 d 0.20 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
59 015 i d 0.00 y
59 015 i u 0.00 y
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 u 0.08 5
35 006 d 0.14 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
59 015 i d 0.00 y
59 015 i u 0.00 y
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 u 0.06 5
35 006 d 0.08 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
59 015 i d 0.00 y
59 015 i u 0.00 y
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 u 0.09 5
A2 01D u 0.05 LControl
A0 02A u 0.02 LShift
73 03E d 0.20 F4
It looks the same?

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by mikeyww » 26 Jan 2023, 19:58

So that second script seems to work, right?

Code: Select all

#Requires AutoHotkey v1.1.33
F4::KeyHistory
^+5::Send y
Space & 5::
Send ^+5
Return

autohotkey_avatar
Posts: 27
Joined: 04 Aug 2022, 02:51

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by autohotkey_avatar » 26 Jan 2023, 20:21

mikeyww wrote:
26 Jan 2023, 19:58
So that second script seems to work, right?

Code: Select all

#Requires AutoHotkey v1.1.33
F4::KeyHistory
^+5::Send y
Space & 5::
Send ^+5
Return
Yes, it works, but actually, please ignore my previous post. I have just discovered the cause of the problem -- I just don't know the solution.

This is my script, now:

Code: Select all

F4::KeyHistory
~Space & 5::
Send ^+5
Return
When I hold CTRL+SHIFT and tap 5 repeatedly, it looks like this:
A2 01D d 2.48 LControl
A0 02A d 0.05 LShift
35 006 d 0.03 5
35 006 u 0.06 5
35 006 d 0.09 5
35 006 d 0.06 5
35 006 u 0.08 5
35 006 d 0.05 5
35 006 u 0.09 5
A2 01D u 0.06 LControl
A0 02A u 0.00 LShift
However, when I hold SPACE and tap 5, it looks like this:
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 i d 0.00 5
35 006 i u 0.00 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
35 006 s u 0.06 5
35 006 h d 0.06 5
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 i d 0.00 5
35 006 i u 0.00 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
35 006 s u 0.05 5
35 006 h d 0.05 5
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 i d 0.00 5
35 006 i u 0.00 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
35 006 s u 0.08 5

So this difference is the root cause. Holding SPACE and tapping 5 will result in LControl and LShift to constantly go down/up in activation.

How do we eliminate this difference in behavior?

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by mikeyww » 26 Jan 2023, 20:59

Since my script works, then perhaps the answer is to use it? Just guessing here! :D

My script is the same as yours but has no tilde in the hotkey.

Alternative:

Code: Select all

#Requires AutoHotkey v1.1.33
Space::Space
Space & 5::
SetKeyDelay,, 25
Send ^+5
Return
If the script works in Notepad but not in the game, then it means that the issue is the game. viewtopic.php?f=7&t=11084

autohotkey_avatar
Posts: 27
Joined: 04 Aug 2022, 02:51

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by autohotkey_avatar » 26 Jan 2023, 21:15

mikeyww wrote:
26 Jan 2023, 20:59
Since my script works, then perhaps the answer is to use it? Just guessing here! :D

My script is the same as yours but has no tilde in the hotkey.

Alternative:

Code: Select all

#Requires AutoHotkey v1.1.33
Space::Space
Space & 5::
SetKeyDelay,, 25
Send ^+5
Return
If the script works in Notepad but not in the game, then it means that the issue is the game. viewtopic.php?f=7&t=11084
Sorry, I misinterpreted what you meant by "works" (for some silly reason I thought you meant "does the script run?"). None of the solutions work, regardless of whether I use tilde or not, because the resulting behavior of SPACE+5 5 5 5 5 still differs slightly from CTRL+SHIFT+5 5 5 5 5.

Instead of outputting this (which is what happens when holding CTRL+SHIFT and tapping 5):
A2 01D d 2.48 LControl
A0 02A d 0.05 LShift
35 006 d 0.03 5
35 006 u 0.06 5
35 006 d 0.09 5
35 006 d 0.06 5
35 006 u 0.08 5
35 006 d 0.05 5
35 006 u 0.09 5
A2 01D u 0.06 LControl
A0 02A u 0.00 LShift
It's outputting this:
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 i d 0.00 5
35 006 i u 0.00 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
35 006 s u 0.06 5
35 006 h d 0.06 5
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 i d 0.00 5
35 006 i u 0.00 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
35 006 s u 0.05 5
35 006 h d 0.05 5
A2 01D i d 0.00 LControl
A0 02A i d 0.00 LShift
35 006 i d 0.00 5
35 006 i u 0.00 5
A2 01D i u 0.00 LControl
A0 02A i u 0.00 LShift
35 006 s u 0.08 5
This different behavior is like this whether in-game or in Notepad, and it's like this regardess of whether I'm doing Space & 5, or ~Space & 5.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by mikeyww » 26 Jan 2023, 21:32

If my last script did not work, and you tried the game solutions, then I have no additional ideas. Others may know a solution. Good luck.

autohotkey_avatar
Posts: 27
Joined: 04 Aug 2022, 02:51

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5  Topic is solved

Post by autohotkey_avatar » 27 Jan 2023, 03:01

This works for some mysterious reason:

Code: Select all

~5::
	if GetKeyState("Space", "P")
	{
		;Msgbox x
		Send {LControl down}{LShift down}
		Sleep, 20
		Sendinput, {5 up}
		Sleep, 20
		Sendinput, {5 down}
		Sleep, 20
		Keywait, space
		Send {LControl up}{LShift up}
	}
	else
	{
		;Sendinput, 5
	}
return


User avatar
DuckingQuack
Posts: 219
Joined: 20 Jan 2023, 18:20

Re: Double tapping ^+5 behaves differently when I remap it to ~Space & 5

Post by DuckingQuack » 29 Jan 2023, 10:22

@autohotkey_avatar
If you're interested in something a little more simplified, this should work too:

Code: Select all

SetKeyDelay, 20
~5::
	if GetKeyState("Space", "P"){
		Send {LControl down}{LShift down}55{LControl up}{LShift up}
	}
return
If you were to choose a different hotkey, the If statement could be omitted too. It would be a single key press (wouldn't need to hold anything else down) and the macro would send the Ctrl+Shift+(5x2).
Best of Luck,
The Duck

Post Reply

Return to “Gaming Help (v1)”