Jump to content

Pixel Bot


Recommended Posts

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage");Shift-Alt-d





While 1
  Opt('PixelCoordMode', 2)
Global $Window = 'Game Window Title', $Color =  0x149030
If Not WinActive($Window) Then WinActivate($Window)

$WinSize = WinGetPos($Window)
If IsArray($WinSize) Then
    $Psearch = PixelSearch(0, 0, $Window[2], $Window[3], $Color)
    If @error Then
        Do
            Sleep(10)
            $Psearch = PixelSearch(0, 0, $Window[0], $Window[1], $Color)
        Until IsArray($Psearch); loop until color is found (returns an array)
    EndIf
EndIf

While 1
; I want it to find pixel move to it and left click, like a aim bot
WEndWEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFunc

ok I thoguht about mouse move, then have it left click, so it finds the pixel, moves to it then it will left click this is what I got so far im going to look up more ways about going about this, if you got any ideas, please tell me

Edited by Evil_Has_Survived
Thanks in advance
Link to comment
Share on other sites

  • Moderators

You don't need to do a mousemove() just use mouseclick().

This is something I use as a template.

HotKeySet("{Home}", "Start")
HotKeySet("{ESC}", "Stop")

While 1
    Sleep(250)
WEnd

Func Start()
    While 1
        $xy = PixelSearch(left, top, right, bottom, color, shade - variation, Step)
        If Not @error Then
            MouseClick("left", $xy[0], $xy[1], 1, 0)
        EndIf
    WEnd
EndFunc ;==>Start

Func Stop()
    Exit
EndFunc ;==>Stop

Then I use this to generate my pixelsearch.

#include <Misc.au3>

AutoItSetOption("MouseCoordMode", 0)
HotKeySet("{ESC}", "Stop")
HotKeySet("^`", "ReturnFunction")
HotKeySet("{F8}", "Area")

Dim $pos1, $pos2, $pos3, $color

While 1
    ToolTip("Press 'F8' to start.")
    Sleep(50)
WEnd

Func Area()
    Do
        $pos1 = MouseGetPos()
        ToolTip("Mouse Pointer X: " & $pos1[0] & "  " & "Y= " & $pos1[1] & @LF _
                 & @LF & "Click on hold at top left of area.")
        Sleep(10)
    Until (_IsPressed ('01') = 1)
    $pos1 = MouseGetPos()
    $x = $pos1[0]
    $y = $pos1[1]
    
    Do
        $pos2 = MouseGetPos()
        ToolTip("Mouse Pointer: X: " & $pos2[0] & "  " & "Y: " & $pos2[1] & @LF _
                 & @LF & "Drag mouse to bottom right" & @LF & "of area and release.")
        Sleep(10)
    Until (_IsPressed ('01') = 0)
    $pos2 = MouseGetPos()
    $x = $pos2[0]
    $y = $pos2[1]
    Color()
EndFunc ;==>Area

Func Color()
    While 1
        $pos3 = MouseGetPos()
        $color = PixelGetColor($pos3[0], $pos3[1])
        ToolTip("Color at Mouse Pointer: " & $color & @LF & _
                @LF & "Press CTRL + ` (Tilda key) to record color.")
        Sleep(10)
    WEnd
EndFunc ;==>Color

Func ReturnFunction()
    ToolTip("")
    InputBox("PixelSearch() Generator", "This is your function", _
            "PixelSearch(" & $pos1[0] & ", " & $pos1[1] & ", " & $pos2[0] _
             & ", " & $pos2[1] & ", " & $color & ", shade-variation, step)")
    Exit
EndFunc ;==>ReturnFunction

Func Stop()
    Exit
EndFunc ;==>Stop
Edited by big_daddy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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