Jump to content
Sign in to follow this  

Can't PixelGetColor after MouseClick

Recommended Posts


I'm trying to make a script for http://www.tetrisfriends.com/games/Battle2P/game.php

By using PixelSearch i can find where the start button is and press it.

Now i need to wait for the player to finish the game.

Then when the game is over, i need to press "play again" or if it can press "Promote Me".

and then do it all over again.

So i alredy have a sytem that search the guide point en then press the start button.

But after the game starts i can't seem to get the now color.

Why is PixelGetColor not working?

Here is all the code that i have made:

HotKeySet("{ESC}", "Terminate")

Global $cont = 0
Global $startpoint = PixelSearch(0,0,@DesktopWidth,@DesktopHeight, 0x0099FF)
If Not @error Then
$cont = 1
$cont = 0

If $cont = 1 Then
Global $startbutton = $startpoint
$startbutton[0] = $startpoint[0]+172
$startbutton[1] = $startpoint[1]+246
Global $startcolor = PixelGetColor($startpoint[0], $startpoint[1])
Global $nowcolor = $startcolor

Func Terminate()

Func startGame()
MouseClick("primary", $startbutton[0], $startbutton[1], 1, 0)

If $cont = 1 Then

While 1
$nowcolor = PixelGetColor($startpoint[0], $startpoint[1])
If Not $startcolor = $nowcolor Then
Msgbox(48,"Error", "Can't find Tetris Battle Field." & @LF & "Make sure you are on the Tetris Friends Battle 2P Page," & @LF & "And the whole playing field is showing.", 8)

Can someone tell me why it is not working.



PS: I only know AutoIt for about a week >_< so for the most part I'm new to it.

I know Game Maker, Java, HTML, CSS, Javascript, JQuery, PHP so learing this learning this language is easy for me.

Share this post

Link to post
Share on other sites

Hi, Linkis20, welcome to the forum. Please read the forum rules, especially the part about game automation (this is something new forum members often miss) and you'll find out why you will not receive help on this issue. A link to the forum rules is located at the bottom right of every page.

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

How to get your question answered on this forum!

Share this post

Link to post
Share on other sites


JLogan3o13 is quite right - please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. Thread locked. :naughty:


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:


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
This topic is now closed to further replies.
Sign in to follow this