Click in random x, y not working Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Manjack

Click in random x, y not working

21 Jan 2018, 11:47

The title doesnt really do it justice, but I'm having issues with a script i'm working on right now.

I'm trying to make a script that will click randomly in a specified given area by x and y coords. I've had no trouble with it so far and it's been working fine doing what I've wanted it to. But for some odd reason it will now refuse to work in the area set.
Code is here-

Code: Select all

F2::
Coordmode, Mouse, Screen

Random, a, 450,340
Random, b, 460,350
send {Click, right, %a%, %b%}
When I try and run the script it will just wildly click in an area that I haven't set anywhere and I just don't get it. :headwall:
User avatar
Spawnova
Posts: 554
Joined: 08 Jul 2015, 00:12
Contact:

Re: Click in random x, y not working  Topic is solved

21 Jan 2018, 12:42

random takes these parameters random,output,min,max

you mixed your max and min

here's a sample script that should work for you

Code: Select all

F2::
Coordmode, Mouse, Screen
x := random(340,450)
y := random(350,460)
click,right,%x%,%y%
return


Random(min,max=100) { ;a wrapper for random, makes it easier to use
	random,result,min,max
	return result
}

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 85 guests