IknowIlost Posted June 26, 2009 Share Posted June 26, 2009 Since I was having so much trouble trying to make a bot with VB, someone told me about AutoIT so I decided to give a shot. I've been messing around with it, learning the basics and reading some tutorials and such and liked the easiness of everything, but I'm not sure how limited I will be. I just kind of need to get started, so hopefully someone here can put me on the right path or tell me what I want is impossible to do so I can try something else. What it should do seems pretty simple. I want to make the mouse click on a specific location. Then do a pixelsearch. If the pixel isn't found, I want it to continue along. The area I want the mouse click in is on a fixed location. The X coordinates go from 830 to 960, the Y coordinates go from 620 to 710. I never need to go outside that range unless I locate something with the pixelsearch. Also, if pixelsearch finds what I'm looking for, I need the mousecursor to continue along the path. So for example, I want to start the first click at 830, 620. From there, I want to do a pixelsearch and click on it if located. If it isn't found, then I want to add 5 to the X coordinate (leaving Y the same) and repeat the pixelsearch. If pixelsearch finds something at this location, then it should click on it, then check again. If nothing is found it should go to the next mouse click on the list (840, 620). This should repeat until the X coordinate hits the 960 mark, then add 10 to the Y coordinate and then go back to X until it reaches 830..... I hope that makes sense. Basically I want the mouse to snake in a small window on the game screen, all the while doing a pixelsearch after each mouse click. Is this possible? I'm not asking for someone to write me the code or anything, but I'm looking to get a basic idea of what I need to do. Mousemove(830,620,0) Mouseclick("left") Sleep(3000) MouseMove(830,625,0) Mouseclick("left") Sleep(3000) MouseMove(830,630,0) Mouseclick("left") Sleep(3000) MouseMove(830,635,0) Mouseclick("left") That's basically how I want the mouse to move, but I need to search for a pixel after each click. How would I accomplish that? Also, besides typing out every single mouse click, is there any way for me to loop the mousemove and just add 5 to the X coordinate until it's value is equal to 960. I know it's a long post, but I wanted to provide as much information as possible. So any tips, ideas, links to tutorials, etc. Whatever you can provide that would be helpful for me would be much appreciated. Link to comment Share on other sites More sharing options...
GodlessSinner Posted June 26, 2009 Share Posted June 26, 2009 Maybe I'm not right, but seems you want to find prints(traces) of fingers on a statue, in game that is called: "Sherlock Holmes: The Secret Of The Silver Earring" - I know this game(I finished it once,there all is much easier) - there aren't any prints of fingers! If not, you can use this code: ;X1----------Y1 ; | \ | ; | \ | ; | \ | ;Y2----------X2 ; ;Time taken = ((X2-x1)*(Y2-Y1))*$sleep/60 = time in minutes. ;======================================== $y2 = "200" $x2 = "200" $sleep = 1000 For $y1 = 100 To $y2 For $x1 = 100 To $x2 Sleep($sleep) MouseClick("Left",$x1,$y1,1,0) Next Next _____________________________________________________________________________ Link to comment Share on other sites More sharing options...
Bam Posted June 26, 2009 Share Posted June 26, 2009 VB vrs AutoIt, idk if theirs much of a difference. VB seems to me to be better at GUI's and more visual things but I hardly ever even use a GUI and the Scite editor is better for me when useing an old computer. For what you want to do shouldn't be to hard and the help file should give you every thing you need and thats 1 of the things I like about AutoIt is their nice quick and easy help file. Link to comment Share on other sites More sharing options...
IknowIlost Posted June 26, 2009 Author Share Posted June 26, 2009 No that isn't the game I'm working with. I appreciate the advice though, it gave me some ideas. I've got this to work in some form, but I'm having some problems. CODEMousemove(830,620,0) Mouseclick("left") While 1 $Search=PixelSearch (163,57,977,709,0x4E4CBC,5,1) If Not @error Then MouseClick ("Left",$Search[0],$Search[1],1,0) Sleep(20) WEnd So it does what I ask, but nothing after that. Basically. After it searches the screen for the pixel, if it's found it will click on it. However, if it doesn't find the pixel, how would I move to the next action? I know this code doesn't work, but this is what I want to do: CODEMousemove(900,620,0) Mouseclick("left") $Search=PixelSearch (163,57,977,709,0x4E4CBC,5,1) If Not @error Then MouseClick ("Left",$Search[0],$Search[1],1,0) Sleep(3000) MouseMove(900,625,0) Mouseclick("left") $Search=PixelSearch (163,57,977,709,0x4E4CBC,5,1) MouseMove(900,630,0) Mouseclick("left") $Search=PixelSearch (163,57,977,709,0x4E4CBC,5,1) Hopefully that makes sense on what I want to accomplish. Any ideas? Link to comment Share on other sites More sharing options...
GodlessSinner Posted June 30, 2009 Share Posted June 30, 2009 This must work and clicks at needed pixel: ;X1----------Y1 ; | \ | ; | \ | ; | \ | ;Y2----------X2 ; ;Time taken = ((X2-x1)*(Y2-Y1))*$sleep/60 = time in minutes. ;======================================== $y2 = "200" $x2 = "200" $sleep = 1000 For $y1 = 100 To $y2 For $x1 = 100 To $x2 If Hex(PixelGetColor( $x1 , $y1)) = "0x4E4CBC" Then MouseClick("Left",$x1,$y1,1,0) Sleep($sleep) EndIf Next Next _____________________________________________________________________________ Link to comment Share on other sites More sharing options...
Diception Posted July 1, 2009 Share Posted July 1, 2009 try the following for your scan and click commands expandcollapse popup$xstart = 0;x cord of first pixel to check $ystart = 0;y cord of first pixel to check $xmove = 25;set tihs to the number of pixels you want to move the mouse right $ymove = 25;set this to the number of pixels you want to move the mouse down $xmax = 500;last x pixel to check befor moving down $ymax = 500; last y pixel to check befor resting $color = 0xffffff;color in hex to search For $working = False; pause or run bot HotKeySet("{f1}","stop") setcords() While 1 if $working = True Then main() Else ToolTip("") sleep(100) EndIf sleep(10) WEnd func main() ToolTip("running") if $x>=$xmax Then $y=$y+$ymove $x=$xstart if $y>=$ymax Then setcords() EndIf Else $x=$x+$xmove EndIf MouseMove($x,$y) PixelSearch($x-10,$y-10,$x+10,$y+10,$color) if @error Then MouseClick("left") EndIf EndFunc Func stop() $working = not $working EndFunc Func setcords() Global $x=$xstart Global $y=$ystart EndFunc 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