Sign in to follow this  
Followers 0
Lucidity

PixelSearch and IsArray help

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

It's for a site and not a game.

Though I fixed it by putting the $Gray = PixelSearch one before the if $Gray code

Share this post


Link to post
Share on other sites

If it is a site, have you tried to see if you could use the IE controls so you could click on the control directly?

I don't understand. What's IE controls? internet explorer? :s

Share this post


Link to post
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
Sign in to follow this  
Followers 0