Sign in to follow this  
Followers 0
Gissel

Need help with PixelSearch Reverse

3 posts in this topic

Hello out there on the forums, im new at this AutoIt so im here for some help :)

i was reading up on a tutorial trying to make a script for Bejeweled.

But as soon as it try to scan from Cornor 1 to Cornor 4, it never find the specified color in that cornor.

Hope you understand what im trying to explain.

_log("Searching top left position of playfield")
ToolTip('Searching top left position pixel with color ' & hex($CornerColor1, 6) , 0, 0)

$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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi, Gissel, welcome to the forum. Unfortunately you seem to have missed the rules on the way in, especially the part about not discussing automation of games. Please read through the rules to see why you will not receive any assistance with this topic.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Gissel,

JLogan3o13 is quite right - please read the Forum Rules - particularly the bit about not discussing game automation - before you post again. Thread locked. :naughty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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