lysander Posted June 30, 2011 Posted June 30, 2011 (edited) Hi Im trying to make this: HotKeySet("{NUMPAD7}", "vida") HotKeySet("{NUMPAD2}","lTGetCoord") ;left top x, y HotKeySet("{NUMPAD3}","rBGetCoord") ; right bottom x, y While 1 Sleep(100) WEnd 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) sleep(100) MouseClick ('left', $location[0], $location[1], 1, 0) EndIf EndFunc Func rBGetCoord() $posRB = MouseGetPos() EndFunc Func lTGetCoord() $posLT = MouseGetPos() EndFunc 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 June 30, 2011 by lysander
kaotkbliss Posted June 30, 2011 Posted June 30, 2011 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. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
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