# loops

## Recommended Posts

i need to create a loop, i need the loop to keep going untill a pixel color is x or y.

so how do i say

do

bla bla

until \$var = x or \$var = y

i guess its the OR i am looking for.

##### Share on other sites

```\$PixelSearch = PixelSearch( 0, 0, 20, 300, 0xFF0000 )
Do
Sleep(10)
PixelSearch( 0, 0, 20, 300, 0xFF0000 )
Until IsArray(\$PixelSearch)```

This will loop until the pixelsearch returns it's coordinates.

Kurt

Awaiting Diablo III..

##### Share on other sites

What exactly is x and y, you're referring to?

Are you wanting to run a script until the pixelcolor at a certain coordinate is returned to a certain color?

If it's at a coordinate...

```While 1
\$var = PixelGetColor( x,y ) ;Where x and y are the coordinates
If \$var[0]=\$xcol Then ;Where \$xcol is the desired pixel color in decimal value
ExitLoop
ElseIf \$var[1]=\$ycol Then ;Where \$ycol is the desired pixel color in decimal value
ExitLoop
EndIf
Wend```

A little more basic and easier to understand, if it's what you need.

##### Share on other sites

let me rephrase my question...

this is what i have...

Do

\$var = 0

\$var = PixelGetColor( 975, 892) ; get the color to see if its a turbo or a 6 man

sleep (100)

until \$var = 16777215 or \$var = 16777213

the second \$var is a made up number, but can i some how throw an OR in there like i did?

##### Share on other sites

thats great, never used exit loop before...thank you, its perfect!

Max

Edited by Max in montreal

##### Share on other sites

let me rephrase my question...

this is what i have...

Do

\$var = 0

\$var = PixelGetColor( 975, 892) ; get the color to see if its a turbo or a 6 man

sleep (100)

until \$var = 16777215 or \$var = 16777213

the second \$var is a made up number, but can i some how throw an OR in there like i did?

I just had to ask... what was wrong with this code that you couldn't use it?

##### Share on other sites

\$var = 0

Do

\$var = 0

\$var = PixelGetColor( 975, 892) ; get the color to see if its a turbo or a 6 man

sleep (100)

if \$var = 21648 Then

ExitLoop

until \$var = 16777215

MouseClick("left", 975, 892, 2)

so i changed it to the above, im getting an error

this is the way i did it, thanks all!

Edited by Max in montreal

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...