Merchants Posted March 3, 2010 Posted March 3, 2010 (edited) Func does not detect the number some how if i let it do his work then that works fine until i get to the 465 then it trying to find the 465 but does not detect it.. so now it does Mousemove to 465 and 466 you can see that in the testfile back: 465 466 465 466 465 466 465 466 465 expandcollapse popup;<script Name> Opt("MouseCoordMode", 2) Opt("PixelCoordMode", 2) Global $run HotKeySet("{F9}", "Start") HotKeySet("{F10}", "Terminate") HotKeySet("{End}", "Stop") Func Terminate() Exit 0 EndFunc Func Stop() $run = 0 EndFunc While 1 WEnd Func Start() $run = NOT $run While $run Sleep(200) $i = True $pos = MouseGetPos() $coord = PixelSearch(0,0,800,600, 0xFF0000, 1) If @error Then $i = False EndIf If $i = True Then FileWrite("test.txt", $coord[0] & @CRLF) If $coord[0] = 465 Then If $coord[1] = 340 Then $run = 0 Else If $coord[1] > 340 Then MouseMove($pos[0] -1,$pos[1],0) Else MouseMove($pos[0] +1,$pos[1],0) EndIf EndIf Else If $coord[0] > 465 Then MouseMove($pos[0] -1,$pos[1],0) Else MouseMove($pos[0] +1,$pos[1],0) EndIf EndIf EndIf Sleep(10) WEnd EndFunc Edited March 3, 2010 by Merchants
dani Posted March 4, 2010 Posted March 4, 2010 (edited) What does your script do? If I run it doesn't output 465 466 465 466 465 466 465 466 465 466 It outputs some random other numbers. We need some more info I did improve your code a little bit, especially at your '$i = True ... If @error Then $i = False ... If $i = True'-part which just hurt my eyes so bad I had to fix it Anyway, functionality is the same, so please explain in more detail what you want. expandcollapse popup;<script Name> Opt("MouseCoordMode", 2) Opt("PixelCoordMode", 2) Global $run HotKeySet("{F9}", "Start") HotKeySet("{F10}", "Terminate") HotKeySet("{End}", "Stop") Func Terminate() FileClose("test.txt") Exit EndFunc Func Stop() $run = 0 EndFunc While True Sleep(100) ; Wait for input WEnd Func Start() $run = 1 While $run Sleep(200) $pos = MouseGetPos() $coord = PixelSearch(0,0,800,600, 0xFF0000, 1) If Not @error Then FileWrite("test.txt", $coord[0] & @CRLF) If $coord[0] = 465 Then If $coord[1] = 340 Then $run = 0 Else If $coord[1] > 340 Then MouseMove($pos[0] -1,$pos[1],0) Else MouseMove($pos[0] +1,$pos[1],0) EndIf EndIf Else If $coord[0] > 465 Then MouseMove($pos[0] -1,$pos[1],0) Else MouseMove($pos[0] +1,$pos[1],0) EndIf EndIf EndIf WEnd EndFunc Edited March 4, 2010 by dani
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