Hotkey Interference

Ask gaming related questions (AHK v1.1 and older)
Pianist
Posts: 36
Joined: 27 Mar 2024, 01:26

Hotkey Interference

Post by Pianist » 27 Mar 2024, 01:45

Hi! I'm new to AHK. I have a script for The Long Dark game which includes 2 hotkeys E and R. E is to toggle the sprint and R is to toggle the radial menu. But when I press them together, they interfere with each other and I have to press them twice to activate each one. Is there a way to disable R when I press E and vice versa to prevent double pressing? Thanks a lot. Also, these are the scripts that I use:

Code: Select all

e::
KeyDown := !KeyDown
SendInput {lshift}
Sleep, 30
If KeyDown
	SendInput {lshift down}
Else
	SendInput {lshift up}
Return

r::
KeyDown := !KeyDown
SendInput {tab}
Sleep, 30
If KeyDown
	SendInput {tab down}
Else
	SendInput {tab up}
Return

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

[Mod action: Moved topic from “Ask for Help (v2)” because this is v1 code and it is for a game. Please note the sub-forum to which your post has been moved, and post in the appropriate place next time.]

Pianist
Posts: 36
Joined: 27 Mar 2024, 01:26

Re: Hotkey Interference

Post by Pianist » 28 Mar 2024, 02:56

I had another question, how can I cancel the script e:: that is for auto sprinting by pressing for example S (backward key) ?

tabr3
Posts: 51
Joined: 25 Feb 2024, 04:06

Re: Hotkey Interference

Post by tabr3 » 29 Mar 2024, 09:52

Without remake the script.
You can simply rename all instances of "keydown" to something like "keydown_e" and "keydown_r" within their respective threads.

Code: Select all

~*s::
keydown_e:="" ; or keydown without _e if you still not modify them...
if (GetKeyState("lshift", "P")) ; optional, incase you still need to run by yourself using lshift
return				       ; optional
SendInput {lshift up}
return
For another question. Untested :)

Pianist
Posts: 36
Joined: 27 Mar 2024, 01:26

Re: Hotkey Interference

Post by Pianist » 29 Mar 2024, 15:21

Thank you very much my friend, This script works great. Can you find a solution to my first question?

Pianist
Posts: 36
Joined: 27 Mar 2024, 01:26

Re: Hotkey Interference

Post by Pianist » 29 Mar 2024, 15:34

Although after pressing S key I still have to double press e key to activate auto sprint, which is very unnatural and annoying..

Pianist
Posts: 36
Joined: 27 Mar 2024, 01:26

Re: Hotkey Interference

Post by Pianist » 29 Mar 2024, 21:22

You are a life saver :) I just removed optional lines and it solved all of my problems. God bless you my friend

Post Reply

Return to “Gaming Help (v1)”