Inquisitor Posted November 7, 2008 Share Posted November 7, 2008 WinActivate( "Some Game") WinWaitActive( "Some Game") Sleep(1000) $coord = PixelSearch( 129, 261, 858, 490, 0x00ff00, 3 ) if IsArray ($coord) then MouseClick('Left', $coord[0] & "," & $coord[1] endif A few questions about my script. #1 How is it possible to change the MouseClick coordinates not exactly to $coord but 10-15 pixels higher then $coord #2 How is it possible to link a while/wend script right after the - MouseClick('Left', $coord[0] & "," & $coord[1] part (I know how to add it, I dont know how to activate it) Link to comment Share on other sites More sharing options...
Zedna Posted November 7, 2008 Share Posted November 7, 2008 (edited) Maybe MouseClick('Left', $coord[0], $coord[1] - 15) Edited November 7, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Valuater Posted November 7, 2008 Share Posted November 7, 2008 ... and Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0) ;1=absolute, 0=relative, 2=client see help 8) Link to comment Share on other sites More sharing options...
Inquisitor Posted November 8, 2008 Author Share Posted November 8, 2008 Maybe MouseClick('Left', $coord[0], $coord[1] - 15) Thanks ... and Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0) ;1=absolute, 0=relative, 2=client see help 8) Thanks, but what are those two commands for? The pixelsearching works without those ;D P.S. Does anybody know how to link a script that would activate only after the pixelsearch script ends? And then when that script ends its suposed to loop again. Link to comment Share on other sites More sharing options...
Inquisitor Posted November 8, 2008 Author Share Posted November 8, 2008 (edited) Opt("MouseCoordMode", 0);1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0);1=absolute, 0=relative, 2=client WinActivate( "Some game") WinWaitActive( "Some game") Sleep(1000) $coord = PixelSearch( 129, 261, 858, 490, 0xede0c5, 1 ) if IsArray ($coord) then MouseClick('Left', $coord[0], $coord[1] - 1) endif mouseclick("left", 289, 230) While 0=0 mouseclick("Left", 367, 434) sleep(5000) mouseclick("Left", 367, 434) sleep(5000) mouseclick("Left", 367, 434) sleep(5000) mouseclick("Left", 367, 434) sleep(5000) mouseclick("Left", 367, 434) sleep(5000) mouseclick("Left", 367, 434) sleep(5000) wend Ok everything works perfectly fine, the only problem is the script doesnt loop. Please tell me how to make it loop >< Edited November 8, 2008 by Inquisitor Link to comment Share on other sites More sharing options...
Valuater Posted November 8, 2008 Share Posted November 8, 2008 expandcollapse popupOpt("MouseCoordMode", 0);1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0);1=absolute, 0=relative, 2=client Dim $Runner WinActivate("Some game") WinWaitActive("Some game") Sleep(1000) HotKeySet("{ESC}", "Terminate") HotKeySet("{F9}", "ShowMe") While 1 Sleep(20) If $Runner Then Do_it() WEnd ; ---- Functions ------ Func ShowMe() $Runner = Not $Runner EndFunc ;==>ShowMe Func Terminate() Exit 0 EndFunc ;==>Terminate Func Do_it() $coord = PixelSearch(129, 261, 858, 490, 0xede0c5, 1) If Not IsArray($coord) Then Return MouseClick('Left', $coord[0], $coord[1] - 1) MouseClick("left", 289, 230) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) EndFunc ;==>Do_it 8) Link to comment Share on other sites More sharing options...
Inquisitor Posted November 8, 2008 Author Share Posted November 8, 2008 (edited) expandcollapse popupOpt("MouseCoordMode", 0);1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0);1=absolute, 0=relative, 2=client Dim $Runner WinActivate("Some game") WinWaitActive("Some game") Sleep(1000) HotKeySet("{ESC}", "Terminate") HotKeySet("{F9}", "ShowMe") While 1 Sleep(20) If $Runner Then Do_it() WEnd ; ---- Functions ------ Func ShowMe() $Runner = Not $Runner EndFunc ;==>ShowMe Func Terminate() Exit 0 EndFunc ;==>Terminate Func Do_it() $coord = PixelSearch(129, 261, 858, 490, 0xede0c5, 1) If Not IsArray($coord) Then Return MouseClick('Left', $coord[0], $coord[1] - 1) MouseClick("left", 289, 230) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) EndFunc ;==>Do_it 8) Thanks allot for the help, althought I think I made a simpler working script Opt("MouseCoordMode", 0);1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0);1=absolute, 0=relative, 2=client WinActivate( "A game, ok ?") WinWaitActive( "A game, ok ?") Sleep(1000) while 0 = 0 $coord = PixelSearch( 129, 261, 858, 490, 0xfa6541, 1 ) if IsArray ($coord) then MouseClick('Left', $coord[0], $coord[1] - 1) endif mouseclick("left", 289, 230) sleep(8500) mouseclick("Left", 367, 429) sleep(6000) mouseclick("Left", 367, 429) sleep(6000) mouseclick("Left", 367, 429) sleep(6000) mouseclick("Left", 367, 429) sleep(6000) mouseclick("Left", 367, 429) sleep(5000) mouseclick("Left", 367, 429) sleep(5000) mouseclick("Left", 367, 429) sleep(5000) mouseclick("left", 511, 398) sleep(6200) wend Now there is only one thing left to do, how do I make it mouseclick if it DIDNT find a pixel? I took the If Not IsArray($coord) Then Return from your script and replaces Return with MouseClick("Left", 750, 750) But it wont work Edited November 8, 2008 by Inquisitor Link to comment Share on other sites More sharing options...
Valuater Posted November 8, 2008 Share Posted November 8, 2008 you have 4 posts... I have how many???...!!! learn how simple my script is.... and use it 8) Link to comment Share on other sites More sharing options...
Inquisitor Posted November 8, 2008 Author Share Posted November 8, 2008 you have 4 posts... I have how many???...!!! learn how simple my script is.... and use it 8) I tried using your script, it doesnt work. Actually it wont even start... (Yes I did paste wroking winwaitactive and winactivate codes) Now back to my working script, a few questions. #1 I use the code If Not IsArray($coord) Then MouseClick("Left", 414, 223) The question is how do I make it randomly mouseclick one of four positions. E.G. I have 4 coordinates 414, 223 and 424,223 and 414, 233 and 424, 223 How do I make autoit randomly choose one of them and click. #2 If the If Not IsArray($coord) Then MouseClick("Left", 414, 223) activates, it wont start the script from the start. I need it to mouseclick and then loop the script if the array isnt ($coord). Hope you could understand me, English isnt my native language. Link to comment Share on other sites More sharing options...
Valuater Posted November 8, 2008 Share Posted November 8, 2008 Actually it wont even start... did you press "F9" HotKey ? here no hotkey needed... it will start on its own... but there is no stop Opt("MouseCoordMode", 0);1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0);1=absolute, 0=relative, 2=client WinActivate("Some game") WinWaitActive("Some game") Sleep(1000) While 1 Sleep(20) Start WEnd Func Start() $coord = PixelSearch(129, 261, 858, 490, 0xede0c5, 1) If IsArray($coord) Then MouseClick('Left', $coord[0], $coord[1] - 1) EndIf MouseClick("left", 289, 230) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) EndFunc ;==>Start 8) Link to comment Share on other sites More sharing options...
Valuater Posted November 8, 2008 Share Posted November 8, 2008 ;~ The question is how do I make it randomly mouseclick one of four positions. E.G. ;~ I have 4 coordinates 414, 223 and 424,223 and 414, 233 and 424, 223 ;~ How do I make autoit randomly choose one of them and click. Dim $array[5] = ["","414,223","424,223","414,233","424,223"] $coord = PixelSearch(129, 261, 858, 490, 0xede0c5, 1) If Not IsArray($coord) Then $random = Random(1, 4, 1) $Split = StringSplit($array[$random], ",") ;MouseClick("Left", $Split[1], $Split[2]) MsgBox(0x0, $random, $Split[1] & " - " & $Split[2], 2) EndIf 8) Link to comment Share on other sites More sharing options...
Inquisitor Posted November 8, 2008 Author Share Posted November 8, 2008 (edited) Actually it wont even start... did you press "F9" HotKey ? here no hotkey needed... it will start on its own... but there is no stop Opt("MouseCoordMode", 0);1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0);1=absolute, 0=relative, 2=client WinActivate("Some game") WinWaitActive("Some game") Sleep(1000) While 1 Sleep(20) Start WEnd Func Start() $coord = PixelSearch(129, 261, 858, 490, 0xede0c5, 1) If IsArray($coord) Then MouseClick('Left', $coord[0], $coord[1] - 1) EndIf MouseClick("left", 289, 230) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) EndFunc ;==>Start 8) Now when I try to launch your script it says: F:\Bot2.au3 (9) : ==> Missing separator character after keyword.: Start Start^ ERROR Edited November 8, 2008 by Inquisitor Link to comment Share on other sites More sharing options...
Valuater Posted November 8, 2008 Share Posted November 8, 2008 (edited) I answered your post above... sorry there was one idy bity error Opt("MouseCoordMode", 0);1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0);1=absolute, 0=relative, 2=client WinActivate("Some game") WinWaitActive("Some game") Sleep(1000) While 1 Sleep(20) Start() WEnd Func Start() $coord = PixelSearch(129, 261, 858, 490, 0xede0c5, 1) If IsArray($coord) Then MouseClick('Left', $coord[0], $coord[1] - 1) EndIf MouseClick("left", 289, 230) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) MouseClick("Left", 367, 434) Sleep(5000) EndFunc ;==>Start 8) Edited November 8, 2008 by Valuater Link to comment Share on other sites More sharing options...
Inquisitor Posted November 8, 2008 Author Share Posted November 8, 2008 (edited) I answered your post above... sorry there was one idy bity error 8) Woohoo! Your script and the random script work perfect! Thanks for helping me make this bot Edit: After bashing my head against the wall a couple of times, I finaly did it! I finished the dam bot expandcollapse popupWinActivate( "Its a secret") WinWaitActive( "Its a secret") Opt("MouseCoordMode", 0);1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0);1=absolute, 0=relative, 2=client Dim $array[5] = ["","414,223","471,233","528,220","470,204"] While 1 Sleep(20) Start() WEnd Func Start() $coord = PixelSearch(129, 261, 858, 490, 0xfa6541, 1) If IsArray($coord) Then MouseClick('Left', $coord[0], $coord[1] - 1) EndIf If Not IsArray($coord) Then $random = Random(1, 4, 1) $Split = StringSplit($array[$random], ",") MouseClick("Left", $Split[1], $Split[2]) Start() EndIf mouseclick("left", 289, 230) sleep(8500) mouseclick("Left", 367, 429) sleep(6000) mouseclick("Left", 367, 429) sleep(6000) mouseclick("Left", 367, 429) sleep(6000) mouseclick("Left", 367, 429) sleep(6000) mouseclick("Left", 367, 429) sleep(5000) mouseclick("Left", 367, 429) sleep(5000) mouseclick("Left", 367, 429) sleep(5000) mouseclick("left", 511, 398) sleep(6200) EndFunc Edited November 8, 2008 by Inquisitor Link to comment Share on other sites More sharing options...
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