Need help creating a simple game script Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Maqajin
Posts: 6
Joined: 30 Jan 2023, 08:01

Need help creating a simple game script

Post by Maqajin » 30 Jan 2023, 08:09

I need a script so that during the game, when I press the hotkey for example "V" button, run a script that press "D" hold 145ms and released the D button.
I even wrote this script:

Code: Select all

Send {D down} 
Sleep 145  
Send {D up}
but I need to instantly activate it in the game at any time, and scroll it 1 time, and then the script again waits for the launch command
thanks a lot for any help
Last edited by BoBo on 30 Jan 2023, 08:17, edited 1 time in total.
Reason: Added [code][/code]-tags.

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Need help creating a simple game script  Topic is solved

Post by mikeyww » 30 Jan 2023, 09:19

Welcome to this AutoHotkey forum!

Your question is, "How do I create a hotkey?"

See: Introduction and simple examples

Code: Select all

#Requires AutoHotkey v1.1.33
v::
SetKeyDelay,, 145
Send d
SoundBeep 1500
Return

Code: Select all

#Requires AutoHotkey v2.0
v:: {
 SetKeyDelay , 145
 SendEvent 'd'
 SoundBeep 1500
}

Maqajin
Posts: 6
Joined: 30 Jan 2023, 08:01

Re: Need help creating a simple game script

Post by Maqajin » 30 Jan 2023, 10:06

mikeyww wrote:
30 Jan 2023, 09:19
Welcome to this AutoHotkey forum!

Your question is, "How do I create a hotkey?"

See: Introduction and simple examples

Code: Select all

#Requires AutoHotkey v1.1.33
v::
SetKeyDelay,, 145
Send d
SoundBeep 1500
Return

Code: Select all

#Requires AutoHotkey v2.0
v:: {
 SetKeyDelay , 145
 SendEvent 'd'
 SoundBeep 1500
}
Thank you very much, your code works as it should, but I faced another problem, the game is protected by xigncode3, and this anticheat system block autohotkey, at desctop its work, but in game doesnt

Maqajin
Posts: 6
Joined: 30 Jan 2023, 08:01

Re: Need help creating a simple game script

Post by Maqajin » 30 Jan 2023, 10:44

mikeyww wrote:
30 Jan 2023, 09:19
Welcome to this AutoHotkey forum!

Your question is, "How do I create a hotkey?"

See: Introduction and simple examples

Code: Select all

#Requires AutoHotkey v1.1.33
v::
SetKeyDelay,, 145
Send d
SoundBeep 1500
Return

Code: Select all

#Requires AutoHotkey v2.0
v:: {
 SetKeyDelay , 145
 SendEvent 'd'
 SoundBeep 1500
}
I read it on the Internet, launched it as an administrator, and now it works even through the anti-cheat system, thank you very much. I tested it in the game, and noticed that it does not always hold the key for 145ms, sometimes 135 and sometimes 155, is it possible to make it work more accurately? in any case, it helps a lot even with a little inaccuracy, I still get a serious advantage

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Need help creating a simple game script

Post by mikeyww » 30 Jan 2023, 11:28

I'm not sure, though you can try the down and up sequence that you posted, with intervening sleep. KeyHistory will show the timing. The key-up should never occur before the sleep ends.

Post Reply

Return to “Gaming Help (v1)”