Jump to content

Recommended Posts

Posted (edited)

Hi, I'm new and started autoit about a week ago. I have coded in other langs before and this one seemed since so I'm trying it. I made some useful scripts for myself by using some examples on this forum but now I'm stuck. I'm trying to make a bot for Halo PC version. I can't seem to get pixelsearch to work unless im over the color. I have literally tried everything. Heres the code I'm using:

#Include <Constants.au3>
#NoTrayIcon

$AimbotToggle = False
$HexColor = "0xFFFFFF"

Opt("CaretCoordMode", 0)
Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)

HotKeySet("{F9}", "AimbotToggle")
HotKeySet("{F10}", "GetMousePosColor")
HotKeySet("{F11}", "ExitAimBot")

Func AimbotToggle()
    $AimbotToggle = Not $AimbotToggle
EndFunc

Func GetMousePosColor()
    $MousePos = MouseGetPos()
;MsgBox(64, "Color", Hex(PixelGetColor($MousePos[0], $MousePos[1])))
    ClipPut("0x" & StringRight(Hex(PixelGetColor($MousePos[0], $MousePos[1])), 6))
EndFunc

Func ExitAimBot()
    MsgBox(64, "Exited", "Exited")
    Exit
EndFunc

While 1
    If($AimbotToggle == True) Then
        $MousePos = MouseGetPos()
        $Cords = PixelSearch($MousePos[0], $MousePos[1], $MousePos[0], $MousePos[1], $HexColor, 5)
        If(IsArray($Cords)) Then
            MsgBox(64, "Mouse Position", $Cords[0] & "-" & $Cords[1])
    ;MouseMove($Cords[0], $Cords[1])
    ;MouseDown("left")
    ;MouseUp("left")
            MouseClick("Left", $Cords[0], $Cords[1])
        EndIf
    EndIf
WEnd

Exit

It's pretty simple but I still can't get it to work good.

If someone could help me that would be great :)

Thanks in advance!

Edited by Spacetech
Posted (edited)

The reason you are not search anything except whats under you mouse is because the coordinates you have defined for pixelSearch are confined to just mouse pos.

This will search a 100 Pixel area centered around the mouse pos.

#Include <Constants.au3>
#NoTrayIcon

$AimbotToggle = False
$HexColor = "0xFFFFFF"

Opt("CaretCoordMode", 0)
Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)

HotKeySet("{F9}", "AimbotToggle")
HotKeySet("{F10}", "GetMousePosColor")
HotKeySet("{F11}", "ExitAimBot")

Func AimbotToggle()
    $AimbotToggle = Not $AimbotToggle
EndFunc

Func GetMousePosColor()
    $MousePos = MouseGetPos()
;MsgBox(64, "Color", Hex(PixelGetColor($MousePos[0], $MousePos[1])))
    ClipPut("0x" & StringRight(Hex(PixelGetColor($MousePos[0], $MousePos[1])), 6))
EndFunc

Func ExitAimBot()
    MsgBox(64, "Exited", "Exited")
    Exit
EndFunc

While 1
    If($AimbotToggle == True) Then
        $MousePos = MouseGetPos()
        $Cords = PixelSearch($MousePos[0]-100, $MousePos[1]-100, $MousePos[0]+100, $MousePos[1]+100, $HexColor, 5) ; <--Note changes
            If Not @Error then MouseClick("Left", $Cords[0], $Cords[1],1,0)
    EndIf
WEnd
Edited by Paulie
Posted

1 you need to set the pixel search area, not this

$MousePos = MouseGetPos()

$Cords = PixelSearch($MousePos[0], $MousePos[1], $MousePos[0], $MousePos[1], $HexColor, 5)

2

your OPT() coordinates mode could/shoould be 2... see help

8)

NEWHeader1.png

Posted

-snip-

Thanks a lot it seems to work :)

1 you need to set the pixel search area, not this

$MousePos = MouseGetPos()

$Cords = PixelSearch($MousePos[0], $MousePos[1], $MousePos[0], $MousePos[1], $HexColor, 5)

2

your OPT() coordinates mode could/shoould be 2... see help

8)

When

Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)

and I'm searching for a pixel on the desktop it brings it to the top left corner.

I removed those lines and it fixed it.

I also DID search the help file like crazy.

Posted

Well thats pretty much what is has. Is their a problem with PixelGetColor and fullscreen games?

Then you would use this

Opt("MouseCoordMode", 1)

Opt("PixelCoordMode", 1)

to utilize the entire screen

8)

NEWHeader1.png

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
  • Recently Browsing   0 members

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