Help with configuring AHK

Ask gaming related questions
angelical
Posts: 1
Joined: 08 Jan 2020, 02:43

Help with configuring AHK

08 Jan 2020, 02:57

I'm trying to create a macro to play a game and I need help at configuring it.

;qq
$Up::
if ( GetKeyState("ScrollLock", "T") ) ; this will be 'true' if ScrollLock is toggled 'on'
{send, {Up down}
sleep, 0.14777777777777
send, {Up up}
sleep, 0.9333
send, {Up down}
sleep, 0.1477777777777
}
else send z
return

this is part of it. i want for it to work like this: i press UP (or DOWN, or LEFT, or RIGHT) once and it repeats one time (creating a two-keystrokes) like >> but it doesn't need to stay eternal, which is what's going on currently. the char after the second stroke keeps going at the direction i pressed for eternity, or until i press another key. i would like to know if it can act like: RIGHT>, RIGHT>, but it will stop after I release RIGHT> again. "just as if i clicked one time >, then one more > and hold it until i release it.
i want those sleep values to be the lowest(fastest) as possible, if you mind
User avatar
Xtra
Posts: 1829
Joined: 02 Oct 2015, 12:15

Re: Help with configuring AHK

09 Jan 2020, 02:42

You are sending the Up arrow key "Down" then "Up" and then "Down" where is the last "Up" to complete this cycle of two keystrokes?
Also if you want less then 10-16ms sleeps see the #2 example in docs for: Sleep
User avatar
SyntaxTerror
Posts: 19
Joined: 23 May 2017, 12:55

Re: Help with configuring AHK

13 Jan 2020, 06:11

@angelical: I think you are using Sleep in the wrong way, the value is not in seconds, but milliseconds (eg. Sleep 1000 => 1 second pause).

Also, I read there that in most games, "DirectX(DirectInput) [...] 'polls' the keyboard every 15ms(varies slightly) and records the keys that are down, then 15ms later it takes another 'snapshot' and compares the two. This is how games allow you to hold two(or more) keys at the same time, but very fast(sub 10-15ms) inputs can fall between snapshots and the game never sees the keypress. If your script is very twitchy and seems to skip over some keypresses then this is likely the problem."
So don't try to make keystrokes too clone one from another.

For GTA5, I've seen scripts using 25 ms between keystrokes, but on my PC I prefer to use 40 ms (anyway, 40 ms pauses make 25 keystrokes per second, that is still very fast).

Good luck.

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 19 guests