gunnagitcha Posted March 3, 2009 Share Posted March 3, 2009 Ok so at first I was fine with the way I had this script running, but now I added a bunch more and it's rather lengthy, so is there a way to simplify this script? Basically it searches an area for a color and clicks it until it doesnt find it anymore, then moves onto the next square. $bag1x1 = 584 $bag1y1 = 661 $bag1x2 = 626 $bag1y2 = 706 $column1x1 = Pixelsearch($bag1x1,$bag1y1,$bag1x2,$bag1y2,0xAAD0DA, 20) If Not @error then MouseClick( "Right" ,$column1x1[0],$column1x1[1],1,4) sleep(175) endif Until @error Do $column1x2 = Pixelsearch($bag1x1,$bag1y1+51,$bag1x2,$bag1y2+51,0xAAD0DA, 20) If Not @error then MouseClick( "Right" ,$column1x2[0],$column1x2[1],1,4) sleep(175) endif Until @error Do $column2x1 = Pixelsearch($bag1x1+51,$bag1y1,$bag1x2+51,$bag1y2,0xAAD0DA, 20) If Not @error then MouseClick( "Right" ,$column2x1[0],$column2x1[1],1,4) sleep(175) endif Until @error EndIf Until @error Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted March 4, 2009 Share Posted March 4, 2009 You could use arrays and loops to shorten it quite alot, something like this: (untested) Global $Pos[3][4]=[ _ [584, 661, 626, 706], _ [584, 712, 626, 757], _ [635, 661, 697, 706]] For $X = 0 To 2 Do $column1x2 = PixelSearch($Pos[$X][0], $Pos[$X][1], $Pos[$X][2], $Pos[$X][3], 0xAAD0DA, 20) If Not @error Then MouseClick("Right", $column1x2[0], $column1x2[1], 1, 4) Sleep(175) EndIf Until @error Next .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
gunnagitcha Posted March 4, 2009 Author Share Posted March 4, 2009 (edited) I thought of that, only there are about 80 different arrays I have to use lol, that was just an excerpt from the script Edit* I guess the thought I had would be, Is there a way to have in it add 51 a set number of times? Edited March 4, 2009 by gunnagitcha 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