lysander 0 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 Share this post Link to post Share on other sites
kaotkbliss 146 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. 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites