bikerbrooks Posted October 22, 2015 Posted October 22, 2015 (edited) just trying to make a bot where it finds pxels clicks but if no pixel found move to next command tried so many ways i just cant seem to figure out simple loops;i want this to find pixel then click until no $search found then move on to next ;i have tried many loops but they all seem to only run though this once ;; i want this to loop until not found $search = PixelSearch(1920,50,3839,1079,0xEF0FFF) If Not @error Then MouseMove($search[0],$search[1]) Sleep(750) MouseClick ("left") EndIf send("{ctrldown}{f}{ctrlup}{altdown}{c}{altup}{altdown}{a}{altup}") sleep(300) Send("open") EndIf Edited October 22, 2015 by bikerbrooks code out of place
JohnOne Posted October 22, 2015 Posted October 22, 2015 I'm not sure if you realize this, but there are exactly zero loops in your code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
bikerbrooks Posted October 22, 2015 Author Posted October 22, 2015 haha i noticed as i have tried if, while, also tried within a function and none to work i was trying to get some insight on what i need the loop within ie a while ? else ?
bikerbrooks Posted October 22, 2015 Author Posted October 22, 2015 Have a look in the help: Do...Untili have tried the do until i am trying so find juist a simple loop for the pixelsearch where when i have ran the loops i either get erroe mouse click $seach error so how do i do pixel searchuntil no pixel then
JohnOne Posted October 22, 2015 Posted October 22, 2015 _Example() Func _Example() While 3 $search = PixelSearch(1920, 50, 3839, 1079, 0xEF0FFF) If Not @error Then MouseMove($search[0], $search[1]) Sleep(750) MouseClick("left") Else Return SetError(1) ; Not found EndIf Send("{ctrldown}{f}{ctrlup}{altdown}{c}{altup}{altdown}{a}{altup}") Sleep(300) Send("open") WEnd EndFunc ;==>_Example bikerbrooks 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
MagnumXL Posted October 22, 2015 Posted October 22, 2015 JohnOne's code is surely perfection... I just wanted to point out that the 3 after While is arbitrary. Any number other than zero (0) will evaluate as true. So these are all the same:While 3 While 1 While True While 2 > 1Just so you don't get hung up thinking it will repeat 3 times or something like that. bikerbrooks 1
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