At the bottom of this post you will find two ready-to-go autoclickers/RapidClickers!
This is the one size fits all autofire thread. Here, you will find many different ways to spam keys, repeat actions, etc. It aims to keep the scripts very short (enough to fit in a non scrolling code box) but at the same time be very clear. After the title of most is a one-line explanation of how to use it.
Most scripts will click, type 'a', and wait 1/10 of a second during its loop. You can replace this with your own code in any of the spots. Most scripts will use the F8 hotkey.
There are several types of loops that can be made:
The SetTimer: (Same as the simple pause, but allows other code to run)
SetTimer Click, 100 F8::Toggle := !Toggle Click: If (!Toggle) Return Click Send a returnThe SetTimer (ternary version, by None, doesn't use resources when off):
i:=0 F7::SetTimer, Spam, % (i:=!i) ? "100" : "Off" ; uses ternary Spam: Click Send a returnIf you find the ternary ( ? : ) operator difficult, check out the ternary guide by [VxE] or use the other SetTimer method.
The Toggle: (Press once to start, again to stop, etc like the simple pause)
Warning: If the hotkey used by the Toggle is input faster than the loop executes, the maximum number of simultaneous threads per hotkey can be exceeded, which leaves the execution "stuck" in a spamming state (reference Leef_me's explanation).
toggle = 0 #MaxThreadsPerHotkey 2 F8:: Toggle := !Toggle While Toggle{ Click Send a sleep 100 } returnThe Self-Sender: (emulates auto-repeat) (hold down the key to do action)
$a:: While GetKeyState("a","p"){ Send a Sleep 100 } returnThe Simple Pause: (Press F8 to toggle state i.e., once on, two off...)
Pause Loop{ Click Send a sleep 100 } F8::PauseThe Hold-Down: (key retains functionality unless held down)
$a:: KeyWait a, T0.5 ; Wait 1/2 second for user to release "a" key If ErrorLevel ; Still held down While GetKeyState("a","p"){ ; While it is held down Click Send a Sleep 100 } Else ; They let go in time Send a return
The Cycle (cycles through a list of keys to send)
list=a,b,c,{enter},string{click} ; the list of keys and combos. comma separated. stringsplit, list, list,`, Counter = 0 $F8:: ; press F8 to cycle through Counter := (Counter=list0) ? (1) : (Counter+1) send % list%counter% returnIf you find the ternary ( ? : ) operator difficult, check out the ternary guide by [VxE] or tidbit's ternary-free post down the page.
The Cycle-Hold-Down: (Cycles through the list while F8 is held)
list=a,b,c,{enter},string{click} ; the list of keys and combos. comma separated. stringsplit, list, list,`, Counter = 0 $F8:: While GetKeyState("F8","P"){ Counter := (Counter=list0) ? (1) : (Counter+1) Send % list%counter% Sleep 50 } return
And, by very popular request, two cut and paste (Voila! It works!) autoclickers: *
Hold Click to Rapid-Click:
~$LButton:: While GetKeyState("LButton", "P"){ Click Sleep 50 ; milliseconds } returnHold F8 to Rapid-Click:
F8:: While GetKeyState("F8", "P"){ Click Sleep 50 ; milliseconds } return*The toggle works well for this purpose as well
To have any key exit the loop, see this example.
https://ahknet.autoh...faqbot/faq.htmlIt doesn't work in my game!
http://www.autohotke...s/FAQ.htm#games
Here are some helpful links to get you started customizing these:
#MaxThreadsPerHotkey
Send
Click
KeyWait
GetKeyState
Loop (normal)
SetTimer
Edited by nimda, 06 August 2015 - 10:35 PM.
Removed broken color from the code boxes.