Jump to content

Prob with arrays


Cerb
 Share

Recommended Posts

When I try those functions, I get an error

Heres an example

$u = PixelSearch($xstart,$ystart,$xend,$yend,$color)
While @error = 1
$u = PixelSearch($xstart,$ystart,$xend,$yend,$color)
Sleep(500)
WEnd

MouseMove($u[0],$u[1],0)
Sleep(250)
MouseClick("left")
Sleep(2500)

ERROR

Line 0:

MouseMove($u[0],$u[1],0)

MouseMove($u^ERROR

Error: Subscript used with non-Array variable.

Why?

Link to comment
Share on other sites

Ah, I think the SLEEP statement is the problem.

You are smart to check for @error in the loop; however, the sleep statement always sets the @error variable to zero. Consequently, your loop only runs once.

$u = PixelSearch($xstart,$ystart,$xend,$yend,$color)
Let errorFlag = @error

While errorFlag == 1
  $u = PixelSearch($xstart,$ystart,$xend,$yend,$color)
  errorFlag = @error
  Sleep(500)
WEnd

Suggested fix; Hope that helps

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...