Shakala Posted September 28, 2009 Share Posted September 28, 2009 (edited) Hello. First, i will begin with what i would like accomplished. I want Autoit to search a area within a predetermined box. Then, i want it to search for a pixle that is not white but randomly changes colors. It can be any color within the box, as long as if it is not white, and then, begin a set of actions after that. For example, i want it so it finds a single (non white) pixle, holds down the down arrow key, then, left clicks one time on the selected pixle while still holding the Right arrow key down. I am not sure how to begin with this, but ill start by giving the locations of the box it needs to search.EDIT: Would help if you would know what is happening... There is a picture being displayed within that box, and you have to click it for the next event to happen. You MUST click a part of the picture that is not white b/c it only reads if you click a colored pixel. The picture is a random set of about 100 different pictures. I COULD find a color from each picture and have it search through each of them every time, but making that code would be very time consuming and really not what im looking to do. I am sure there is a easier way to do it. '(566, 425)__________'(680, 425)'left, top, right, bottom'566, 425, 680, 512'(566, 512)__________'(680, 512)I would like it to search for any color that shows up in that area that is not whiteI was thinking about having it set up something like this... Not even sure if it would work setting it up like this...Func Search() $c_Color = PixelSearch(566, 425, 680, 512, 0x??????) ;Search for the pixle If Not @error And IsArray($c_Color) Then ;if there is no error and the colored pixle is visible, click the pixle MouseClick("left", ?, ?, 1, $MouseSpeed) ;left clicks *where it would click is where the previously found color was. EndIf EndFuncIf you have any ideas or any direction to point me in, it will be very helpful. I am still kinda new to coding in autoit, but i am able to get around with what i know. this is just a spot that stumped me. Also, if there is any more information that you require to solve this or if you are unclear about any aspect of it, let me know.~Sorry for this lengthy post, i just thought i would try to add as much information as possible for ease of answering. Thanks~Shakala Edited September 28, 2009 by Shakala Link to comment Share on other sites More sharing options...
Shakala Posted September 29, 2009 Author Share Posted September 29, 2009 (edited) No responses yet... if anything needs more clarifying, let me know. Also, if this is to complicated of a task, speak up also lol. Edited September 29, 2009 by Shakala Link to comment Share on other sites More sharing options...
jebus495 Posted September 29, 2009 Share Posted September 29, 2009 No responses yet... if anything needs more clarifying, let me know.Also, if this is to complicated of a task, speak up also lol.I don't suppose this would be related to Ladder Slasher?If this is a game then there are probably more effective ways of approaching your issue.My best guess is to try to figure out how the tolerance or "step" part of PixelSearch REALLY works. There could be a way to search for anything but a color that way. Link to comment Share on other sites More sharing options...
Shakala Posted September 29, 2009 Author Share Posted September 29, 2009 I don't suppose this would be related to Ladder Slasher?If this is a game then there are probably more effective ways of approaching your issue.My best guess is to try to figure out how the tolerance or "step" part of PixelSearch REALLY works. There could be a way to search for anything but a color that way.Ah, ic. yeah it is game related but not Ladder slashers. I'm really just trying to get used to coding in autoit and using the ladderslasher example was the best way for me to get my point across. Link to comment Share on other sites More sharing options...
jebus495 Posted September 29, 2009 Share Posted September 29, 2009 Ah, ic. yeah it is game related but not Ladder slashers. I'm really just trying to get used to coding in autoit and using the ladderslasher example was the best way for me to get my point across.If you're just learning then you can do what I did. I basically spent time searching for and looking through scripts that did things similar to what I needed to do. Now I can bot almost any 2D game lol. Link to comment Share on other sites More sharing options...
Shakala Posted September 29, 2009 Author Share Posted September 29, 2009 If you're just learning then you can do what I did. I basically spent time searching for and looking through scripts that did things similar to what I needed to do. Now I can bot almost any 2D game lol.That is usually how i learn how to code. i look at other codes and i change them to fit my needs and i learn and grow off of that. That is how i figured out how to do what i can do in auto it atm. Except, i just figured since there is a nice forums here, (and sice im kinda lazy) i figured i would just post my question in its entirety on this site and see what i could get out of it. Link to comment Share on other sites More sharing options...
JohnOne Posted September 29, 2009 Share Posted September 29, 2009 have a look at SendKeyDownDelay in the helpfile, and maybe use it before your mouseclick. AutoIt Absolute Beginners  Require a serial  Pause Script  Video Tutorials by Morthawt  ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Shakala Posted September 29, 2009 Author Share Posted September 29, 2009 (edited) have a look at SendKeyDownDelay in the helpfile, and maybe use it before your mouseclick.... Ok? Thanks, although it didnt really answer anything. I need to know how to make it go to the random color in the designated area. the clicking and all that i know how to do Edited September 29, 2009 by Shakala Link to comment Share on other sites More sharing options...
Tvern Posted September 30, 2009 Share Posted September 30, 2009 ... Ok? Thanks, although it didnt really answer anything. I need to know how to make it go to the random color in the designated area. the clicking and all that i know how to do I can think of two approaches: $SearchPosX = 200 $SearchPosY = 500 $SearchWidth = 400 $SeachHeigth = 300 For $iWidth = $SearchPosX To $SearchPosX + $SearchWidth For $iHeigth = $SearchPosY To $SearchPosY + $SearchHeigth If PixelGetColor($iWidth,$iHeigth) <> 0x000000 Then ;your response here EndIf Next Next Which I guess will be to slow, but I havn't tested it, or set PixelSearch() to search for black, but set the variation so high that it will pick up everything but a few very light shades. Link to comment Share on other sites More sharing options...
Shakala Posted September 30, 2009 Author Share Posted September 30, 2009 (edited) I can think of two approaches: $SearchPosX = 200 $SearchPosY = 500 $SearchWidth = 400 $SeachHeigth = 300 For $iWidth = $SearchPosX To $SearchPosX + $SearchWidth For $iHeigth = $SearchPosY To $SearchPosY + $SearchHeigth If PixelGetColor($iWidth,$iHeigth) <> 0x000000 Then ;your response here EndIf Next Next Which I guess will be to slow, but I havn't tested it, or set PixelSearch() to search for black, but set the variation so high that it will pick up everything but a few very light shades. if i do it the way you suggested first, with the for loops, how would i make my mouse go to that position? i realized in a earlier post i said "i know how to do the clicking and all that" but getting the mouse to the position is another issue. Edited October 1, 2009 by Shakala Link to comment Share on other sites More sharing options...
Shakala Posted October 4, 2009 Author Share Posted October 4, 2009 Any other ideas on how to go about doing this? *Shorter version. i want it to search for a non-white pixel in a selected area. the colors of the pixels and locations are random. Link to comment Share on other sites More sharing options...
sosad Posted October 5, 2009 Share Posted October 5, 2009 *Shorter version. i want it to search for a non-white pixel in a selected area. the colors of the pixels and locations are random. well, it has been said before but I think the solution is to use a simple pixlesearch: Func search () $coord = PixelSearch (left,top,right,bottom, 0x000000,254) ;search the area for any non pure white pixel If @error then msgbox (1,"","there is only pure white") ;no matching pixel was found Else MouseClick ( button, $coord[0], $coord[1],1,0) ;mouse click at the coordinates where the non-white pixel was found EndIf 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