joeyone Posted October 3, 2007 Share Posted October 3, 2007 Hope someone can help me with this problem. This program searches for color pairs that are in a row.When the program finds 2 equal colors in a row it searches for the same color around those two.And if it finds a color equal then it flips that color so it form 3 colors of the same in a row.heres an example picture (the colors are not the same as in my script)http://img165.imageshack.us/my.php?image=colorgridif8.jpgThe problemWhen it finds more than one pair of colors.For example it finds red, blue, and black that are in a row with the possibility to form 3 in a row. Then the pointer loops between those 3 colorswithout flipping any of it. i think the script dont know where to start flipping or maybe the loopis to fast and the mouseclick part is delayed so it wont have enought time to flip.is there a easy solution of this?maybe theres a way to prioritate one action then move on, like a queueThis is my codeCODE;Colorchanger;Colors$gray = 16777215$orange = 17776317$blue = 282027$yellow = 16775794$green = 8257409$purple = 14506466$red = 16745352;color start value$matchColour = $gray$speed = 0$checkCount = 0$colourCount = 1$x = 551$y = 326$counter = 0$wait = 100; CodeFor $i = 1 To 8 Step +1 $color = PixelGetColor($x, $y) MouseMove($x, $y, 0)if $matchColour = $color Then $checkCount += 1 $kolla2 = PixelGetColor($x + 63, $y) if $kolla2 = $matchColour Then $check1 = PixelGetColor($x - 126, $y) ; Left $check2 = PixelGetColor($x + 189, $y) ; Rigt $check3 = PixelGetColor($x + 126, $y - 63) ; H Up $check4 = PixelGetColor($x + 126, $y + 63) ; H Down $check5 = PixelGetColor($x - 63, $y - 63) ; V Up $check6 = PixelGetColor($x - 63, $y + 63) ; V Down Select Case $check1 = $matchColour ; In front of Sleep($wait) MouseClick("left", $x - 126, $y, 1, $speed) MouseClick("left", $x - 63, $y, 1, $speed) MouseMove(420, 204, 0) Case $check2 = $matchColour ;Behind Sleep($wait) MouseClick("left", $x + 189, $y, 1, $speed) MouseClick("left", $x + 126, $y, 1, $speed) MouseMove(420, 204, 0) Case $check3 = $matchColour ; H Up Sleep($wait) MouseClick("left", $x + 126, $y - 63, 1, $speed) MouseClick("left", $x + 126, $y, 1, $speed) MouseMove(420, 204, 0) Case $check4 = $matchColour ; H Down Sleep($wait) MouseClick("left", $x + 126, $y + 63, 1, $speed) MouseClick("left", $x + 126, $y, 1, $speed) MouseMove(420, 204, 0) Case $check5 = $matchColour ; V up Sleep($wait) MouseClick("left", $x - 63, $y - 63, 1, $speed) MouseClick("left", $x - 63, $y, 1, $speed) MouseMove(420, 204, 0) Case $check6 = $matchColour ; V Down Sleep($wait) MouseClick("left", $x - 63 , $y + 63, 1, $speed) MouseClick("left", $x - 63, $y, 1, $speed) MouseMove(420, 204, 0) Case Else EndSelect EndIf $kolla3 = PixelGetColor($x + 126, $y) if $kolla3 = $matchColour Then $2check1 = PixelGetColor($x + 63, $y - 63) ; Up $2check2 = PixelGetColor($x + 63, $y + 63) ; Down Select Case $2check1 = $matchColour ; Up Sleep($wait) MouseClick("left", $x + 63, $y, 1, $speed) MouseClick("left", $x + 63, $y - 63, 1, $speed) MouseMove(420, 204, 0) Case $2check2 = $matchColour ; Down Sleep($wait) MouseClick("left", $x + 63, $y, 1, $speed) MouseClick("left", $x + 63, $y + 63, 1, $speed) MouseMove(420, 204, 0) EndSelect EndIfEndIf$x += 63if $i = 8 Then $i = 0 $y += 63 $x = 551 $counter += 1 if $counter = 8 Then $counter = 0 $y = 326 $checkCount = 0 EndIfEndIf;change colorif Then $colourCount += 1 if $colourCount = 1 Then $matchColour = $gray ElseIf $colourCount = 2 Then $matchColour = $orange ElseIf $colourCount = 3 Then $matchColour = $blue ElseIf $colourCount = 4 Then $matchColour = $yellow ElseIf $colourCount = 5 Then $matchColour = $green ElseIf $colourCount = 6 Then $matchColour = $purple ElseIf $colourCount = 7 Then $matchColour = $red $colourCount = 0 EndIfEndIfNext Link to comment Share on other sites More sharing options...
martin Posted October 3, 2007 Share Posted October 3, 2007 Hope someone can help me with this problem. This program searches for color pairs that are in a row.When the program finds 2 equal colors in a row it searches for the same color around those two.And if it finds a color equal then it flips that color so it form 3 colors of the same in a row.heres an example picture (the colors are not the same as in my script)http://img165.imageshack.us/my.php?image=colorgridif8.jpgThe problemWhen it finds more than one pair of colors.For example it finds red, blue, and black that are in a row with the possibility to form 3 in a row. Then the pointer loops between those 3 colorswithout flipping any of it. i think the script dont know where to start flipping or maybe the loopis to fast and the mouseclick part is delayed so it wont have enought time to flip.is there a easy solution of this?maybe theres a way to prioritate one action then move on, like a queueBefor I look at your code I would like to understand your explanation. You say when it finds more than one pair, then say as an example if it finds red, blue and black. How are these three different colours more than one pair? Or is a pair not 2 the same? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
joeyone Posted October 3, 2007 Author Share Posted October 3, 2007 one pair is two "squares" at the same color placed next to each other at the x axis black - black (one pair) blue - blue (one pair) red - red (one pair) its similair to the game named bejeweled, same goal to get 3 of the same kind in a row more than one kind of colors are not related to each other hope you understand Link to comment Share on other sites More sharing options...
joeyone Posted October 3, 2007 Author Share Posted October 3, 2007 If its hard to solve please write in response just so i know its not possible to solve thanks for taking time in this 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