Ahk not intercepting keystrokes randomly

Ask gaming related questions (AHK v1.1 and older)
as87323
Posts: 3
Joined: 19 Mar 2018, 13:57

Ahk not intercepting keystrokes randomly

19 Mar 2018, 14:28

Having a problem where once in a while it seems that AHK misses a keystroke, and that key is sent in its raw state. I was able to duplicate the problem in notepad by randomly pressing hotkeys and clicking the mouse, randomly i would get the letter the hotkey is tied to ("w","a", or "d") instead of a number. I have tried upping the priority, setting as critical, running as admin, and compiling to .exe, but still the problem persists. Not sure if I'm doing something wrong or I've run into a bug.

Any help would be greatly appreciated!

Here is my code:
process, priority,, R
cycle = 5


xButton2::

If toggle := !toggle
Sendinput, {H down}
else
Sendinput, {H up}

return



RButton::



if (cycle == 5) {
cycle = 5
sendinput 5


}

else if (cycle == 6) {
cycle = 6
sendinput 6


}

else if (cycle == 7) {
cycle = 7
sendinput 7

}

else if (cycle == 8) {
cycle = 8
sendinput 8


}

else if (cycle == 9) {
cycle = 9
sendinput 9


}

return

LButton::
Critical

if (cycle == 5) {
cycle = 6
sendinput 6

}

else if (cycle == 6) {
cycle = 7
sendinput 7

}

else if (cycle == 7) {
cycle = 8
sendinput 8

}

else if (cycle == 8) {
cycle = 9
sendinput 9

}

else if (cycle == 9) {
cycle = 5
sendinput 5

}

return

W::
Sendinput, {Numpad8 down}{Numpad2 up}
return

W up::
Sendinput, {Numpad8 up}
return

A::

Sendinput, {Numpad4 down}{Numpad7 down}{Numpad6 up}{Numpad9 up}
Return

A UP::
Sendinput, {Numpad4 up}{Numpad7 up}{Numpad6 up}{Numpad9 up}
return

D::

Sendinput, {Numpad6 down}{Numpad9 down}{Numpad4 up}{Numpad7 up}
Return

D Up::
Sendinput, {Numpad6 up}{Numpad9 up}{Numpad4 up}{Numpad7 up}
return

SPACE::

Sendinput, {Numpad2 down}
Return

SPACE Up::
sendinput, {Numpad2 up}
return





f8::
Suspend, Toggle
return

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Ahk not intercepting keystrokes randomly

19 Mar 2018, 15:03

cant reproduce
as87323
Posts: 3
Joined: 19 Mar 2018, 13:57

Re: Ahk not intercepting keystrokes randomly

19 Mar 2018, 15:17

Here's what i get:
8888694769847694788888888888869696947476947474747476969696969698869474786947476969698888476969698884769698888696947474747696988886969694747886969696969474786947474769884769694788694769476988886947478694747698886947884747869696969478884769888886969478696969696969694786947869694784769786947694786947888694747478699869478888885474764747474786988769698847698895869478669876984795869476697478884796958696478697869869947854786967478698698479547866947769888969475869669878884789847695696969696947869866947876984789694758669747886998695869669747884786996947856984766974786994756986769889695696478747847986958696478697698847956969847647878886996958669747886989475698647788985696477478869969856869477869847896956869477698478969478547696478769869984769547867869869847969475647698477698478969547886788699847586887698478956986947647747474747694788869985698478696784788699478869478694747476969869569476476978698476998475698694766947786984796947568786984789694785696478769476984786947895869647769478694798698547696477698898586947476876984798695847687698478969547869647869747869884769984747569687698869969847856887869696969696969w8947869569869647876988479695478684778698478969586888697698847869479698569868697698986984754786964786978888694788699569669694786974788478699694785696478697694788947869547866976969869847699478569478669786986969969475869476747886989475687694788699478547866947747889858696478769847869969847569647869747886994786954786697478847869969586947476869786988699478695696694784786978698698947869569669869886986986947887869886995669847769478478694784788847969475868477847894785476947686978698478699478569478669697478478869947869569698478669747869478869947858696697694788699478475696478697478479586967478698478969478858476964778694788947586964786974788699698475869476478788869478969547866947786984789694758696478786947889478695696478747869896947569669477869894785869647878698479869475869647869747886998586968477698847699475694786769478889856986697478698478895866987869476984788694798475694764788788476994769847694786985869686947784786947869947547868477869847869986947547869647869478788698869986958694768477478694788894786954764787698479869586476974788947858696478697869478894786947856869769886998695476477847869954786964786974788478699694769547696747869847984758476869477474747478478479475476694786974784796947586478697478869479869547866974786984786994786958669874786994786954786696947847786947886994756984764769477847896984758669747869847898869475866947786988476994769547866978869969569647747847869947856984747647747474747w69847869986985669786947869479694756947669477698694788699847569476694776984796954786694778698478969
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Ahk not intercepting keystrokes randomly

20 Mar 2018, 12:43

Sendinput, {H down} will press shift, as you told it to send upper case H.
W:: however, does not match if shift is held. Try *w::
By the way, do not expect the technique you are using to work with diagonals (eg W and A held together)
Also, bear in mind that the code you have will repeatedly send down events when you hold a key.
as87323
Posts: 3
Joined: 19 Mar 2018, 13:57

Re: Ahk not intercepting keystrokes randomly

20 Mar 2018, 18:39

Thanks for reply, the code itself works for me; its to remap the a and d keys to turn and strafe ( q and e) and the mouse cycles 5 sets of boost. H just turns a horn on and off from my mouse. didnt think about capitols being sent as shift+ letter, ill change that.

problem is that ever so often it seems the script isn't intercepting a keystroke. if it misses a down i spin right or left( as it is sending just "a or "d" ), if it misses an up i keep turning, or if it misses a click i dont get boost when i need it.

when keystroke is missed, it is sent in native state through OS as you can see by the randow "w"s showing up in the string of numbers
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Ahk not intercepting keystrokes randomly

21 Mar 2018, 05:44

If you Send {H down} YOU ARE PRESSING SHIFT.
During that time, the w:: hotkey WILL NOT WORK because w:: DOES NOT MATCH if shift is held.
In this case, you will see w appear when you press w

This is what is happening when it "does not intercept a keystroke".

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 47 guests