Jump to content

GetPixelColor


notsure
 Share

Recommended Posts

Hi, I'm trying to get a pixelcolor and make an image stop when an exact pixel hits the color.

Like this:

Do
    $pxcolor = PixelGetColor(665, 153)
    $pxcolor1 = pixelgetcolor (665,156)
Until $pxcolor AND $pxcolor1 <> 0x000000
    MouseClick("left",584,188,1,0)

As you can see i'm trying to get 2 pixels because a fast moving bar is around 4 pixels in height and the mouseclick must be EXACT when the pixels 153, 154, 155 and 156 are another color than black. Unfortunately this doesn't work. It sometimes has delays. It does trigger the mouseclick but sometimes right in time and sometimes the bar is "further" than those 4 pixels. Like 155, 156, 157 and 158.

Is this because the do/while loop is too slow? Or perhaps cause other processes are slowing it down?

Any input will be appreciated :)

Edited by notsure
Link to comment
Share on other sites

Compile your script and try running it in highest priority, then run the target aplication in Idle priority to test :)

Same problem. Sometimes it seems it doesnt even wait for the 2nd pixel to change ($pxcolor1) :/ is this the correct syntax/code im using to accomplish this?

Link to comment
Share on other sites

Whats this for? it ties in with elements of my ffr bot :)

CODE
$Start = TimerInit()

While 1

If TimerDiff($Start) > 1 Then

$pxcolor = PixelGetColor(665, 153)

$pxcolor1 = pixelgetcolor (665,156)

If $pxcolor AND $pxcolor1 <> 0x000000 then

MouseClick("left",584,188,1,0)

EndIf

$Start = TimerInit()

EndIf

Wend

Try that, should work perfectly. Although it will still loop after the bar is gone, but I can't not do that without the rest of your script, lol.

Edited by Metigue
Link to comment
Share on other sites

Whats this for? it ties in with elements of my ffr bot :)

CODE
$Start = TimerInit()

While 1

If TimerDiff($Start) > 1 Then

$pxcolor = PixelGetColor(665, 153)

$pxcolor1 = pixelgetcolor (665,156)

If $pxcolor AND $pxcolor1 <> 0x000000 then

MouseClick("left",584,188,1,0)

EndIf

$Start = TimerInit()

EndIf

Wend

Try that, should work perfectly. Although it will still loop after the bar is gone, but I can't not do that without the rest of your script, lol.

k, now im kinda noob with timers and this script language. i need 2 bars to equal the color. So now i got this;

While 1

$msg = GUIGetMsg()

    Select
        
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $btn3x20


            $Start = TimerInit()
            

            If TimerDiff($Start) > 1 Then
                $pxcolor = PixelGetColor(579,110)
                $pxcolor1 = pixelgetcolor (581,110)

                If $pxcolor <> 0x08BE00 AND $pxcolor1 <> 0x000000 then
                    MouseClick("left",584,188,1,0)
                    ExitLoop
                EndIf
                $Start = TimerInit()
            EndIf

            

            If TimerDiff($Start) > 1 Then
                $pxcolor = PixelGetColor(665, 153)
                $pxcolor1 = pixelgetcolor (665,156)

                If $pxcolor <> 0x08BE00  AND $pxcolor1 <> 0x000000 then
                    MouseClick("left",584,188,1,0)
                    ExitLoop
                EndIf
                $Start = TimerInit()
            EndIf

Doesn't work properly but i think i misplaced the timer for 2 coords to check. Can you help me out plz.

Link to comment
Share on other sites

k, now im kinda noob with timers and this script language. i need 2 bars to equal the color. So now i got this;

While 1

$msg = GUIGetMsg()

    Select
        
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $btn3x20


            $Start = TimerInit()
            

            If TimerDiff($Start) > 1 Then
                $pxcolor = PixelGetColor(579,110)
                $pxcolor1 = pixelgetcolor (581,110)

                If $pxcolor <> 0x08BE00 AND $pxcolor1 <> 0x000000 then
                    MouseClick("left",584,188,1,0)
                    ExitLoop
                EndIf
                $Start = TimerInit()
            EndIf

            

            If TimerDiff($Start) > 1 Then
                $pxcolor = PixelGetColor(665, 153)
                $pxcolor1 = pixelgetcolor (665,156)

                If $pxcolor <> 0x08BE00  AND $pxcolor1 <> 0x000000 then
                    MouseClick("left",584,188,1,0)
                    ExitLoop
                EndIf
                $Start = TimerInit()
            EndIf

Doesn't work properly but i think i misplaced the timer for 2 coords to check. Can you help me out plz.

your trying to run 2 events on the same loop $Start is a variable, make it $start2 if they are both different events, lol.

And <> means if its not that colour

Edited by Metigue
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...