rdb Posted January 12, 2009 Share Posted January 12, 2009 i am figuring out what the best way is todo this and chould get some help , iam getting allot of errors ect.. and just want to see a code and learn from it about howto write things properly. Iam used to .NET VB and i really chould use some tips or code pice`s to figure this out. Situation: 1 - I have a map in color somewhere on the screen. 2 - Own position is a const on mini map.(never changes) 3 - Movement is done by arrowkeys 4 - I want to check for 2 pixels in a specific area on map. waypoint 5 - When Combonation is found move with arrow keys to location of the pixelsearch. 6 - At location look for 2 pixels or else go to 2nd waypoint repeating ect... this just for educational use, iam working on a project and need to figureout how todo this good and fast from a expert useing 2 laptops to control a lil car Link to comment Share on other sites More sharing options...
iHonda Posted January 12, 2009 Share Posted January 12, 2009 there have been a lot of posts similar to this one.. might i suggest the search tool? A great place to start Autoit 1-2-3 Link to comment Share on other sites More sharing options...
rdb Posted January 12, 2009 Author Share Posted January 12, 2009 ;// Declaring constant variables ;// start pos Local Const $X= 1268 Local Const $Y= 774 Local Const $Stepin = 1.15 ;// Get next position by looking for a dot on mini map $Pos1 = PixelSearch( 1221, 760, 1260, 800, 0x000000, 11) If Not @error Then MouseMove($Pos1[0], $Pos1[1]) $Distx = $Pos1[0] - $X ;// Y distance to target is $Disty = $Pos1[1] - $Y ;// .. calculate howfar togo.. X as cant seem to know how ;// .. calculate howfar togo.. X as $Movex = $Distx / $Stepin $Movey = $Disty / $Stepin EndIf $Delx = $Movex * -100 If $Movex < 0 Then send("{left down}") Sleep($delx) send("{left up}") EndIf $Dely = $Movey * -100 If $Movex < 0 Then send("{up down}") Sleep($dely) send("{up up}") EndIf $Delx = $Movex * -100 If $Movex > 0 Then send("{right down}") Sleep($delx) send("{right up}") EndIf $Dely = $Movey * -100 If $Movex > 0 Then send("{down down}") Sleep($dely) send("{down up}") EndIf Link to comment Share on other sites More sharing options...
AwAke Posted January 12, 2009 Share Posted January 12, 2009 Just a quick suggestion that came to mind but may not work is. Say the coordinate you search for and find comes to 300,300. And your current location coordinate is 100,300 then you can use a do loop. For example. $mypos = 100,300 $destination = 300,300 ;Use a string split on the coords so you end up with just the X values. $myposX = 100 $destinationX = 300 Do Send("{RIGHT}"} ;then read your position again Until $myposX = $destinationX Then after moving along the X postion then do the same again for your Y coordinate. I cant really do much more to try explain it, when I get home ill write up the script properly with the proper functions etc. This is really vague and just shooting in the dark so to speak. Link to comment Share on other sites More sharing options...
andybiochem Posted January 12, 2009 Share Posted January 12, 2009 Try looking HERE where you posted this exact same problem and I gave a solution that would work with a bit of alteration to fit your script. - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! 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