Mr_Was_geht_sie_das_an

PixelSearch + Left Click

11 posts in this topic

#1 ·  Posted

Found this script last day:

HotKeySet("(F6)"),"_Exit")

While 1 If Is_Pressed(10) Then

$Specnaz = PixelSearch(100,100,100,100,0x100)

If IsArray($Specnaz) = True Then

MouseClick("Left")

EndIf

WEnd

Func _Exit()

Exit

EndFunc

 

Why do i get an Error if i try to start it ?

Share this post


Link to post
Share on other sites



#3 ·  Posted

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

 

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

The real Script looks like this:

 

HotKeySet("(F6)"),"_Exit")

While 1

$Specnaz = PixelSearch(100,100,100,100,0x100)

If IsArray($Specnaz) = True Then

MouseClick("Left")

EndIf

WEnd

Func _Exit()

Exit

EndFunc

 

I want "_IsPressed" in this script. Can someone help me with it ?

Share this post


Link to post
Share on other sites

#6 ·  Posted

I wanna activate this Script with an Hotkey, but dont undertsand, the example of "_IsPressed".

Share this post


Link to post
Share on other sites

#7 ·  Posted

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#8 ·  Posted

The "real" Script works fine, but in this script isnt the function "_IsPressed", also how i creat it that it works.
 

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

Share this post


Link to post
Share on other sites

#9 ·  Posted

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#10 ·  Posted

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)

Share this post


Link to post
Share on other sites

#11 ·  Posted

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.