Jump to content

PixelSearch + Left Click


Recommended Posts

You should probably read up on example forums for _IsPresses and PixelSearch to understand how they work.

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $hDLL = DllOpen("user32.dll")

While 1
    If _IsPressed("10", $hDLL) Then
        ConsoleWrite("_IsPressed - Shift Key was pressed." & @CRLF)
        $Specnaz = PixelSearch(1561, 181,1747, 280,0xC9B880,10)
            If IsArray($Specnaz) = True Then
            MouseClick("Left",0,0,1,10)
            EndIf
        ; Wait until key is released.
        While _IsPressed("10", $hDLL)
            Sleep(250)
        WEnd
        ConsoleWrite("_IsPressed - Shift Key was released." & @CRLF)
    ElseIf _IsPressed("1B", $hDLL) Then
        MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.")
        ExitLoop
    EndIf
    Sleep(250)
WEnd

DllClose($hDLL)

Good Reads below --

Example - _IsPressed

https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm

Example - PixelSearch

https://www.autoitscript.com/autoit3/docs/functions/PixelSearch.htm

 

 

Link to comment
Share on other sites

  • Developers

It seriously can't be that difficult to answer 2 questions I've now asked 2 times ...right?
You claim to get an error.. so What is the error?

As to HotKeySet() and IsPressed(), open the helpfile and look at the examples and explanation...then come back in case you have questions.
.. and saying it isn't clear or you don't understand doesn't mean much as there is no proper answer for that.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers
3 minutes ago, Mr_Was_geht_sie_das_an said:

Cant tell you the error-code, cause im not in my own PC.

No rush here so post back when you have had time to look and do some debugging.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Ok, last question:

Why do i need the ConsoleWrite and...

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $hDLL = DllOpen("user32.dll")

While 1
    If _IsPressed("10", $hDLL) Then
        ConsoleWrite("_IsPressed - Shift Key was pressed." & @CRLF)
        $Specnaz = PixelSearch(1561, 181,1747, 280,0xC9B880,10)
            If IsArray($Specnaz) = True Then
            MouseClick("Left",0,0,1,10)
            EndIf
        ; Wait until key is released.
 

am I need this part, or can i delete it ?:

      While _IsPressed("10", $hDLL)
            Sleep(250)
        WEnd
        ConsoleWrite("_IsPressed - Shift Key was released." & @CRLF)
    ElseIf _IsPressed("1B", $hDLL) Then
        MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.")
        ExitLoop
    EndIf
    Sleep(250)
WEnd

DllClose($hDLL)

Link to comment
Share on other sites

  • Developers

It sounds very much that you found this script somewhere and have no real idea what it does.
I am pretty sure it is used for automation of a game .. also called triggerbot... so 

  • Please read our forum rules in relation to thread on game automation
  • In case you want to continue questions here, then please do us and yourself a favor and open the helpfile first before simply asking questions.
  • PM me in case I've have seen things wrongly, but only when you can make it clear I am really wrong.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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