# Help with If... Then

## Recommended Posts

The problem I am having is with this block of text:

If (\$z[0], \$z[1]) = (\$x,\$y) Then

\$x = Random(846, 953)

\$y = Random(603, 652)

Endif

It keeps giving me an error that I don't have a right bracket after (\$z[0], \$z[1]

Does anyoneknow how to solve this?

```; Dark Orbit bonus Box Bot BY Johnathan K.
HotKeySet("x", "MyExit")
WinMove( "www.DarkOrbit.com - Windows Internet Explorer", "", 0, -20, 1152, 884)
Sleep(5000)
\$i = 0
\$x = Random(846, 953)
\$y = Random(603, 652)

Do
MouseClick("left", \$x, \$y, 1, 1)
\$z = PixelSearch(840, 593, 963, 662, 0x37AA00, 40)
If @error Then
Send( "x")
EndIf
If (\$z[0], \$z[1]) = (\$x,\$y) Then
\$x = Random(846, 953)
\$y = Random(603, 652)
Endif
\$coord2 = PixelSearch(0, 110, 1860, 800, 0xFFC07A, 8)
If Not @error Then
MouseClick("left",\$coord2[0], \$coord2[1], 1, 1)
Sleep(5000)
\$coord2 = PixelSearch(0, 110, 1860, 800, 0xFFC07A, 8)
If not @error then
MouseClick("left",\$coord2[0], \$coord2[1], 1, 1)
Sleep(3000)
EndIf
EndIf
Until \$i >= 10

Func MyExit()
Exit
EndFunc```

##### Share on other sites

I presume you want:

```If (\$z[0] = \$x) And (\$z[1] = \$y) Then
\$x = Random(846, 953)
\$y = Random(603, 652)
Endif```

It didn't like the way you used the comma.

Mat

## Create an account

Register a new account