birenD Posted February 3, 2010 Posted February 3, 2010 Sleep (10000) $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) MsgBox(0,"Got It", "All Set") Sleep(5000) $q = 1 $t = 2000 Do $cord = PixelSearch(97,261,347,437,$var,10) MouseClick("Left",$cord[0],$cord[1]) Sleep($t) $cord = PixelSearch(97,437,347,658,$var,10) MouseClick("Left",$cord[0],$cord[1]) Sleep($t) $cord = PixelSearch(347,132,497,437,$var,10) MouseClick("Left",$cord[0],$cord[1]) Sleep($t) $cord = PixelSearch(347,437,497,658,$var,10) MouseClick("Left",$cord[0],$cord[1]) Sleep($t) $cord = PixelSearch(497,132,647,326,$var,10) MouseClick("Left",$cord[0],$cord[1]) Sleep($t) $cord = PixelSearch(497,478,647,721,$var,10) MouseClick("Left",$cord[0],$cord[1]) Sleep($t) $cord = PixelSearch(647,132,833,437,$var,10) MouseClick("Left",$cord[0],$cord[1]) Sleep($t) $cord = PixelSearch(647,437,833,721,$var,10) MouseClick("Left",$cord[0],$cord[1]) Sleep($t) $cord = PixelSearch(833,132,1050,437,$var,10) MouseClick("Left",$cord[0],$cord[1]) Sleep($t) $cord = PixelSearch(833,437,1050,721,$var,10) MouseClick("Left",$cord[0],$cord[1]) Sleep($t) $q = $q + 1 Until $q = -10 What i did here was take the screen of what i was applying this to.. and broke it apart.. because i did not want the bot to repeatedly click the same spot for a certain amount of time.. and waiting for that time took to long and wasted what the program could have been doing.. so if i broke it up i thought by the time the porgram returned to looking at that one spot.. it was free to click.. THE PROBLEM IS if the pixel comes back with @error = 1 the program just stops.. i thought about using If Else If statements but seems like it wont work.. im new to this can someone help me out
obscurant1st Posted February 3, 2010 Posted February 3, 2010 i thought about using If Else If statements but seems like it wont work.consider switch case statement.or just explain it a little bit more clearly in a less complicated way. i feel like not reading it. sorry.. :| [u]We don't need people who can spit back facts. We've got Google."[/u] WebguruBB - Free Hosting, Domains, and SEO articles.Awesome Techs - Tips, Tricks and Some Technology NewsCool Facts - Cool Facts, Fun Facts, Weird Facts etc.
Torx Posted February 3, 2010 Posted February 3, 2010 Ok, Not sure if I get what you want. You know that if a pixel of the specified colour cannot be found it does not return an array for the x,y value, but sets @error instead. If you only want to click if he found the pixel change your code as shown: ... Do $cord = PixelSearch(97,261,347,437,$var,10) If Not @error Then MouseClick("Left",$cord[0],$cord[1]) Sleep($t) EndIf $cord = PixelSearch(97,437,347,658,$var,10) If Not @error Then MouseClick("Left",$cord[0],$cord[1]) Sleep($t) EndIf ... Ping Utility
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