pezo89 Posted April 24, 2009 Share Posted April 24, 2009 Hello, im trying to make a bot for a game i have, and i where just wondering if there is any way to have 2 pixelsearches on 2 diffrent locations, and that once one of those has changed, the corresponding loop actions start, and + question how can i have the loop to start on itself all over, without having to shutdown, and restart the script? code im working on atm is; expandcollapse popup<-- This set to start over after the while 3 loop is done --> sleep ("3000") mouseclick ("Left",185, 812, 1, 18) sleep ("123") send ("{CTRLdown}") sleep ("200") send ("{a}") sleep ("200") send ("{CTRLUp}") Sleep(Random(500,1000,1)) mouseclick ("right", 185, 812, 1, 24) Sleep(Random(1000,2000,1)) mouseclick ("Left", 257, 825, 1, 32) Sleep(Random(1000,2000,1)) mouseclick ("Left", 941, 284, 1, 56) Sleep(Random(1000,2000,1)) sleep ("11236") ;undock; mouseclick ("Left", 71, 870, 2, 32) sleep ("20133") mouseclick ("Right", 209, 633, 1, 24) sleep ("252") mouseclick ("Left", 295, 646, 1, 21) sleep ("90193") sleep ("1231") mouseclick ("Right", 534, 528, 1, 14) Sleep(Random(1000,2000,1)) mouseclick ("Left", 581, 557, 1, 17) Sleep(Random(1000,2000,1)) ;Drones out! Sleep(Random(1000,2000,1)) while 1;mine and lock; ;;Lock and mine;; $coord = PixelSearch( 1214, 93, 1214, 93, 0xFFFFFF ) If @error Then sleep ("10000") send ("{CTRLDown}") send ("{CTRLDown}") sleep ("200") MouseClick ("left", 1243, 95, 1, 25) sleep ("10") send ("{CTRLup}") sleep ("10000") send ("{CTRLup}") Sleep(Random(1000,5000,1)) send ("{f1}") sleep ("376") send ("{f2}") sleep ("287") send ("{f3}") EndIf WEnd sleep while 2;Check if full; $coord = PixelSearch( 442, 776, 476, 775, 0x0831E6,10) sleep ("100") if @error Then ;mousemoveactions; EndIf if not @error Then ;nothing; EndIf WEnd while 3; return home; - Start the script all over?? Func MyExit() Exit EndFunc Link to comment Share on other sites More sharing options...
Qousio Posted April 24, 2009 Share Posted April 24, 2009 (edited) Hello, im trying to make a bot for a game i have, and i where just wondering if there is any way to have 2 pixelsearches on 2 diffrent locations, and that once one of those has changed, the corresponding loop actions start, and + question how can i have the loop to start on itself all over, without having to shutdown, and restart the script?code im working on atm is;I'm sorry... I don't speak english very well, and my grammar is simply horrible, this might be the cause why I cannot understand what you're trying to do.I assume you want to PixelSearch() two different locations, and If one of them returns an array then a certain function starts? How about this:$Pixel1 = PixelSearch()$Pixel2 = PixelSearch()If IsArray($Pixel1) thenFunc()EndIfIf IsArray($Pixel2) thenFunc2()Endif Edited April 24, 2009 by Qousio Link to comment Share on other sites More sharing options...
pezo89 Posted April 24, 2009 Author Share Posted April 24, 2009 I'm sorry... I don't speak english very well, and my grammar is simply horrible, this might be the cause why I cannot understand what you're trying to do.I assume you want to PixelSearch() two different locations, and If one of them returns an array then a certain function starts? How about this:$Pixel1 = PixelSearch()$Pixel2 = PixelSearch()If IsArray($Pixel1) thenFunc()EndIfIf IsArray($Pixel2) thenFunc2()Endifwell, Let us try again... ps, dont give me that shit, i know i don't write English that good. But i am aware of that, so don't need any guy telling me something i already know. yes u are correct, i need to have the script searching two locations at once.once it finds a change in the pixel color on either of those locations, i need it to start a loop for the corresponding framefor example: Pixel1 - Frame A - change in color - move and do that, until change in Frame BPixel2 - Frame B - change in color - do somthing diffrent, and when that is done; reset the script all over Link to comment Share on other sites More sharing options...
FinalVersion Posted April 24, 2009 Share Posted April 24, 2009 well, Let us try again... ps, dont give me that shit, i know i don't write English that good. But i am aware of that, so don't need any guy telling me something i already know. yes u are correct, i need to have the script searching two locations at once.once it finds a change in the pixel color on either of those locations, i need it to start a loop for the corresponding framefor example: Pixel1 - Frame A - change in color - move and do that, until change in Frame BPixel2 - Frame B - change in color - do somthing diffrent, and when that is done; reset the script all overOT: If you do not speak English you know it pretty well, except for the occasional spelling error [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
Qousio Posted April 24, 2009 Share Posted April 24, 2009 (edited) Try this: Func Pixels() ;If you need the script to restart and work as before. ;Then clear $Pixel1 and $Pixel2 so they are not arrays anymore. ;The clearing code must be after "Func Pixels()" and before "While 1" While 1 $Pixel1 = PixelSearch() Sleep(25) $Pixel2 = PixelSearch() Sleep(25) If IsArray($Pixel1) Then One() EndIf Wend EndFunc Func One() While Not IsArray($Pixel2) $Pixel2 = PixelSearch() Sleep(25) ;Your Code here Wend Two() EndFunc Func Two() ;Your Code here EndFunc Edited April 24, 2009 by Qousio 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