Looking for afk script

Ask gaming related questions (AHK v1.1 and older)
Szynsz
Posts: 33
Joined: 09 Mar 2017, 03:33

Looking for afk script

07 Aug 2018, 07:31

Hello i'm looking for simple anti afk script, tak put every 5 second randomly w a s and d keys. I know that there are that scripts, but all i tryed don't work for me. I it possible i want have activate and stopping keys for example F7 and F8. Can anyone make this for me?
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Looking for afk script

07 Aug 2018, 12:09

Code: Select all

Letters := StrSplit("wasd")

F7::SetTimer SendLetter, 5000
F8::SetTimer SendLetter, Off

SendLetter:
	Send % Letters[rand(1, Letters.Count())]	
Return

rand(a, b) {
	Random rand, a, b
	return rand
}
Szynsz
Posts: 33
Joined: 09 Mar 2017, 03:33

Re: Looking for afk script

17 Aug 2018, 02:54

Hmm i try it but doesn't work :/
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Looking for afk script

17 Aug 2018, 03:19

ull probably have to play around with SetKeyDelay if the game isnt registering the keypresses, also try different SendModes
Szynsz
Posts: 33
Joined: 09 Mar 2017, 03:33

Re: Looking for afk script

17 Aug 2018, 14:17

I totally dont have idea abut you talking.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Looking for afk script

17 Aug 2018, 16:18

abut i talking, is the key presses might be happening way too fast and the game could be polling for input, expecting the keys to have been held down for a longer period of time. to alter this interval, use the SetKeyDelay command and see whether raising this delay improves anything. Use the SendMode command to try different ways of sending the keystrokes
Szynsz
Posts: 33
Joined: 09 Mar 2017, 03:33

Re: Looking for afk script

17 Aug 2018, 17:45

Sorry, but can you modify this script for me? Im totaly dump in programming.
Szynsz
Posts: 33
Joined: 09 Mar 2017, 03:33

Re: Looking for afk script

19 Aug 2018, 14:53

Can anyone make this script working? I will be realy grateful.
Madness
Posts: 3
Joined: 19 Aug 2018, 13:18

Re: Looking for afk script

20 Aug 2018, 06:18

Code: Select all

2::
Pause

1::
Antiafk:
Send {F7}
Sleep 5000
Send {F8}
GoTo Antiafk

Return

Should work, you start it with 1 and pause it with 2
Szynsz
Posts: 33
Joined: 09 Mar 2017, 03:33

Re: Looking for afk script

05 Oct 2018, 11:55

Madness i try your script but change F7 and F8 to W and S. I open notepad and start script, but nothing happens. But your script is what i need, simple program that send w and after 5 sec send s and loop it.
ItsClint
Posts: 15
Joined: 28 Sep 2018, 05:34

Re: Looking for afk script

07 Oct 2018, 20:09

What game are you trying this on? First off, test if AHK actually works on your game. To do that, try a simple "Send" command with any key that does anything with your game. For example, try, first:

Code: Select all

8::
Send {W down}
Sleep 3000
Send {W up}
Does this move you forward when you press 8? Should keep W pressed for 3 seconds, then release the key. If it works, this one should work too:

Code: Select all

#SingleInstance, Force ; Forces a single instance of the script. Useful if you edit and re-open your script many times.
#InstallKeybdHook ; Keyboard hook. Higher chances to make it work with your game.
SetKeyDelay, 100, 200 ; High delay to make sure your hotkeys work. You can lower these values as long as they work!

if not A_IsAdmin ; Admin rights checker.
{
   Run *RunAs "%A_ScriptFullPath%"  
   ExitApp
}

1::
	Loop ; The actual loop. Sends W, waits about 5 seconds, sends S. Should be enough to fool an anti-afk. Customizable, of course.
	{
		Send {W}
		RandSleep(4600,5400)
		Send {S}
		RandSleep(4400,5600)
	}
	Return

2::Pause ; Pause the script (and resume).


;--V Functions down here V--


RandSleep(x,y) ; Neat function to have random sleep times.
{
	Random, rand, %x%, %y%
	Sleep %rand%
}
If you specifically need it to use other keys I might come back to this later.
Szynsz
Posts: 33
Joined: 09 Mar 2017, 03:33

Re: Looking for afk script

12 Oct 2018, 10:40

Ok second script works, thx :)

One more thing. This script can be use in minimized window?
imgole11
Posts: 1
Joined: 14 Feb 2021, 13:01

Re: Looking for afk script

14 Feb 2021, 13:04

Can anyone tell me how to add enter key loop in there with w and s ?

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 46 guests