doccy Posted August 27, 2007 Posted August 27, 2007 Hello guys, sorry if i bother you but i'm a total newbie in autoit scripting and i can't get rid off this error My script try to find a color and if it find it to press the right mouse button on it. Here it goes HotKeySet("{HOME}","Clicker") While 1 Sleep(1000) WEnd Func Clicker() While 1 Opt("MouseClickDownDelay", 50) Send("{SPACE}") sleep(300) $pos = PixelSearch (752,345,1001,589,0x3E0C3F) sleep(2000) If @error <> 1 then MouseClick( "right" ,$pos[0], $pos[1]) EndIf WEnd EndFunc I've tried everything if @error = 2 if not @error if @error = 0, but nothing helped Please help me
qazwsx Posted August 27, 2007 Posted August 27, 2007 try: if _isarry ($pos) Then and use code tags next time it makes it easier to read.
Helge Posted August 27, 2007 Posted August 27, 2007 (edited) Sleep sets @error to 0. You can at least solve this in three ways. Storing @error in a variable :$pos = PixelSearch (752,345,1001,589,0x3E0C3F) $error = @error Sleep(2000) If $error <> 1 then ;If Ubound($pos) > 0 Then ;If IsArray($pos) Then Edited August 27, 2007 by Helge
doccy Posted August 27, 2007 Author Posted August 27, 2007 i have tried it but it gives me an error like if _isarray($pos) then ... Error:Unknown function name. Btw i used it instead of If @error <> 1 then, i hope i did it right
doccy Posted August 27, 2007 Author Posted August 27, 2007 Sleep sets @error to 0. You can at least solve this in three ways. Storing @error in a variable :$pos = PixelSearch (752,345,1001,589,0x3E0C3F) $error = @error Sleep(2000) If $error <> 1 then ;If Ubound($pos) > 0 Then ;If IsArray($pos) Then i didn't know sleep set @error to 0... thanks i solved it !!
weaponx Posted August 27, 2007 Posted August 27, 2007 You shouldn't have been doing a sleep after PixelSearch anyways, it did nothing.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now