Jump to content
Sign in to follow this  
SwordHunter4Ever

Expanding PixelGetColor?

Recommended Posts

SwordHunter4Ever

Hey guys, I'm trying to write a script that does something based on if it finds anything besides a certain color in a region. Here is what I have so far.

Do
        $LagOut3 = $LagOut3 + 1
        If $LagOut3 < 125 Then
        $PixelItem = PixelSearch($pos[0] + 52, $pos[1] + 62, $pos[0] + 64, $pos[1] + 66, 0xCED6E7)
            IF $PixelItem <> 0xCED6E7 Then
                MouseClickDrag("left", $pos[0] + 57, $pos[1] + 62, $pos[0] + 145, $pos[1] + 338, 5)
                Sleep($mid)
                Send("{ENTER}")
                Sleep($mid)
            Else
                Sleep(100)
            ENDIF
        Else
            MouseClick("left", $pos[0] + 630, $pos[1] + 10)
            ShellExecute(@ScriptFullPath)
            Exit
        ENDIF
    Until $PixelItem = 0xCED6E7

That however won't work because it just keeps going until the $LagOut3 is equal to 125 (or its gone through and loop 25 times). I need something that will work, so I know PixelGetColor will work if I use the same code except on one specific pixel. The problem is it can't be on a range of pixels and I don't want to have to write the code over and over for like 100 different pixels or something.

Example of how it does work,

Do
        $LagOut3 = $LagOut3 + 1
        If $LagOut3 < 125 Then
        $PixelItem = PixelGetColor($pos[0] + 52, $pos[1] + 62)
            IF $PixelItem <> 0xCED6E7 Then
                MouseClickDrag("left", $pos[0] + 57, $pos[1] + 62, $pos[0] + 145, $pos[1] + 338, 5)
                Sleep($mid)
                Send("{ENTER}")
                Sleep($mid)
            Else
                Sleep(100)
            ENDIF
        Else
            MouseClick("left", $pos[0] + 630, $pos[1] + 10)
            ShellExecute(@ScriptFullPath)
            Exit
        ENDIF
    Until $PixelItem = 0xCED6E7

How I would like it to work (or something that simulates this, since this can't actually be done as far as I know),

Do
        $LagOut3 = $LagOut3 + 1
        If $LagOut3 < 125 Then
        $PixelItem = PixelGetColor($pos[0] + 52, $pos[1] + 62, $pos[0] + 64, $pos[1] + 66)
            IF $PixelItem <> 0xCED6E7 Then
                MouseClickDrag("left", $pos[0] + 57, $pos[1] + 62, $pos[0] + 145, $pos[1] + 338, 5)
                Sleep($mid)
                Send("{ENTER}")
                Sleep($mid)
            Else
                Sleep(100)
            ENDIF
        Else
            MouseClick("left", $pos[0] + 630, $pos[1] + 10)
            ShellExecute(@ScriptFullPath)
            Exit
        ENDIF
    Until $PixelItem = 0xCED6E7

EDIT: Fixed typos.

Edited by SwordHunter4Ever

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.