Jump to content
Sign in to follow this  

PixelSearch/PixelGetColor mouse move script!

Recommended Posts


I worked out how to finally run this Script. I've decided its only fair, That I post this on the forums to stop others having the same trouble I've had :)

Topics that posted, In order to I try asking for help on this subject. In the End I had to combine minor scripts.

1: http://www.autoitscript.com/forum/index.php?showtopic=86670

2: http://www.autoitscript.com/forum/index.php?showtopic=86670

Here are the Scripts at your disposal! Enjoy! (basic script coded by Jono)

; Find Location at Position 1
$coord = PixelSearch( 762, 174, 778, 182, 0xAFAE0B, 10)
If Not @error Then
    MouseClick("left", 770, 178, 1)

Broken down Guideline Script (sample):

; Find Location at Position 1
$coord = PixelSearch( Left, Top, Right, bottom, Pixel Color, Color variations)
If Not @error Then
    MouseClick("left", Top, Left, 1)

Readme: You can place the same Script lots of times on the same Au3 file, And you can make each one contain a different Color and/or set of coordinates. So for example: If it does not find the Color at the chosen Coordinates, on the 1st PixelSearch, It will move onto the 2nd one, or the 3rd 1, and so on.

Script: This Script is perfect for making an AutoIt Helper/Bot for most games. Also completely useful for things other then games

Edited by Jono

Share this post

Link to post
Share on other sites

Here's another Script (Created by Valuater) you can use to Detect what the Pixel Color codes are, and Coordinates that the you need. Simply rest your mouse over the Location and Press F9.

;*********** Use **************
; Press Esc to terminate script
; Press F8 to open a color dialog box and choose a color
; Or
; Press F9 to get the color under the mouse pointer
; Then press F7 to watch for color change
; by Valuater...... Enjoy!!!
#include <GuiConstants.au3>
#include <Misc.au3>

; BE SURE TO CHECK THESE TWO ***************************************************
Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client
Opt("PixelCoordMode", 0) ;1=absolute, 0=relative, 2=client

Global $var, $Color_win, $pos, $my_color, $check

HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "Get_Color")
HotKeySet("{F8}", "Color_Box")
HotKeySet("{F7}", "Check_Color")

ToolTip('Get Color - is Running (F7 - Check Color)(F8 - Color Box)(F9 - Get Color)',0,0)
While 1

Func Color_Box()
    $var = _ChooseColor (2)
    $pos = MouseGetPos()
Func Terminate()
    Exit 0
Func Get_Color()
    $pos = MouseGetPos()
    $Svar = PixelGetColor(  $pos[0] , $pos[1])
    $var = "0x" & Hex($Svar,6)
Func Show_Color()
    $my_color = $var
    $Color_win = GUICreate("RGB Color = " & $var, 290, 150, -1, -1)
    GUISetFont(9, 400, -1, "MS Sans Serif")
    GUICtrlCreateLabel(" This Color has been Copied to the ClipBoard  " & @CRLF & @CRLF & "  Just Paste it wherever you would like"& @CRLF & @CRLF & @CRLF & " Mouse position X=" & $pos[0] & "  Y=" & $pos[1]   , 10, 10, 270, 100)
    GUICtrlSetFont(-1, 9, 650)
    If $var = 0x000000 Then GUICtrlSetColor( -1, 0xFFFFFF)
    $OK_Btn = GUICtrlCreateButton("&OK", 100, 110, 80, 30)
    While 2
        $msg1 = GUIGetMsg()
        If $msg1 = $OK_Btn Or $msg1 = $GUI_EVENT_CLOSE Then ExitLoop
Func Check_Color()
    $check = NOT $Check
    If $check Then ToolTip('Get Color - is Checking Color',0,0)
    While $check
        $var2 = PixelGetColor(  $pos[0] , $pos[1])
        If $my_color <> $var2 Then
            MsgBox(262208, "Color Check", " the Color has changed   ")
    ToolTip('Get Color - is Running',0,0)
Edited by Jono

Share this post

Link to post
Share on other sites


im looking for the example script that is similar to this was a good one and i lost it

dim $Color = 0xBA1F1A
dim $Left = -434
dim $Top = -281
dim $Right = 831
dim $Bottom = 742

Func Game_Bot() 
    $Game = NOT $Game 
    If $Game Then ToolTip('Press (F9) to Exit Game Bot',0,0)
    While $Game;
        $ball = PixelSearch( $Left, $Top, $Right, $Bottom, $Color, 1, 10) 
        If Not @error Then MouseClick("left", $ball[0], $ball[1], 1, 0)

Share this post

Link to post
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
Sign in to follow this