Jump to content
Sign in to follow this  
edwarddd

Help with Pixel search.. i believe?

Recommended Posts

edwarddd

Ok... So i'm making a bot for a game..

WinMove("http://ogreisland.com - OI client - Mozilla Firefox", "", 0, 0)
WinWaitActive("http://ogreisland.com - OI client - Mozilla Firefox", "")
Sleep(100)

    While 1
        $coord = PixelSearch(0, 0, 806, 656, 0x7691AE, 5, 0)
        MouseClick("", $coord[0], $coord[1], 1, 0)
        Sleep(6000)
    WEnd

That's the code.

It apparently just looks for the rock of the color 0x7691AE and clicks it every 6 seconds.

Thats all good.. But when there's no more rocks left to click.. or.. "0x7691AE" isn't found

on the screen, the program just closes. Can't i make it so that it just sleeps if "0x7691AE"

isn't found, until it is found?

Share this post


Link to post
Share on other sites
narayanjr

While 1
        $coord = PixelSearch(0, 0, 806, 656, 0x7691AE, 5, 0)
        If Not @error Then
              MouseClick("", $coord[0], $coord[1], 1, 0)
              Sleep(6000)
        EndIf
    WEnd

that might do it not really sure

Share this post


Link to post
Share on other sites
edwarddd

Yeah.. it works.. Thanks. now.. is there a way to make it so that.. the

Win move and Win wait active don't have to be so specific?

Like.. It can just move the window "oi client" and wait for the "oi client" window to be active.. instead of

http://ogreisland.com - OI client - Mozilla Firefox?

Edited by edwarddd

Share this post


Link to post
Share on other sites
edwarddd

bump

Share this post


Link to post
Share on other sites
narayanjr

"http://ogreisland.com - OI client - Mozilla Firefox"

you should not need all of that i dont think you should be able to get away with just having the first 2-3 words in the title of the window

Share this post


Link to post
Share on other sites
Generator

From the help file:

WinTitleMatchMode - Alters the method that is used to match window titles during search operations.

1 = Match the title from the start (default)

2 = Match any substring in the title

3 = Exact title match

4 = Advanced mode, see Window Titles & Text (Advanced)

-1 to -4 = force lower case match according to other type of match.

Code:

Opt("WinTitleMatchMode",2)

You can just put M as the title and it will work.

Share this post


Link to post
Share on other sites
edwarddd

From the help file:

Code:

Opt("WinTitleMatchMode",2)

You can just put M as the title and it will work.

Thanks, worked.

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  

×