Jump to content

PixelSearch and IsArray help


Recommended Posts

Alright, I got a blue button I want to click on when it's available, so far the script works. When the blue button is clicked, the button will turn gray instantly.

The code then wanna check if the blue button now turned the gray color, if it did, then it will click on a green button. If it doesn't, it will jump to a skip function.

Where it fails, is when it's gonna check for the gray color. The gray color is there, but it jumps to the skip function anyway.

Where in the script is the wrong? I have red it a couple of times myself and added notes on the side of them.

Func Go()
   $Blue = PixelSearch(822, 550, 860, 565, 0x3B5998) ; Setup for the blue
   $Gray = PixelSearch(822, 550, 860, 565, 0xEEEEEE) ; Setup for the gray
   $Green = PixelSearch(741, 609, 812, 650, 0x009D0B) ; Setup for the green
  
   If IsArray($Blue) Then ; If it is blue
   Mouseclick("left",$Blue[0], $Blue[1]) ; then it will click on the blue
   Sleep(500)
   Else ; If it's not blue..
   Sleep(100)
   Wait() ; ..it will jump to wait function
   EndIf
   If IsArray($Gray) Then ; If the blue is now gray..
   Mouseclick("left",$Green[0], $Green[1]) ; ..then click on the green
   Else ; If it is not gray
   Skip() ; .. it jumps to skip function
   EndIf
   Wait() ; jumps to wait function
EndFunc
Edited by Lucidity
Link to comment
Share on other sites

Just one thing, this seems a lot like game automation. I would be happy to help, if you could tell/show me what this script will be used for.

Edited by subzerostig

There are 10 types of people in this world. Those that understand binary, and those that do not

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...