Spacetech Posted September 28, 2007 Posted September 28, 2007 (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: expandcollapse popup#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 September 29, 2007 by Spacetech
Paulie Posted September 29, 2007 Posted September 29, 2007 (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 September 29, 2007 by Paulie
Valuater Posted September 29, 2007 Posted September 29, 2007 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)
Spacetech Posted September 29, 2007 Author Posted September 29, 2007 -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.
Valuater Posted September 29, 2007 Posted September 29, 2007 (edited) ...I removed those lines and it fixed it.That should be the same as Opt("MouseCoordMode", 1)Opt("PixelCoordMode", 1)EDIT: Modes8) Edited September 29, 2007 by Valuater
Spacetech Posted September 29, 2007 Author Posted September 29, 2007 Right now I'm in the game and when I hit F10 which usually activates the GetMousePosColor function doesn't seem to work.
Valuater Posted September 29, 2007 Posted September 29, 2007 This is mineFunc Get_Color() $pos = MouseGetPos() $Svar = PixelGetColor( $pos[0] , $pos[1]) $var = "0x" & Hex($Svar,6) Show_Color() EndFuncthe entire script is hereGet That Coloralso gets mouse position8)
Valuater Posted September 29, 2007 Posted September 29, 2007 Actually, if you are just trying to click on a color... this will set you up perfectlyGameBot Builder8)
Spacetech Posted September 29, 2007 Author Posted September 29, 2007 This is mine Func Get_Color() $pos = MouseGetPos() $Svar = PixelGetColor( $pos[0] , $pos[1]) $var = "0x" & Hex($Svar,6) Show_Color() EndFunc the entire script is here Get That Color also gets mouse position 8)Well thats pretty much what is has. Is their a problem with PixelGetColor and fullscreen games?
Valuater Posted September 29, 2007 Posted September 29, 2007 Well thats pretty much what is has. Is their a problem with PixelGetColor and fullscreen games?Then you would use thisOpt("MouseCoordMode", 1)Opt("PixelCoordMode", 1)to utilize the entire screen8)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now