Guest Pornman Posted March 20, 2004 Share Posted March 20, 2004 hi, im quite new with auto-it v3 ive longly studied the syntaxe and possiblilty of the pixelsearch() command but i got a problem to make an good algorithme let me explaine myself: exemple: i make the evil icon move across screen ( ) but some other icon are moving like mad ( ) i want make an algorithm who make the difference betwin this to icon by taking red color as base. i know it oculd look a bit weird but i want make it if my exemple is not enough clear just tell me tka a lot Pornman Link to comment Share on other sites More sharing options...
insanepyrokid Posted March 21, 2004 Share Posted March 21, 2004 Ummmmm...Riiiiiiight.....Maybe you could start with posting your code so far? I'm not very good yet but I''l play around with it and see what i can do... Link to comment Share on other sites More sharing options...
insanepyrokid Posted March 21, 2004 Share Posted March 21, 2004 P.S. I'm assuming you're using the pixel stuff to find the icon and then mouse move or something to drag it to other locations, but.....Just post what you've got. I don't really understand your post too well.... Link to comment Share on other sites More sharing options...
Dev Posted March 23, 2004 Share Posted March 23, 2004 what if he dont got anything? looks like he doesnt... :iamstupid: Link to comment Share on other sites More sharing options...
Zog Posted December 5, 2022 Share Posted December 5, 2022 I may not be understanding your question, however, I'll offer this utility we use all the time. expandcollapse popupFunc IsColorAtPos2($x,$y,$color,$colorTolerance=0,$deltaX=0,$deltay=0,$checkTimes=1,$minimumFoundCount=1,$sleepTime=10) ; this function returns true if the color is found at the position specified, false if not ; $x = centroid x coordinate of the area to search ; $y = centroid y coordinate of the area to search ; $color = the decimal color you wish to search for ; $colorTolerance = the decimal color tolerance allowable for the $color you wish to search for. Default: no tolerance ; $deltaX = the plus and minus pixels from the $x centroid to search. Default: no tolerance, only look at the $x centroid pixel ; $deltaY = the plus and minus pixels from the $y centroid to search. Default: no tolerance, only look at the $y centroid pixel ; $checkTimes = how many times to check the area for the $color (w/ tolerance as appropriate). Default: one time ; $minimumFoundCount = minimum number of times the $color (w/ tolerance as appropriate) must be found. Default: one time ; $sleepTime = the msec between checks when using $checkTime. Default: 10 MS If $colorTolerance = 0 AND $deltaX=0 AND $deltaY=0 Then $foundCount = 0 For $i=1 To $checkTimes If PixelGetColor($x,$y)=$color Then $foundCount = $foundCount+1 EndIf Next If $foundCount >= $minimumFoundCount Then Return True Else Return False EndIf Else $foundCount = 0 For $i=1 To $checkTimes $pos=PixelSearch($x-$deltaX,$y-$deltaY,$x+$deltaX,$y+$deltaY,$color,$colorTolerance) If @error Then Else $foundCount=$foundCount+1 EndIf Sleep($sleepTime) Next If $foundCount >= $minimumFoundCount Then Return True Else Return False EndIf EndIf EndFunc ; find out if the color at coordinate (100,100) is white If IsColorAtPos2(100,100,16777215) Then ConsoleWrite("White color found"&@CRLF) Else ConsoleWrite("not white"&@CRLF) EndIf ; find out if the color at coordinate (100 +/- 50,100 +/1 20) is white with a tolerance of 100. Must find at least 5 times within 600 ms. Sample every 75ms If IsColorAtPos2(100,100,16777215,100,50,20,300/75,5,75) Then ConsoleWrite("White found within tolerance at least 5 times"&@CRLF) Else ConsoleWrite("white color not found, or not found enough times"&@CRLF) EndIf Link to comment Share on other sites More sharing options...
Zog Posted December 5, 2022 Share Posted December 5, 2022 Ack!!! I just realized the newer posts are on top. Didn't mean to dredge up a 19 year old thread!!! Link to comment Share on other sites More sharing options...
Recommended Posts