Clicking a random pixel based on color? Topic is solved

Ask gaming related questions
Posts: 1
Joined: 02 Sep 2020, 08:53

Clicking a random pixel based on color?

Post by Budge » 02 Sep 2020, 08:58

Hi, I've just started trying to make a script which utilizes the function of PixelSearch. I am able to get it to run sort of the way I want, but I would like to be able to make it so that if the specified shade or shade within the range, is found in my coordinates, that it moves the mouse to a random location within those coordinates. Currently, it finds the one pixel that most matches the shade, and always picks that coordinate every time. Does anyone have any ideas on how to fix this? TIA.
Last edited by BoBo on 02 Sep 2020, 10:32, edited 1 time in total.
Reason: Moved to Gaming section.

User avatar
Posts: 1919
Joined: 02 Oct 2015, 12:15

Re: Clicking a random pixel based on color?  Topic is solved

Post by Xtra » 02 Sep 2020, 11:37


Code: Select all

CoordMode, Pixel, Screen
CoordMode, Mouse, Screen

PixelSearch, Px, Py, 200, 200, 300, 300, 0x9d6346, 3, Fast
if (ErrorLevel = 0)

AreaRandomClick(X1,Y1,X2,Y2) {
    Random, x, X1, X2
    Random, y, Y1, Y2
    MouseClick, Left, x, y

Post Reply

Return to “Gaming”