Page 1 of 1

Looking for afk script

Posted: 07 Aug 2018, 07:31
by Szynsz
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?

Re: Looking for afk script

Posted: 07 Aug 2018, 12:09
by swagfag

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
}

Re: Looking for afk script

Posted: 17 Aug 2018, 02:54
by Szynsz
Hmm i try it but doesn't work :/

Re: Looking for afk script

Posted: 17 Aug 2018, 03:19
by swagfag
ull probably have to play around with SetKeyDelay if the game isnt registering the keypresses, also try different SendModes

Re: Looking for afk script

Posted: 17 Aug 2018, 14:17
by Szynsz
I totally dont have idea abut you talking.

Re: Looking for afk script

Posted: 17 Aug 2018, 16:18
by swagfag
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

Re: Looking for afk script

Posted: 17 Aug 2018, 17:45
by Szynsz
Sorry, but can you modify this script for me? Im totaly dump in programming.

Re: Looking for afk script

Posted: 19 Aug 2018, 14:53
by Szynsz
Can anyone make this script working? I will be realy grateful.

Re: Looking for afk script

Posted: 20 Aug 2018, 06:18
by Madness

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

Re: Looking for afk script

Posted: 05 Oct 2018, 11:55
by Szynsz
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.

Re: Looking for afk script

Posted: 07 Oct 2018, 20:09
by ItsClint
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.

Re: Looking for afk script

Posted: 12 Oct 2018, 10:40
by Szynsz
Ok second script works, thx :)

One more thing. This script can be use in minimized window?

Re: Looking for afk script

Posted: 14 Feb 2021, 13:04
by imgole11
Can anyone tell me how to add enter key loop in there with w and s ?