Sprintkey script

Ask gaming related questions (AHK v1.1 and older)
Snesty
Posts: 6
Joined: 20 Jun 2022, 04:28

Sprintkey script

Post by Snesty » 20 Jun 2022, 04:32

Hello, I need help to create a script that makes me sprint in one tap
Especially in a game, it needs to press W twice to run, I want a script that makes me sprint in one W, with the "w" activation key.. Is this possible?

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

Re: Sprintkey script

Post by mikeyww » 20 Jun 2022, 05:22

Code: Select all

~w::w

Snesty
Posts: 6
Joined: 20 Jun 2022, 04:28

Re: Sprintkey script

Post by Snesty » 20 Jun 2022, 06:36

that's it?@mikeyww

User avatar
boiler
Posts: 17404
Joined: 21 Dec 2014, 02:44

Re: Sprintkey script

Post by boiler » 20 Jun 2022, 07:44

Did you try it?

Snesty
Posts: 6
Joined: 20 Jun 2022, 04:28

Re: Sprintkey script

Post by Snesty » 20 Jun 2022, 09:20

@boiler
yes i did, it works on typing, but ingame doesn't seem to work

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

Re: Sprintkey script

Post by mikeyww » 20 Jun 2022, 09:42

You can try as admin.

Code: Select all

If !A_IsAdmin && !(DllCall("GetCommandLine", "str") ~= " /restart(?!\S)") {
 Try Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
 ExitApp
}
~w::
SetKeyDelay,, 25
Send w
Return
viewtopic.php?f=7&t=11084

Snesty
Posts: 6
Joined: 20 Jun 2022, 04:28

Re: Sprintkey script

Post by Snesty » 20 Jun 2022, 12:31

I always run as admin
I tried the last code you sent, but my character doesn't run, the script is spamming ww really quickly.
practically, the script has to make me run without stopping and when I release the activation key which in this case is the "w" the script stops. Do you think it is possible to create such a script?
really thanks for the help

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

Re: Sprintkey script

Post by mikeyww » 20 Jun 2022, 13:04

Since AHK knows nothing about running or stopping, you would need to specify what keys to send, and with what triggering & timing, step by step.

User avatar
boiler
Posts: 17404
Joined: 21 Dec 2014, 02:44

Re: Sprintkey script

Post by boiler » 20 Jun 2022, 16:08

Snesty wrote: I always run as admin
Perhaps you actually are running the script as admin, but a lot of people think that if their user privileges for Windows is Administrator, then they are running the script as admin. They are not the same thing. Just making sure.

Snesty
Posts: 6
Joined: 20 Jun 2022, 04:28

Re: Sprintkey script

Post by Snesty » 21 Jun 2022, 03:13

mikeyww wrote:
20 Jun 2022, 13:04
Since AHK knows nothing about running or stopping, you would need to specify what keys to send, and with what triggering & timing, step by step.
i think its not possible for me, since it's my first time using ahk

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

Re: Sprintkey script

Post by mikeyww » 21 Jun 2022, 05:14

My suggestion is not about coding AHK. It is about describing your goal in ways that refer to keyboard, mouse, or windows. If you do not know your goal with those things, AHK will not enhance your success in achieving it!

shanshans
Posts: 27
Joined: 13 Dec 2015, 08:10

Re: Sprintkey script

Post by shanshans » 21 Jun 2022, 12:38

Code: Select all


~w::			; 
send {w down}
sleep 5		;or more than 5
send {w up}
sleep 5
send {w down}
return

w up::
sleep 20
send {w up}   ; getkeystate for WASD before the release maybe needed...
return

Something like that ?

Snesty
Posts: 6
Joined: 20 Jun 2022, 04:28

Re: Sprintkey script

Post by Snesty » 22 Jun 2022, 11:47

shanshans wrote:
21 Jun 2022, 12:38

Code: Select all


~w::			; 
send {w down}
sleep 5		;or more than 5
send {w up}
sleep 5
send {w down}
return

w up::
sleep 20
send {w up}   ; getkeystate for WASD before the release maybe needed...
return

Something like that ?
Yeah, it's close to what I want, now it runs by pressing once, but after a sec it goes crazy, like the ww keeps spamming, and it runs and stop in like 0.1secs

shanshans
Posts: 27
Joined: 13 Dec 2015, 08:10

Re: Sprintkey script

Post by shanshans » 22 Jun 2022, 13:58

Code: Select all


w::
toggle:=!toggle
if toggle=1
{
send {w down}
sleep 55		; tweakable
send {w up}
sleep 55            ; tweakable
send {w down}
return
}
send {w up}
return

Don't know "~" is needed or not... You need to test it yourself...
Press w one time to run , press it again to stop. (It may work ¯\_( ͡° ͜ʖ ͡°)_/¯ Good LUCKI)

Post Reply

Return to “Gaming Help (v1)”