Jump to content
Sign in to follow this  

Error wirh pixel search

Recommended Posts


Im trying to make this:

HotKeySet("{NUMPAD7}", "vida")
HotKeySet("{NUMPAD2}","lTGetCoord") ;left top x, y
HotKeySet("{NUMPAD3}","rBGetCoord") ; right bottom x, y

While 1

func vida()
$location = PixelSearch ( $posLT[0], $posLT[1], $posBR[0], $posBR[1], 0x000000)
If IsArray ($location) = 1 Then 
    MouseClick ('left', $location[0], $location[1], 1, 0) 
    MouseClick ('left', $location[0], $location[1], 1, 0) 

Func rBGetCoord()
    $posRB = MouseGetPos()

Func lTGetCoord()
    $posLT = MouseGetPos()

Then, i run the app, i push numpad2 and numpad 3 BUT when i push numpad 7 to run the func vida (with the pixelsearch) i have this error:

$location = PixelSearch ( $posLT[0], $posLT[1], $posRB[0], $posRB[1], 0x000000)
$location = PixelSearch ( ^ ERROR

and the program ends

I dont understand, without vars in pixelsearch it works, but i need that the user can change the area.

Edited by lysander

Share this post

Link to post
Share on other sites

your $posLT and $posBR are Local so when the function ends, the variables are cleared. Declare them as Global at the top of the script.



My Android cat and mouse game

We're gonna need another Timmy!

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...