# and/or

## Recommended Posts

have 2 questions

1. how do i combine these two into one..

While 1

\$var = PixelSearch ( 642, 102, 646, 107, 0x181818 )

If not \$var = 1 Then

Send("{o}")

EndIf

Sleep(250)

WEnd

and

While 1

\$var = PixelSearch ( 642, 102, 646, 107, 0xAF8840 )

If not \$var = 1 Then

Send("{o}")

EndIf

Sleep(250)

WEnd

2. How do i combine 2 independent codes into one file

##### Share on other sites

I believe this would do it..

```While 1
\$var1 = PixelSearch ( 642, 102, 646, 107, 0x181818 )
\$var2 = PixelSearch ( 642, 102, 646, 107, 0xAF8840 )
If NOT \$var1 OR \$var2 Then
Send("{o}")
EndIf
Sleep(250)
WEnd```
Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

##### Share on other sites

I believe this would do it..

```While 1
\$var1 = PixelSearch ( 642, 102, 646, 107, 0x181818 )
\$var2 = PixelSearch ( 642, 102, 646, 107, 0xAF8840 )
If NOT \$var1 OR \$var2 Then
Send("{o}")
EndIf
Sleep(250)
WEnd```

The boolean logic in your example is not quite correct. It should be

```While 1
\$var1 = PixelSearch ( 642, 102, 646, 107, 0x181818 )
\$var2 = PixelSearch ( 642, 102, 646, 107, 0xAF8840 )
If NOT (\$var1 OR \$var2) Then
Send("{o}")
EndIf
Sleep(250)
WEnd```

Or

```While 1
\$var1 = PixelSearch ( 642, 102, 646, 107, 0x181818 )
\$var2 = PixelSearch ( 642, 102, 646, 107, 0xAF8840 )
If NOT \$var1 OR NOT \$var2 Then
Send("{o}")
EndIf
Sleep(250)
WEnd```

"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 on other sites

Maybeh

```While 1
Do
Sleep(250)
\$var1 = PixelSearch(642, 102, 646, 107, 0x181818)
\$var2 = PixelSearch(642, 102, 646, 107, 0xAF8840)
Until @error = 1
Send("{o}")
WEnd```

## Create an account

Register a new account