This is example of very basic autoclicker with start/stop function.
Code:
HotKeySet("{F9}", "left") ;=> set F9 as hotkey to start/stop left mouse clicking
HotKeySet("{F10}", "right") ;=> set F10 as hotkey to start/stop right mouse clicking
HotKeySet("{F11}", "done") ;=> set F11 as hotkey to close app
Dim $l_run = False ;=> set default value
Dim $r_run = False ;=> set default value
$t = 20 ;=> time in ms
$clicks = 1 ;=> amount of clicks
;=> close app
Func done()
Exit ;=> cose app
EndFunc
;=> start/stop right clicking
Func right()
If $r_run = False Then
;=> if $r_run have value false we change it to true
$r_run = True
Else
;=> in case when $r_run is set to true we change it to false
$r_run = False
EndIf
EndFunc
;=> start/stop left clicking
Func left()
If $l_run = False Then
;=>if $l_run have value false we change it to true
$l_run = True
Else
;in case when $r_run is set to true we change it to false
$l_run = False
EndIf
EndFunc
While True ;=> loop start
$pos = MouseGetPos() ;=> this function get current position of the mouse
If $r_run = True Then ;=>
;=> $pos contains x/y values of current position of mouse, $clicks containts amount of clicks script is suppose to do in 1 loop
MouseClick("right",$pos[0],$pos[1],$clicks)
EndIf ;=> zakonczenie if
If $l_run = True Then
MouseClick("left",$pos[0],$pos[1],$clicks)
EndIf
Sleep($t) ;=> we put loop to sleep for 20ms
WEnd ;=> end of loop