Gissel Posted November 19, 2012 Share Posted November 19, 2012 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 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 19, 2012 Moderators Share Posted November 19, 2012 (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 November 19, 2012 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 19, 2012 Moderators Share Posted November 19, 2012 Gissel,JLogan3o13 is quite right - please read the Forum Rules - particularly the bit about not discussing game automation - before you post again. Thread locked. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts