Jump to content

Recommended Posts

Posted

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 :)

Posted (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 by Helge
Posted

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 :)

Posted

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

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
×
×
  • Create New...