Hold M to spam M with randomization

Ask gaming related questions (AHK v1.1 and older)
TellyRush
Posts: 17
Joined: 26 Jan 2021, 02:42

Hold M to spam M with randomization

04 Feb 2021, 22:37

I need a code that will spam M when I hold on M, I also need randomization about 0-50ms.
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Hold M to spam M with randomization

05 Feb 2021, 06:20

Code: Select all

$m::
While GetKeyState("m", "P") {
 SendInput m
 Random, wait, 0, 50
 If wait
  Sleep, wait
}
Return
ThewarII
Posts: 49
Joined: 01 Oct 2014, 09:33

Re: Hold M to spam M with randomization

08 Feb 2021, 01:00

I don't think need "if wait" 😁
I :superhappy:(happy) when I know about AHK.
I have & am using AHK to do anything in windows microsoft.
The first time, I know it in around year 2013.
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Hold M to spam M with randomization

08 Feb 2021, 01:13

Of course, that is up to you.
A delay of 0 yields the remainder of the script's current timeslice to any other processes that need it (as long as they are not significantly lower in priority than the script). Thus, a delay of 0 produces an actual delay between 0 and 20ms (or more), depending on the number of needy processes (if there are no needy processes, there will be no delay at all).

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 64 guests