Jump to content

Is it possible to make sure that mouse only clicks on the correct color after pixelsearch


Sserpy
 Share

Recommended Posts

Hello brainiacs

I am playing an anoying game in browser where i need to press the right christmas hearts. The problem is sometimes they get covered by the wrong hearts and it seems like there is a small delay between pixelsearch and mouse click so i hit the wrong heart when it swing over the right one. I am extremely new to programming but i would apreciate all the help i can get.

Heres the code..

#include <AutoItConstants.au3>

Local $Paused

HotKeySet ("{ENTER}", "Start")
HotKeySet ("{ESC}", "Exit")
HotKeySet("{p}", "pause")

Func pause()
    $Paused = NOT $Paused
    While $Paused
        Sleep(100)
        Tooltip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

While 1
Sleep(0)
WEnd

Func Start()
While 1
$pxs = PixelSearch(1390,900,50,400,0xED1A3B)
If isArray($pxs) then
MouseMove($pxs[0],$pxs[1], 0)
MouseClick("left", $pxs[0]-5, $pxs[1], 1, 0)
EndIf
 Sleep (180)
WEnd
EndFunc

 

Link to comment
Share on other sites

Hello brainiacs

I am playing an anoying game in browser where i need to press the right christmas hearts. The problem is sometimes they get covered by the wrong hearts and it seems like there is a small delay between pixelsearch and mouse click so i hit the wrong heart when it swing over the right one. I am extremely new to programming but i would apreciate all the help i can get.

Heres the code..

#include <AutoItConstants.au3>

Local $Paused

HotKeySet ("{ENTER}", "Start")
HotKeySet ("{ESC}", "Exit")
HotKeySet("{p}", "pause")

Func pause()
    $Paused = NOT $Paused
    While $Paused
        Sleep(100)
        Tooltip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

While 1
Sleep(0)
WEnd

Func Start()
While 1
$pxs = PixelSearch(1390,900,50,400,0xED1A3B)
If isArray($pxs) then
MouseMove($pxs[0],$pxs[1], 0)
MouseClick("left", $pxs[0]-5, $pxs[1], 1, 0)
EndIf
 Sleep (180)
WEnd
EndFunc

 

Link to comment
Share on other sites

  • Moderators

@Sserpy you seem to have missed the forum rules on your way in. I would suggest reading them now, especially the part about game automation, and you will see why this topic is locked.

"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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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