Sign in to follow this  
Followers 0
Gissel

Help with some pixel search

3 posts in this topic

Hello, im curretly trying to get my script to scan for one color in a cornor down to another color in a cornor, but it never seems to find the second color when reversing

anyone who can help me?

$Corner1 = pixelSearch(0,0,@DesktopWidth,@DesktopHeight, $CornerColor1,0)
If @error Then
msgbox(0,"","Top Left pixel with color: " & hex($CornerColor1, 6) & " not found ")
exit
Else
MouseMove($corner1[0],$corner1[1])
endif


_log("Searching bottom right position of playfield")
ToolTip('Searching bottom right position pixel with color ' & hex($CornerColor4, 6) , 0, 0)

$Corner4=_pixelSearchReverse(0,0,@DesktopWidth,@DesktopHeight, $CornerColor4)
If @error Then
msgbox(0,"","Bottom Right pixel with color: " & hex($CornerColor4, 6) & " not found")
exit
Else
MouseMove($corner4[0],$corner4[1])
endif

Func _pixelSearchReverse($left,$top,$right,$bottom,$color)
$coordFoundColor=_ArrayCreate("-1","-1")
$i = 0
$j = 0

for $i = @DesktopWidth to 0 Step -1
for $j = @DesktopHeight to 0 Step -1

$currentcolor = PixelGetColor($i,$j)
if $currentcolor = $color then
$coordFoundColor[0] = $i
$coordFoundColor[1] = $j
return $coordFoundColor
endif

next
next
SetError(-1)
endFunc

what am i doing wrong?

Share this post


Link to post
Share on other sites



Well, seeing the word "playfield" makes me think you are trying to work with a game. As you know when you reviewed the forum rules on the way in to the forum, automating a game and discussing that subject in the forum is not allowed.

Now, if you are not doing such a thing then please forgive me for implying otherwise but I must ask you a simple question - If you are working with an application that has controls have you tried to access the controls instead of just doing a pixel search? It is much easier to just interact with the controls.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Seems the op hasn't read the forum rules since this is the same topic as a previously closed topic.

Last warning.

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0