Jump to content
Sign in to follow this  
PanClon

Pixel Search Looping

Recommended Posts

PanClon

Hello...I´m new here...I learning AutoIT for 3 weeks..creating game bot...but still need some help..=)

So my idea is...

I need check one specific pixel in dec (16776960) on coordinates x=635 y=310...every 10 second....if the pixel will not (False) be found then keep searching every 10s...if will be found (true) then stop searching and do some stuff...

It sounds easy...but I still can´t figure it out..pls help me =)

Regards

Share this post


Link to post
Share on other sites
Achilles

$found = False 

While Not $found 
Sleep(10000)
$pass = PixelSearch(635, 310, 635, 310, 16776960)

If IsArray($pass) then;The color is there!
$found = True 
EndIf 
WEnd

EDIT: I didn't test this... You might need to change a few things...

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
PanClon

well that´s not exactly what I looking for...but thx anyway...

I need something simple....it´s not necessary to use True and False....my opinion for the CODE is:

PixelSearch(635, 310, 635, 310, 16776960)

$color = 16776960

If $color = 16776960 Then

Sleep(10000)

MouseClick("Left", 500, 500,1)

If NOT $color = 16776960 Then

Do

PixelSearch(635, 310, 635, 310, 16776960)

Until $color = 16776960

EndIf

well any ideas....?

PS: Dunno maybe the If...ElseIf...Else... maybe help...

Share this post


Link to post
Share on other sites
Bowmore

well that´s not exactly what I looking for...but thx anyway...

I need something simple....it´s not necessary to use True and False....my opinion for the CODE is:

PixelSearch(635, 310, 635, 310, 16776960)

$color = 16776960

If $color = 16776960 Then

Sleep(10000)

MouseClick("Left", 500, 500,1)

If NOT $color = 16776960 Then

Do

PixelSearch(635, 310, 635, 310, 16776960)

Until $color = 16776960

EndIf

well any ideas....?

PS: Dunno maybe the If...ElseIf...Else... maybe help...

Piano_Man's script will give you what you asked for but if it's not to your liking here is a slightly different method.

$iColour = PixelGetColor(635, 310) ;Get the colour of the specified pixel
While $iColour <> 16776960 
    Sleep(10000) ; Wait 10 seconds before checking again    
    $iColour = PixelGetColor(635, 310)
Wend
; do your stuff

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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.