Sign in to follow this  
Followers 0
joeyone

Colorchanger app problem

4 posts in this topic

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.jpg

The problem

When 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 colors

without flipping any of it. i think the script dont know where to start flipping or maybe the loop

is 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 queue

This is my code

CODE

;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

; Code

For $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

EndIf

EndIf

$x += 63

if $i = 8 Then

$i = 0

$y += 63

$x = 551

$counter += 1

if $counter = 8 Then

$counter = 0

$y = 326

$checkCount = 0

EndIf

EndIf

;change color

if 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

EndIf

EndIf

Next

Share this post


Link to post
Share on other sites



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.jpg

The problem

When 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 colors

without flipping any of it. i think the script dont know where to start flipping or maybe the loop

is 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 queue

Befor 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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

If its hard to solve please write in response just so i know its not possible to solve

thanks for taking time in this

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0