Jump to content

Pixelcheckcolor for a group of pixels


Recommended Posts

Hello,

I want to make a function that loops untill one pixel in a group of pixels meets a certain condition (being red).

I have this for now and it works but I want to make the code more compact:

While 1
If pixelgetcolor(258,200) =0xFF0000 then ExitLoop
If pixelgetcolor(258,201) =0xFF0000 then ExitLoop
If pixelgetcolor(258,202) =0xFF0000 then ExitLoop
If pixelgetcolor(258,203) =0xFF0000 then ExitLoop
If pixelgetcolor(258,204) =0xFF0000 then ExitLoop
If pixelgetcolor(259,200) =0xFF0000 then ExitLoop
If pixelgetcolor(259,201) =0xFF0000 then ExitLoop
If pixelgetcolor(259,202) =0xFF0000 then ExitLoop
If pixelgetcolor(259,203) =0xFF0000 then ExitLoop
If pixelgetcolor(259,204) =0xFF0000 then ExitLoop
If pixelgetcolor(260,200) =0xFF0000 then ExitLoop
If pixelgetcolor(260,201) =0xFF0000 then ExitLoop
If pixelgetcolor(260,202) =0xFF0000 then ExitLoop
If pixelgetcolor(260,203) =0xFF0000 then ExitLoop
If pixelgetcolor(260,204) =0xFF0000 then ExitLoop
If pixelgetcolor(261,200) =0xFF0000 then ExitLoop
If pixelgetcolor(261,201) =0xFF0000 then ExitLoop
If pixelgetcolor(261,202) =0xFF0000 then ExitLoop
If pixelgetcolor(261,203) =0xFF0000 then ExitLoop
If pixelgetcolor(261,204) =0xFF0000 then ExitLoop
If pixelgetcolor(262,200) =0xFF0000 then ExitLoop
If pixelgetcolor(262,201) =0xFF0000 then ExitLoop
If pixelgetcolor(262,202) =0xFF0000 then ExitLoop
If pixelgetcolor(262,203) =0xFF0000 then ExitLoop
If pixelgetcolor(262,204) =0xFF0000 then ExitLoop
Wend

 

 

I changed it too this, but it don't understand why it doesn't work.

Local $y=-1
Local $i=-1
Local $t=0

Do

Do

$y + 1

   Do

   $i + 1
   sleep(10)
   If pixelgetcolor(259+$i,200+$y) = 0xFF0000 Then $t+=1

   Until $t=1 or $i=4

Until $t=1 or $y=4

Until $t=1

 

Thanks in advance

 

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