Inquisitor Posted November 9, 2008 Posted November 9, 2008 Hello! In a previous thread I was helped with making wonderfull bot. I did enhance it allot, and now it works very well! The only problem is I used allot of mouseclick()+sleep() commands which makes the bot waste allot of time, when its not needed. (I had to increase the sleep time because in the game I'm playing, people can interfere in your combat and make things laggy). expandcollapse popupWinActivate( "Some game") ;Activate window and wait till it's opened. WinWaitActive( "Some game") Opt("MouseCoordMode", 0);1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0);1=absolute, 0=relative, 2=client Dim $Runner ;Used for On/Off HotKeySet("{ESC}", "Terminate") ;On/Off HotKeySet("{F9}", "ShowMe") Dim $array[5] = ["","414,223","471,233","528,220","470,204"] ;Move to random map if no pixel found sleep(500) While 1 ;Look above Sleep(20) If $Runner Then Start() WEnd Func ShowMe() ;Look above $Runner = Not $Runner EndFunc ;==>ShowMe Func Terminate() ;Look above Exit 0 EndFunc ;==>Terminate Func Start() ;The main bot sleep(500) $coord = PixelSearch(129, 261, 858, 490, 0xfa6541) ;Look for pixel If IsArray($coord) Then MouseClick('Left', $coord[0], $coord[1] - 1) ;If pixel found, click on its coords EndIf If Not IsArray($coord) Then ;If pixel not found, move to random map $random = Random(1, 4, 1) $Split = StringSplit($array[$random], ",") MouseClick("Left", $Split[1], $Split[2]) Start() EndIf mouseclick("left", 289, 230) ;START combat sleep(8500) mouseclick("Left", 343, 465) ;Combat sleep(6000) mouseclick("Left", 340, 374) sleep(6000) mouseclick("Left", 340, 374) sleep(6000) mouseclick("Left", 367, 429) sleep(6000) mouseclick("Left", 343, 465) sleep(5000) mouseclick("Left", 340, 374) sleep(5000) mouseclick("Left", 340, 374) sleep(5000) mouseclick("Left", 367, 429) sleep(5000) mouseclick("Left", 367, 429) sleep(5000) mouseclick("Left", 367, 429) sleep(5000) mouseclick("Left", 367, 429) sleep(5000) mouseclick("Left", 367, 429) sleep(10000) mouseclick("Left", 367, 429) ;End Combat sleep(21000) ;Long wait incase somebody interferes in your fight and lags $coord2 = PixelSearch(498, 355, 498, 370, 0xce9460, 1) ;If many people entered fight then, quit If IsArray($coord2) Then mouseclick("left", 554, 455) sleep(200) mouseclick("left", 554, 441) EndIf mouseclick("left", 511, 408) ;Finish combat sleep(1000) EndFunc ;Repeat Now what I want is: #1 Change the Mouseclick() and Sleep() parts with PixelSearch and Mouseclick. How do you make a PixelSearch command that will wait untill the correspodning pixel apears, and only then continue the script? Sleep can't be used because the time till a pixel apears could be 1 second or 8 so using sleep makes the bot slow and clumsy. #2 Any other way to optimize this script? Share your ideas! P.S. Is it possible to make PixelCheckSum return an array of pixel coordinates?
oMBRa Posted November 9, 2008 Posted November 9, 2008 u can add a loop... something like: Do Sleep(10) Until Pixelsearch... = your color
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