Jump to content

Click a color until it's gone


Recommended Posts

Edited/simplified the code. Hopefully you learn from it and don't just blindly copy/paste.

Ok so if i understand right, I use isArray(function)

If im looking to see if there's an error when im passed a line right after the function?

So

$coord75 = PixelSearch( 25, 150, 766, 534, 0x13D926, 0 , 1, "[TITLE:windowlawl]"  )
if not @error then
    MouseClick("left", $coord75[0] + 15, $coord75[1] + 5, 1 , 0)
msgbox(32, "hi" , "hi")
endif

and

$coord75 = PixelSearch( 25, 150, 766, 534, 0x13D926, 0 , 1, "[TITLE:windowlawl]"  )
    MouseClick("left", $coord75[0] + 15, $coord75[1] + 5, 1 , 0)
if not isArray($coord75) then
msgbox(32, "hi" , "hi")
endif

Correct?

Edited by Dgameman1
Link to comment
Share on other sites

No. Your second example is wrong. Because you are using an array subscript $coord75[0] and $coord75[1] in the MouseClick() call, BEFORE you check. So if PixelSearch() does not return an array, you're screwed, and will get the "Variable subscript array blah blah" error.

Data integrity checks come BEFORE you use the data.

.

Link to comment
Share on other sites

Why am I having such a difficult time understanding this =[

Would this be correct?

$coord75 = PixelSearch( 25, 150, 766, 534, 0x13D926, 0 , 1, "[TITLE:windowlawl]"  )
if not isArray($coord75) then
    MouseClick("left", $coord75[0] + 15, $coord75[1] + 5, 1 , 0)
msgbox(32, "hi" , "hi")
endif

Because it's now checking before it calls mouseclick?

Edited by Dgameman1
Link to comment
Share on other sites

Whenever you are writing code, always look at the helpfile and read about what you are writing, even the loops and other keywords.

The reason your Do Until loop failed is because it performs the operations in it and then checks the condition, the while wend loop performs the operations in it only if the condition is met.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...