Alright everyone, I just need some help on finishing the autoclicker.
Here is my code so far:
toggle = 0
#MaxThreadsPerHotkey 2
F12::
Toggle := !Toggle
While Toggle{
Random, rand2, 2843, 3045
Random, rand1, 53, 113
Random, xpos1, 505, 529
Random, ypos1, 568, 578
Random, xpos2, 505, 529
Random, ypos2, 568, 578
Click %xpos1% %ypos1%
sleep, rand1
Click %xpos2% %ypos2%
sleep, rand2
}
return
Basically, an autoclicker that will click at a specific spot with a 2 delay time at random mouse positions (within reason).
Now, I want to be able use a iteration loop, where the user inputs a value, say 4, and the program goes through it 4 times.
I've tried:
F12::
Loop, 6
{
Random, rand2, 2843, 3045
Random, rand1, 53, 113
Random, xpos1, 505, 529
Random, ypos1, 568, 578
Random, xpos2, 505, 529
Random, ypos2, 568, 578
Click %xpos1% %ypos1%
sleep, rand1
Click %xpos2% %ypos2%
sleep, rand2
return
}
but somehow, it just clicks three times and cancels......
Also, I looked on the help section and found only: InputBox, OutputVar [, Title, Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default], but it only gives a string, but I want a value, so the loop can use the input to loop the correct number of times.
I am really stuck, so any help would be appreciated....
Autoclicker: Need help on User input & loop command
Re: Autoclicker: Need help on User input & loop command
yaoz889 wrote:Alright everyone, I just need some help on finishing the autoclicker.
Here is my code so far:SpoilerBasically, an autoclicker that will click at a specific spot with a 2 delay time at random mouse positions (within reason).
Now, I want to be able use a iteration loop, where the user inputs a value, say 4, and the program goes through it 4 times.
I've tried:Spoilerbut somehow, it just clicks three times and cancels......
Also, I looked on the help section and found only: InputBox, OutputVar [, Title, Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default], but it only gives a string, but I want a value, so the loop can use the input to loop the correct number of times.
I am really stuck, so any help would be appreciated....
Hi try this :
Code: Select all
F12::
InputBox, val, LOOP TIMES, Enter Number:,,200,120,,,,,6
Loop, %val%
{
Random, rand1, 53, 113
sleep, rand1
Random, xpos1, 505, 529
Random, ypos1, 568, 578
Click %xpos1%, %ypos1%
Random, xpos2, 505, 529
Random, ypos2, 568, 578
Click %xpos2%, %ypos2%
Random, rand2, 2843, 3045
sleep, rand2
}
return
Re: Autoclicker: Need help on User input & loop command
Here's another approach
I've included 2 functions which simplifies the process making it much better on the eyes. =P
Code: Select all
#persistent
iterations := 1 ;default
return
f11::
inputbox,iterations,Iterations,input the amount of times to click below
tooltip,Iterations set to %iterations%
settimer,tooltipoff,1000
return
tooltipoff:
tooltip
return
F12::
loop % iterations {
Click(505,568,529,578) ;x,y,x2,y2
sleep % Random(2843,3045)
}
return
f8::exitapp
f9::reload
Click(x,y,x2=false,y2=false) {
if (x2 and y2) {
x := Random(x,x2)
y := Random(y,y2)
}
Click,%x%,%y%,down
sleep % Random(53,77)
Click,up
}
Random(min,max) {
random,v,%min%,%max%
return v
}
Some of my AHK programs: 3D Voxel Game - Platformer Game
GitHub projects : Image/Pixel scanning class - Direct2D overlay class
GitHub projects : Image/Pixel scanning class - Direct2D overlay class
Re: Autoclicker: Need help on User input & loop command
Thanks a lotYoucefHam wrote:yaoz889 wrote:Alright everyone, I just need some help on finishing the autoclicker.
Here is my code so far:SpoilerBasically, an autoclicker that will click at a specific spot with a 2 delay time at random mouse positions (within reason).
Now, I want to be able use a iteration loop, where the user inputs a value, say 4, and the program goes through it 4 times.
I've tried:Spoilerbut somehow, it just clicks three times and cancels......
Also, I looked on the help section and found only: InputBox, OutputVar [, Title, Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default], but it only gives a string, but I want a value, so the loop can use the input to loop the correct number of times.
I am really stuck, so any help would be appreciated....
Hi try this :
Code: Select all
F12:: InputBox, val, LOOP TIMES, Enter Number:,,200,120,,,,,6 Loop, %val% { Random, rand1, 53, 113 sleep, rand1 Random, xpos1, 505, 529 Random, ypos1, 568, 578 Click %xpos1%, %ypos1% Random, xpos2, 505, 529 Random, ypos2, 568, 578 Click %xpos2%, %ypos2% Random, rand2, 2843, 3045 sleep, rand2 } return
Re: Autoclicker: Need help on User input & loop command
thanks a lot, just what I neededSpawnova wrote:Here's another approach
I've included 2 functions which simplifies the process making it much better on the eyes. =PCode: Select all
#persistent iterations := 1 ;default return f11:: inputbox,iterations,Iterations,input the amount of times to click below tooltip,Iterations set to %iterations% settimer,tooltipoff,1000 return tooltipoff: tooltip return F12:: loop % iterations { Click(505,568,529,578) ;x,y,x2,y2 sleep % Random(2843,3045) } return f8::exitapp f9::reload Click(x,y,x2=false,y2=false) { if (x2 and y2) { x := Random(x,x2) y := Random(y,y2) } Click,%x%,%y%,down sleep % Random(53,77) Click,up } Random(min,max) { random,v,%min%,%max% return v }
Who is online
Users browsing this forum: No registered users and 104 guests