Prioritize Hotkeys over Sent Key

Ask gaming related questions (AHK v1.1 and older)
shoe7ess2
Posts: 2
Joined: 25 Jun 2021, 02:23

Prioritize Hotkeys over Sent Key

25 Jun 2021, 02:37

It's been awhile since I used AHK, but I'm not sure I've had this issue before. I've be spent the last few hours googling a possible solution to my problem so I'm hoping someone here may help.

Basically I want ALT+1 to equal F1, Alt+2 to equal F2, etc. However the game I'm playing uses alt as a dodge, so I have to hold the buttons for them to use the quick actions I'm trying to bypass by not having to hit the function keys. I'm looking for a way to priority the hotkeys so that if I hit ALT+x it will not use the normal ALT command unless I exclusively use that button by itself. Here's my current script (pretty basic), so I'm hoping there's a way to make this work:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
 #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#IfWinActive, ahk_exe Biomutant-Win64-Shipping.exe
LAlt & 1::
Send {F1}
return

#IfWinActive, ahk_exe Biomutant-Win64-Shipping.exe
LAlt & 2::
Send {F2}
return

#IfWinActive, ahk_exe Biomutant-Win64-Shipping.exe
LAlt & 3::
Send {F3}
return

#IfWinActive, ahk_exe Biomutant-Win64-Shipping.exe
LAlt & 4::
Send {F4}
return
Any way I can get this working without dodging when I want to use a special ability instead? Thanks in advance!

Update 1: Found a semi-helpful way of approaching this, but it still makes me dodge before the skill is used, it's just more reliable:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
 #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#IfWinActive, ahk_exe Biomutant-Win64-Shipping.exe
LAlt & 1::
KeyWait LAlt
KeyWait 1
BlockInput On
Send {F1}
BlockInput Off
return

#IfWinActive, ahk_exe Biomutant-Win64-Shipping.exe
LAlt & 2::
KeyWait LAlt
KeyWait 2
BlockInput On
Send {F2}
BlockInput Off
return

#IfWinActive, ahk_exe Biomutant-Win64-Shipping.exe
LAlt & 3::
KeyWait LAlt
KeyWait 3
BlockInput On
Send {F3}
BlockInput Off
return

#IfWinActive, ahk_exe Biomutant-Win64-Shipping.exe
KeyWait LAlt
KeyWait 4
BlockInput On
Send {F4}
BlockInput Off
return
Last edited by shoe7ess2 on 25 Jun 2021, 15:37, edited 1 time in total.
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Prioritize Hotkeys over Sent Key

25 Jun 2021, 04:37

Hallo,
try:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
 #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#IfWinActive, ahk_exe Biomutant-Win64-Shipping.exe
<!1::Send {F1}
<!2::Send {F2}
<!3::Send {F3}
<!4::Send {F4}
#If
Autohotkey can neither read your mind nor know the future. How should it react when you press LAlt? Block this keystroke and wait if you will press a second key in addition?
shoe7ess2
Posts: 2
Joined: 25 Jun 2021, 02:23

Re: Prioritize Hotkeys over Sent Key

25 Jun 2021, 15:50

Rohwedder wrote:
25 Jun 2021, 04:37
Hallo,
try:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
 #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#IfWinActive, ahk_exe Biomutant-Win64-Shipping.exe
<!1::Send {F1}
<!2::Send {F2}
<!3::Send {F3}
<!4::Send {F4}
#If
Autohotkey can neither read your mind nor know the future. How should it react when you press LAlt? Block this keystroke and wait if you will press a second key in addition?
Yeah, I actually meant to post my update semi-fix last night. I appreciate the code, but really come on, do you act so facetious? I know it can't read my mind, I was using this... back when Diablo 2 was still a thing, and haven't wrote with it in a long while (it was pretty bare bones back then). A simple code suggestion would sufficed. I never claimed that coding could read my mind, I just wanted to figure out if a wait command or something else would help alleviate the issue a little, bud. Thanks anyways.
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Prioritize Hotkeys over Sent Key

26 Jun 2021, 02:44

That was not meant sacastically! This has very often been called for:
When key 1 is pressed, do task 1 immediately, except if a short time later additionally key 2 is pressed.
The principle of causality apparently exceeds general knowledge.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 153 guests