Page 1 of 1
Help with my AutoClicker
Posted: 18 Jun 2018, 12:53
by HKUK01
Hey, I'm a beginner and I've been looking for a code which can click on a random position within a range of set coordinates and sleep for a random amount of time within a range of time. The code I made only clicks on a specific coordinate and sleeps for a specific time.
f1::
MouseClick , Left , 10 , 19
sleep 600
MouseClick , Left , 565 , 180
sleep 600
MouseClick , Left , 289 , 199
sleep 600
Any help will be greatly appreciated.
Re: Help with my AutoClicker
Posted: 18 Jun 2018, 14:48
by DyaTactic
Use the Random function to generate a random number.
Let me know if you have any more questions.
Re: Help with my AutoClicker Topic is solved
Posted: 18 Jun 2018, 14:56
by swagfag
wrap
random in a function, then define another function for clicking,
sleep accepts expressions, so it can be used as is, in conjunction with your wrapped random function
Code: Select all
q::
randClick(1, 1, 20, 20)
Sleep rand(300, 1000)
randClick(1, 1, 20, 20)
Return
rand(min, max) {
Random, rand, min, max
return rand
}
randClick(x1, y1, x2, y2) {
x := rand(x1, x2)
y := rand(y1, y2)
Click %x%, %y%
}
Re: Help with my AutoClicker
Posted: 18 Jun 2018, 15:15
by HKUK01
swagfag wrote:wrap
random in a function, then define another function for clicking,
sleep accepts expressions, so it can be used as is, in conjunction with your wrapped random function
Code: Select all
q::
randClick(1, 1, 20, 20)
Sleep rand(300, 1000)
randClick(1, 1, 20, 20)
Return
rand(min, max) {
Random, rand, min, max
return rand
}
randClick(x1, y1, x2, y2) {
x := rand(x1, x2)
y := rand(y1, y2)
Click %x%, %y%
}
Hey, thanks for replying, I used your code below and it works great but I don't know what I'm doing wrong because on 'click 3' which I've added it doesn't seem to click on the right co-ordinate. Also how would I loop this entire code for a specific number of times? Thanks.
Code: Select all
q::
randClick(0, 0, 80, 80) ;click1
Sleep rand(300, 1000)
randClick(680, 1040, 730, 1060) ;click2
Sleep rand(300, 1000)
randClick(890, 100, 900, 110) ;click3
Return
rand(min, max) {
Random, rand, min, max
return rand
}
randClick(x1, y1, x2, y2) {
x := rand(x1, x2)
y := rand(y1, y2)
Click %x%, %y%
}
Re: Help with my AutoClicker
Posted: 18 Jun 2018, 15:34
by HKUK01
DyaTactic wrote:Use the Random function to generate a random number.
Let me know if you have any more questions.
Hey, thanks for replying, I've implemented the random function into the code but was wondering how I would loop this entire code below for a specific number of times. Also 'click 3' doesn't seem to click on to the correct co-ordinate. Thanks.
Code: Select all
q::
randClick(0, 0, 80, 80) ;click1
Sleep rand(300, 1000)
randClick(680, 1040, 730, 1060) ;click2
Sleep rand(300, 1000)
randClick(890, 100, 900, 110) ;click3
Return
rand(min, max) {
Random, rand, min, max
return rand
}
randClick(x1, y1, x2, y2) {
x := rand(x1, x2)
y := rand(y1, y2)
Click %x%, %y%
}
Re: Help with my AutoClicker
Posted: 18 Jun 2018, 15:39
by swagfag
check the
CoordMode function and select a mode accordingly.
Re: Help with my AutoClicker
Posted: 18 Jun 2018, 15:40
by DyaTactic
Looping like this?
Code: Select all
q::
Loop, 3 ; Repeat 3 times.
{
randClick(0, 0, 80, 80) ;click1
Sleep rand(300, 1000)
randClick(680, 1040, 730, 1060) ;click2
Sleep rand(300, 1000)
randClick(890, 100, 900, 110) ;click3
}
Return
Re: Help with my AutoClicker
Posted: 18 Jun 2018, 15:53
by HKUK01
DyaTactic wrote:Looping like this?
Code: Select all
q::
Loop, 3 ; Repeat 3 times.
{
randClick(0, 0, 80, 80) ;click1
Sleep rand(300, 1000)
randClick(680, 1040, 730, 1060) ;click2
Sleep rand(300, 1000)
randClick(890, 100, 900, 110) ;click3
}
Return
Yup that works fine and I figured out the problem with click 3 thanks a lot for the help.
Re: Help with my AutoClicker
Posted: 18 Jun 2018, 16:18
by DyaTactic
You're most welcome