Page 1 of 1

Autoclicker loop broken?

Posted: 19 Jun 2018, 06:27
by HKUK01
With the help of the community I managed to make this autoclicker with the code below which clicks on a random location and sleeps for a random amount of time within a specific range. However, with every other loop the code executes, it seems to miss out 'click 2,' e.g. everything will work perfect on loops 1,3,5,7 etc but will hit every click except 'click 2' on loops 2,4,6,8 etc. Is there something wrong with the code? Any help will be greatly appreciated.

Code: Select all

F1::
	Loop, 46
	{
		randClick(865, 533, 1094, 662) ;click1
		Sleep rand(2313, 3604)	
		randClick(1004, 736, 1005, 737) ;click2
		Sleep rand(1890, 2945)
		randClick(565, 96, 742 , 177) ;click3
		Sleep rand(2104, 2502)
		randClick(950, 696, 1238, 711) ;click4
	}
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%
}

Esc::ExitApp

Re: Autoclicker loop broken?

Posted: 19 Jun 2018, 13:53
by swagfag
its probably clicking, but likely somewhere you arent expecting it to. Select an appropriate CoordMode and test again

Re: Autoclicker loop broken?

Posted: 19 Jun 2018, 14:14
by HKUK01
swagfag wrote:its probably clicking, but likely somewhere you arent expecting it to. Select an appropriate CoordMode and test again
I tried adding a double click and changing the co-ordinates slightly but doesn't seem to help. The cursor just ignores only click 2 on loops 2,4,6 etc. but hits every other click on all loops inc. 2,4,6 etc.

Re: Autoclicker loop broken?

Posted: 20 Jun 2018, 08:23
by HKUK01
anyone have any ideas?

Re: Autoclicker loop broken?

Posted: 20 Jun 2018, 15:52
by swagfag
is this for a game? are you clicking on windows? did u try a different coordmode yet? idk what to tell you, the functions obviously fire unobstructed so it aint a problem with the script per se. If u arent getting the clicks youre expecting, it might be smth to do with the thing thats supposed to receive them(whether that be a game or an app, some require additional delay to register), it might be that the coordinates are wrong. Besides that, short of posting a video of whats wrong with it, i dont think i can help u any further