Keypress script has issues with ghosting only in a specific scenario

Ask gaming related questions (AHK v1.1 and older)
lsstefan
Posts: 1
Joined: 21 Mar 2024, 10:28

Keypress script has issues with ghosting only in a specific scenario

Post by lsstefan » 21 Mar 2024, 13:31

Hello.
First of all, thank you for everyone that participates in this project, I've been using AHK for almost a decade in World of Warcraft and it saved my fingers and wrist.

So, I'm using a script that spams the key I press, so I don't have to hit it non stop and flatten my index.
I've been using the same script I stole from someone on the web and I just add more keys if needed:

Code: Select all

#ifWinActive World of Warcraft

{

$2::

   Loop  

   {

    if not GetKeyState("2", "P")

      break

     Send 2 

     sleep 99

    }

return



}


{

$1::

   Loop  

   {

    if not GetKeyState("1", "P")

      break

     Send 1 

     sleep 95

    }

return



}
{

$3::

   Loop  

   {

    if not GetKeyState("3", "P")

      break

     Send 3 

     sleep 105

    }

return



}
{

$4::

   Loop  

   {

    if not GetKeyState("4", "P")

      break

     Send 4 

     sleep 90
    }

return



}


{

$v::

   Loop  

   {

    if not GetKeyState("v", "P")

      break

     Send v 

     sleep 200

    }

return


}
{

$f::

   Loop  

   {

    if not GetKeyState("f", "P")

      break

     Send f 

     sleep 200

    }

return


}
{

$t::

   Loop  

   {

    if not GetKeyState("t", "P")

      break

     Send t

     sleep 200

    }

return


}
{

$6::

   Loop  

   {

    if not GetKeyState("6", "P")

      break

     Send 6

     sleep 200

    }

return


}
{

$r::

   Loop  

   {

    if not GetKeyState("r", "P")

      break

     Send r

     sleep 100

    }

return


}
{

$5::

   Loop  

   {

    if not GetKeyState("5", "P")

      break

     Send 5

     sleep 101

    }

return


}
{

$c::

   Loop  

   {

    if not GetKeyState("c", "P")

      break

     Send c

     RandSleep (100,200)

    }

return


}
The rest is copy paste from above, just change 2 with 3 etc.
I started playing a class that requires you to spam 1 special ability for max output. Said ability is off cooldown compared to the rest, so you basically press 2 buttons at the same time. I thought about having the special ability on a comfy button (mouse or C key), keep it pressed and just do my usual rotation.
I also thought about the sleep part and found out you can random sleep, so I stole another script from this community to add that function, to make it less robotic I guess, not have the same pause for 300 key presses. I have tried using the same logic { function random } for each key, but it threw an error because it used duplicates random. So I changed to be { random all functions } instead of individual. It works, everything is fine, I get random intervals.

Code: Select all

#ifWinActive World of Warcraft

{

RandSleep(x,y) {
Random, rand, %x%, %y%
Sleep %rand%
}

$2:: 
While GetKeyState("2", "P") {
 Send 2
 RandSleep(50,100) 
 }
return 


$1:: 
While GetKeyState("1", "P") {
 Send 1
 RandSleep(50,100) 
 }
return 

$3:: 
While GetKeyState("3", "P") {
 Send 3
 RandSleep(50,100) 
 }
return 

$4:: 
While GetKeyState("4", "P") {
 Send 4
 RandSleep(50,100) 
 }
return 

$5:: 
While GetKeyState("5", "P") {
 Send 5
 RandSleep(50,100) 
 }
return 

$6:: 
While GetKeyState("6", "P") {
 Send 6
 RandSleep(100,200) 
 }
return 

$7:: 
While GetKeyState("7", "P") {
 Send 7
 RandSleep(100,200) 
 }
return 

$8:: 
While GetKeyState("8", "P") {
 Send 8
 RandSleep(100,200) 
 }
return 

$9:: 
While GetKeyState("9", "P") {
 Send 9
 RandSleep(100,200) 
 }
return 

$f:: 
While GetKeyState("f", "P") {
 Send f
 RandSleep(100,200) 
 }
return 

$t:: 
While GetKeyState("t", "P") {
 Send t
 RandSleep(100,200) 
 }
return 

$r:: 
While GetKeyState("r", "P") {
 Send r
 RandSleep(50,100) 
 }
return 

$c:: 
While GetKeyState("c", "P") {
 Send c
 RandSleep(50,200) 
 }
return 

}
I did the rollover test, I pressed 31 keys at the same time, my keyboard is advertised as complete anti-ghosting. The issue I encountered is the script refusing to send a key if I press it before the special ability spam one. However, if you start with the spam key first and then click the others, it works. Of course, I can't figure it out instantly mid game, so I lose casts which defeats the purpose of the script.
I have made a recording to show the example. c is the special button that is always pressed and 2 3 4 are part of my rotation. In the 1st one I start with c pressed and then I start clicking 2 3 4. You can see towards the end, I pressed 2 more and c never appeared till I let off the button. In the 2nd one, I start with 4, then I press c and 4 isn't sent unless I let off c. The other buttons, 2 3 work. This is the same for every button I start before c.

https://www.flexclip.com/share/548404649eb96416c4022bc208d6f3d8e3ca47f.html

Any thoughts about this? Also, does it matter in the script where the buttons are? C button is the last in the list, maybe it doesn't like it there and it throws "errors"?

Thank you,
Stefan

Return to “Gaming Help (v1)”