Zer0Velocity Posted August 23, 2007 Share Posted August 23, 2007 (edited) Hello, Its what i need is to search for the color blue in a window but might have more than the same color ( has to be close to each other ) Then if has a match searches each side of the 2 blues for other blues and clicks if finds the 3 blue. For example: __1____2_______ 3 Blue__Blue____Red _____________^ __4____5___6_| Yellow Red Blue So basically first finds "1" then cause of "1" does a search for more blues which is so many pixels away and found "2" then added them together and then did a search and found 6 and clicks and hold left mouse from the "6" position and then the "3" position. Any help is much appreciated thanks Edited August 23, 2007 by Zer0Velocity Link to comment Share on other sites More sharing options...
qazwsx Posted August 23, 2007 Share Posted August 23, 2007 I confused, can you try explaining again? Link to comment Share on other sites More sharing options...
autocomplex Posted August 23, 2007 Share Posted August 23, 2007 Is this for a bejeweled game or somthing? Want Runescape Specific Scripts and Bots?Visit AutoIt Runescape Team (ARST) forum! Link to comment Share on other sites More sharing options...
Zer0Velocity Posted August 23, 2007 Author Share Posted August 23, 2007 I confused, can you try explaining again?Basically needs to search for to matching blue within a certain distance then look around for another blue to make a match of 3 colors.Its very hard to explain Link to comment Share on other sites More sharing options...
autocomplex Posted August 23, 2007 Share Posted August 23, 2007 (edited) If its hard to explain it is even hard to understand. If you wish for us to help you you will have provide us with enough detailed information Ex Coord MousClicks and Moves. Or look at example scripts and use the Help Files to create the script yourself. Edited August 23, 2007 by inline853 Want Runescape Specific Scripts and Bots?Visit AutoIt Runescape Team (ARST) forum! Link to comment Share on other sites More sharing options...
Zer0Velocity Posted August 23, 2007 Author Share Posted August 23, 2007 Is this for a bejeweled game or somthing?Similar Link to comment Share on other sites More sharing options...
Zer0Velocity Posted August 23, 2007 Author Share Posted August 23, 2007 Jewelquest the game is called so its basically the same Link to comment Share on other sites More sharing options...
Kohr Posted August 23, 2007 Share Posted August 23, 2007 Just use a combination of PixelGetColor ,If/Then and Loops. Something like this to search a 10 x 10 area for example. x = 10 y = 10 $colortofind = 13421772 For i = 1 to y For j = 1 to x $test = PixelGetColor (j,i) If $test = 13421772 then $test2 = PixelGetColor (j + 10,i) <----to search x + 10 pixels If $test2 = $colortofind then msgbox found endif endif Next j Next i Sorry I don't feel like coding this all the way but this should give you a general idea. Kohr AutoIt LinksAutoIt CrapsGrid_PixelSearchAdvancedPixelGrab Link to comment Share on other sites More sharing options...
Zer0Velocity Posted August 23, 2007 Author Share Posted August 23, 2007 But it don't seem to get msgbox? $x = 250 $y = 250 $colortofind = 16432444 For $i = 1 to $y For $j = 1 to $x $test = PixelGetColor ($j,$i) If $test = 16432444 then $test2 = PixelGetColor ($j + 10,$i) ; <----to search x + 10 pixels If $test2 = $colortofind then msgbox found endif endif Next $j Next $i Link to comment Share on other sites More sharing options...
Zer0Velocity Posted August 23, 2007 Author Share Posted August 23, 2007 Any1 else willing to give me an example on how to do this, that will work? Link to comment Share on other sites More sharing options...
ofLight Posted August 23, 2007 Share Posted August 23, 2007 I see no reason why Kohr's method should not work, it is what I would have suggested first. If you are having problems with that method, I would suggest just using PixelCheckSum. It will compare the primary pixel to the relation of all the pixels around it of the same color. There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
Zer0Velocity Posted August 23, 2007 Author Share Posted August 23, 2007 I keep getting error: Next $i Next ^ ERROR Error: Illegal text at the end of statement (one statement per line). any ideas why? Link to comment Share on other sites More sharing options...
ofLight Posted August 23, 2007 Share Posted August 23, 2007 (edited) This is the Baseline code I use to show howto use PixelCheckSum. expandcollapse popupHotKeySet("`","_find") HotKeySet("~","record") HotKeySet('{esc}', '_Exit') Global $msg = "Press Shift+tilde to Record " & @LF & _ "Press tilde to Find " & @LF & _ "info saved in Pixel.ini" Global $xy,$currentpixel ;If $pixel = -1 Or $chksum = -1 Then ; MsgBox(4096,"Error","Could not read INI") ; Exit ;EndIf While 1 $xy = MouseGetPos() $currentpixel = PixelGetColor($xy[0],$xy[1]) ToolTip("Pixel color = " & $currentpixel & @LF & $msg) Sleep(100) WEnd Func record() IniWrite(".\Pixel.ini","Main","PixelColor",$currentpixel) Local $chksum = PixelChecksum($xy[0]-5, $xy[1]-5, $xy[0]+5, $xy[1]+5) IniWrite(".\Pixel.ini","Main","PixelCheckSum",$chksum) MsgBox(4096,"","Pixel Area Recorded." & @LF & @LF & "See INI file for details.", 2) ;Exit EndFunc Func _find() Local $pixel = Int(IniRead(".\Pixel.ini","Main","PixelColor","-1")) Local $chksum = Int(IniRead(".\Pixel.ini","Main","PixelCheckSum","-1")) $sv = 0 $w = 1 $x = 5 ;LEFT pixel of Total Area to Search for $pixel $y = 5 ;TOP $xpixel = @DesktopWidth - 5 ;Right $ypixel = @DesktopHeight - 5 ;Bottom While $w = 1 $xy = PixelSearch($x,$y,$xpixel,$ypixel,$pixel, $sv) If $w = 3 Then Exit EndIf If @error And $ypixel = (@DesktopHeight - 5)Then MsgBox(4096,"@Error ","Could not find Checksum" & @LF & ' Finished Searching all of Screen', 4) SetError(1) Return 0 ElseIf @error Then $y = $ypixel + 1 $ypixel = (@DesktopHeight - 5) $x = 0 ;MsgBox(4096,"@Error","Could not find Checksum" & @LF & ' looking again in 2sec', 2) ElseIf $chksum = PixelCheckSum($xy[0]-5, $xy[1]-5, $xy[0]+5, $xy[1]+5) Then $w = 3 ;PixelCheckSum(left, top, right, bottom [, step] ) MouseMove($xy[0],$xy[1], 30) ToolTip("Found Checksum") $pos = MouseGetPos() MouseMove( $pos[0], $pos[1] -5, 20) ;Top MouseMove( $pos[0] +5, $pos[1], 20) ;Right MouseMove( $pos[0], $pos[1] +5, 20) ;Bottom MouseMove( $pos[0] -5, $pos[1], 20) ;Left ;Exit Else $y = $xy[1] $ypixel = $y $x = $xy[0] + 1 EndIf WEnd EndFunc Func _Exit() ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ') Sleep(500) Exit EndFunc Edited August 23, 2007 by ofLight There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
Zer0Velocity Posted August 23, 2007 Author Share Posted August 23, 2007 How would i use that code to do a double search on 2 colours the same? Cause when i use the ` key it finds the right colour and moves the mouse around it. Link to comment Share on other sites More sharing options...
ofLight Posted August 23, 2007 Share Posted August 23, 2007 How would i use that code to do a double search on 2 colours the same? Cause when i use the ` key it finds the right colour and moves the mouse around it.Can you post a link to a screenshot or something? How close are the two pixels you are trying to find to each other ? There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
Zer0Velocity Posted August 23, 2007 Author Share Posted August 23, 2007 Here is a link to a screen shot. So you can understand http://img406.imageshack.us/img406/3985/examplexw9.png Link to comment Share on other sites More sharing options...
ofLight Posted August 23, 2007 Share Posted August 23, 2007 Yup, now i understand, thanks for the Pic. With that kind of Layout you could get away with just looking for one pixel and then another (pixelsearch as opposed to pixelchecksum). I would suggest just giving the function an output of the CoOrds, and then you can create your Logic based on whatever you want to do with the Location. Like match 3 in a row or whatever. I think it was Smoke_N who made a script awile back as an example that did a search for all instances of a checksum and returned an array? (Dont remember exactly) You could look for that script or just add array output to this one and nest it to search the whole area. There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly 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