Jump to content

Can't PixelGetColor after MouseClick


 Share

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
Else
$cont = 0
EndIf

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
EndIf

Func Terminate()
Exit
EndFunc

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

If $cont = 1 Then
startGame()

While 1
$nowcolor = PixelGetColor($startpoint[0], $startpoint[1])
If Not $startcolor = $nowcolor Then
ConsoleWrite($nowcolor)
ConsoleWrite(@LF)
EndIf
WEnd
Else
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)
Terminate()
EndIf

Can someone tell me why it is not working.

Thanks.

Zero.

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.

Link to comment
Share on other sites

  • Moderators

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.

"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

  • Moderators

Linkis20,

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:

M23

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:

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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...