Jump to content

Click The Color


Recommended Posts

Ok, I was looking through the Examples folder and I sarted experimenting with pixelsearch and such. I have it now so that when it spots XPixel, the box comes up and tell's me it's coordinates. But I was wondering how I would make it click the pixel of my choice. So like....

"When Green pixel appears on screen, the green pixel is clicked"...Any way to do this? Sorry for the "noobism".

-GS :)

Link to comment
Share on other sites

You answered your question. If a message box appear's telling you the co-ordinates then you know where you have to click, what do we use in AutoIt to click? MouseClick()... Simply mouse click at the co-ordinates you specified for the message box.

Edited by Burrup

qq

Link to comment
Share on other sites

Alright, thanks. What I meant is to not like

$coord = PixelSearch( 0, 0, 20, 300, 0x428EFF, 2 )

If Not @error Then

MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

EndIf

What I want to do is not, 'have the box pop up telling coordinates, then go to a script and type 'MouseClick(*coordinates*) then run the script to click there'. Like, ok, I'll try to make this more clear.:::

Say there is a .Gif image that keeps animating, and every 190 frames, a green pixel pops up, but in a different place each time. Everytime that pixel appears I want to click it.

I don't want to click the location, I want to click the color...

:) Yeeeah... Don't be surprised if you don't understand that at all...

(Don't ask how a .Gif would do that....lol) :evil:

Edited by GoronSlayer99
Link to comment
Share on other sites

I don't much understand why do you see a problem in this. You must only do do a script which keeps scanning the wanted area and click the pixel when it's on screen. Hopefully the script will be fast enough to catch that pixel...

Link to comment
Share on other sites

  • Moderators

Alright, thanks. What I meant is to not like

$coord = PixelSearch( 0, 0, 20, 300, 0x428EFF, 2 )

If Not @error Then

MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

EndIf

What I want to  do is not, 'have the box pop up telling coordinates, then go to a script and type 'MouseClick(*coordinates*) then run the script to click there'. Like, ok, I'll try to make this more clear.:::

Say there is a .Gif image that keeps animating, and every 190 frames, a green pixel pops up, but in a different place each time. Everytime that pixel appears I want to click it.

I don't want to click the location, I want to click the color...

:) Yeeeah... Don't be surprised if you don't understand that at all...

(Don't ask how a .Gif would do that....lol) :evil:

<{POST_SNAPBACK}>

$coord = PixelSearch( 0, 0, 20, 300, 0x428EFF, 2 )
If Not @error Then
    MouseClick("left", $coord[0] , $coord[1], 1, 1)
EndIf

This is what Burrup was telling you.

Edit:

And reading more of your request. You would use the AutoInfo tool provided in Tools in SciTE to get the exact Hex colour you are looking for. The current Hex colour your using 0x428EFF can be changed to whatever you want, just by finding the colour in AutoInfo (If I'm understanding you correctly).

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

$coord = PixelSearch( 0, 0, 20, 300, 0x428EFF, 2 )
If Not @error Then
    MouseClick("left", $coord[0] , $coord[1], 1, 1)
EndIf

This is what Burrup was telling you.

Edit:

And reading more of your request.  You would use the AutoInfo tool provided in Tools in SciTE to get the exact Hex colour you are looking for.  The current Hex colour your using 0x428EFF can be changed to whatever you want, just by finding the colour in AutoInfo (If I'm understanding you correctly).

<{POST_SNAPBACK}>

OOOOOO, Okay. (Yeah, I know about the Hex thing) But thanks for the help everyone, I'm gonna go try that now.

"Hope it's fast enough to catch that pixel" ROFL, it was an example, I don't really click on dots for fun :)

Edited by GoronSlayer99
Link to comment
Share on other sites

  • Moderators

OOOOOO, Okay. (Yeah, I know about the Hex thing) But thanks for the help everyone, I'm gonna go try that now.

"Hope it's fast enough to catch that pixel" ROFL, it was an example, I don't really click on dots for fun  :evil:

<{POST_SNAPBACK}>

If msgbox could catch it, so can the MouseClick the way I posted it with the speed on the end to 1... Good Luck, let us know how it turned out.

Don't forget!

Opt("MouseCoordMode", 0)

So that it clicks in the active window and not the screen :) .

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • 9 months later...
  • Moderators

ANd the full script is?

If he/she were to post it (If he/she felt like it that is), it would have been in the scripts and scraps. Why bring up a 9 month old thread and ask such a question?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

same problem

I was having same problem,

WinSetState("MyProgram", "", @SW_MAXIMIZE)
WinWaitActive("MyProgram")
While 1
$coord = PixelSearch( 0, 0, 20, 300, 0x0021A5 ); note that 0,0,20,300 is the search area you have setup.. and it is a narrow strip
If IsArray($coord) = 1 Then
MouseClick('left',$coord[0], $coord[1],1,0)
EndIf
WEnd

then I got help :think:

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

hey Valuater maybe can you help me something, there is alot of talented people here, but you are always good at helping me with my silly questions lol same with Smoke, and alot of others anyways, I was wondering

this is my code

#include <guiconstants.au3>
#include <misc.au3>

Global $SearchState = "No"

HotkeySet("{Space}", "StopSearch")

$PixelSearchForm = GUICreate("Pixel Click", 309, 151, 192, 125)
$SearchColorInput = GUICtrlCreateInput("", 10, 48, 89, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel('Manually type your color code here or click "Select Color"', 10, 24, 276, 17)
GUICtrlCreateLabel("Hit [Space] to stop Auto Clicker", 150, 117, 276, 17)
$Status = GUICtrlCreateLabel("PixelSearch: Off",10,95,137,17)
$SelectButton = GUICtrlCreateButton("Select Color", 192, 48, 97, 25)
$RunButton = GUICtrlCreateButton("Run PixelSearch Clicker", 10, 112, 137, 25)
GUISetState(@SW_SHOW)

While 1
        While $SearchState = "Yes"
            $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$SearchColor)
            If IsArray($coord) = 1 Then
                MouseClick('left',$coord[0], $coord[1],1,0)
            EndIf
        WEnd
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $SelectButton
        $SearchColorValue = _ChooseColor(2)
        GuiCtrlSetData($SearchColorInput, $SearchColorValue)
    Case $msg = $RunButton
        $SearchState = "Yes"
        GuiCtrlSetData($Status, "PixelSearch: On")
        $SearchColor = GuiCtrlRead($SearchColorInput)
    EndSelect
WEnd
Exit

Func StopSearch()
    $SearchState = "No"
    GuiCtrlSetData($Status, "PixelSearch: Off")
EndFunc

so I was wondering is there away to do this without the GUI (lol well of course there is away but...)

would you happen to know how I would do it, so say

this is my script getting edited with notepad

.
..........
..........
..........
.........
; I open my program, then I use autoit info, I found the pixel I wanted Hex: 0xE0DFE3, then it mouse clicks without a GUI involed thanks.

HOLY SHIT I JUST CONFUSSED MYSELF (it sucks being sleepy I swear)

edited: I could figure this out just tired tho :think:

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

you can finish...

#include <guiconstants.au3>
#include <misc.au3>

Global $SearchState = "No", $Hider, $SearchColor

HotkeySet("{Space}", "StopSearch")
HotKeySet("{F9}", "get_color")
HotKeySet("{ESC}", "Exiter")
HotKeySet("{F8}", "Show_GUI")

$PixelSearchForm = GUICreate("Pixel Click", 309, 151, 192, 125)
$SearchColorInput = GUICtrlCreateInput("", 10, 48, 89, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel('Manually type your color code here or click "Select Color"', 10, 24, 276, 17)
GUICtrlCreateLabel("Hit [Space] to stop Auto Clicker", 150, 117, 276, 17)
$Status = GUICtrlCreateLabel("PixelSearch: Off",10,95,137,17)
$SelectButton = GUICtrlCreateButton("Select Color", 192, 48, 97, 25)
$RunButton = GUICtrlCreateButton("Run PixelSearch Clicker", 10, 112, 137, 25)
GUISetState(@SW_HIDE)

While 1
        While $SearchState = "Yes"
            $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$SearchColor)
            If IsArray($coord) = 1 Then
                MouseClick('left',$coord[0], $coord[1],1,0)
            EndIf
        WEnd
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exiter()
    Case $msg = $SelectButton
        get_color()
    Case $msg = $RunButton
        $SearchState = "Yes"
        GuiCtrlSetData($Status, "PixelSearch: On")
        $SearchColor = GuiCtrlRead($SearchColorInput)
    EndSelect
WEnd
Exit

Func StopSearch()
    $SearchState = "No"
    GuiCtrlSetData($Status, "PixelSearch: Off")
EndFunc

Func Exiter()
    Exit
EndFunc

Func get_color()
     $SearchColorValue = _ChooseColor(2)
        GuiCtrlSetData($SearchColorInput, $SearchColorValue)
EndFunc

Func Show_GUI()
    If $Hider = 0 Then
        $Hider = 1
        GUISetState( @SW_SHOW, $PixelSearchForm )
    Else
        $Hider = 0
        GUISetState( @SW_HIDE, $PixelSearchForm )
    EndIf
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

this gets the color and works without a GUI... except when you want to see it

( just change the message box to a click )

http://www.autoitscript.com/forum/index.ph...6789&hl=Script#

8)

hehe see you are good at helping my silly questions, just two more things please, one I can't find the clipboard lol, and two in scite I can't find that msgbox, even did a search for the word, and it didn't find it, don't mine me being a sped right now I stayed up all night

Thanks in advance
Link to comment
Share on other sites

and blind as a bat .... lol

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 ")

ExitLoop

EndIf

WEnd

ToolTip('Get Color - is Running',0,0)

EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

hehe see you are good at helping my silly questions, just two more things please, one I can't find the clipboard lol, and two in scite I can't find that msgbox, even did a search for the word, and it didn't find it, don't mine me being a sped right now I stayed up all night

this is good but I don't think it will work, becuase I need it to click on more then one pixel, thats why I said I could'nt use the GUI, becuase in my script, it will run a couple of commands like send("r") for example

send("r")
send("r")
pixel hex=354V6
MouseClick("left")
sleep(1000)
pixel hex=8768
MouseClick("left")
sleep(1000)
pixel hex=36578
MouseClick("left")

#include <guiconstants.au3>
#include <misc.au3>

Global $SearchState = "No", $Hider, $SearchColor

HotkeySet("{Space}", "StopSearch")
HotKeySet("{F9}", "get_color")
HotKeySet("{ESC}", "Exiter")
HotKeySet("{F8}", "Show_GUI")

$PixelSearchForm = GUICreate("Pixel Click", 309, 151, 192, 125)
$SearchColorInput = GUICtrlCreateInput("", 10, 48, 89, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel('Manually type your color code here or click "Select Color"', 10, 24, 276, 17)
GUICtrlCreateLabel("Hit [Space] to stop Auto Clicker", 150, 117, 276, 17)
$Status = GUICtrlCreateLabel("PixelSearch: Off",10,95,137,17)
$SelectButton = GUICtrlCreateButton("Select Color", 192, 48, 97, 25)
$RunButton = GUICtrlCreateButton("Run PixelSearch Clicker", 10, 112, 137, 25)
GUISetState(@SW_HIDE)

While 1
        While $SearchState = "Yes"
            $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$SearchColor)
            If IsArray($coord) = 1 Then
                MouseClick('left',$coord[0], $coord[1],1,0)
            EndIf
        WEnd
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exiter()
    Case $msg = $SelectButton
        get_color()
    Case $msg = $RunButton
        $SearchState = "Yes"
        GuiCtrlSetData($Status, "PixelSearch: On")
        $SearchColor = GuiCtrlRead($SearchColorInput)
    EndSelect
WEnd
Exit

Func StopSearch()
    $SearchState = "No"
    GuiCtrlSetData($Status, "PixelSearch: Off")
EndFunc

Func Exiter()
    Exit
EndFunc

Func get_color()
     $SearchColorValue = _ChooseColor(2)
        GuiCtrlSetData($SearchColorInput, $SearchColorValue)
EndFunc

Func Show_GUI()
    If $Hider = 0 Then
        $Hider = 1
        GUISetState( @SW_SHOW, $PixelSearchForm )
    Else
        $Hider = 0
        GUISetState( @SW_HIDE, $PixelSearchForm )
    EndIf
EndFunc
Thanks in advance
Link to comment
Share on other sites

and blind as a bat .... lol

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 ")

ExitLoop

EndIf

WEnd

ToolTip('Get Color - is Running',0,0)

EndFunc

8)

:think:
Thanks in advance
Link to comment
Share on other sites

when you select the colors will it click them for you when you run the bot..... :think: I could tell it my program is a game rofl

#include <GUIConstants.au3>
#include <File.au3>

Dim $ver = "1.0.2"
Dim $pos = "", $CHex = "", $Cpos = "", $Count = 0, $data[11], $Label_[11], $Run, $Launcher, $cwait = 0
Dim $pause, $left = 0, $right = @DesktopWidth, $top = 0, $bottom = @DesktopHeight, $wait = 1000, $Vary = 5, $Skip = 5
Dim $Gloc = @ScriptDir & "\Games\", $Ginfo

Opt("PixelCoordMode", 0)      ;1=absolute, 0=relative, 2=client
Opt("MouseCoordMode", 0)      ;1=absolute, 0=relative, 2=client

HotKeySet("{ESC}", "Terminate")

$Gamebot = GUICreate("GameBot - Builder   by, QTasc  v" & $ver, 392, 402, -1, -1, -1, $WS_EX_ACCEPTFILES)
$Group_1 = GUICtrlCreateGroup("Game Select", 10, 10, 370, 60)
$Combo_2 = GUICtrlCreateCombo("New Game", 20, 34, 110, 21)
$Button_3 = GUICtrlCreateButton("Select Game", 150, 30, 100, 30)
Set_Game_List()
$Button_4 = GUICtrlCreateButton("Delete Game", 270, 30, 100, 30)
$Group_5 = GUICtrlCreateGroup("Game Launch", 10, 80, 370, 80)
$Radio_6 = GUICtrlCreateRadio("Run URL", 30, 100, 80, 20)
$Radio_7 = GUICtrlCreateRadio("Run Game exe", 110, 100, 100, 20)
$Input_8 = GUICtrlCreateInput("Type or Drag & Drop  -  URL or Game exe/link", 20, 130, 340, 20, -1, $WS_EX_ACCEPTFILES)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlSetState(-1, $GUI_DISABLE)
$Radio_9 = GUICtrlCreateRadio("Dont Launch Anything", 230, 100, 130, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
$Group_10 = GUICtrlCreateGroup("Pixel Search Area", 10, 170, 370, 100)
$Label_11 = GUICtrlCreateLabel("Left              Top             Right         Bottom      Varience      Skip", 20, 190, 350, 20)
$Input_12 = GUICtrlCreateInput($left, 20, 210, 40, 20)
$Input_13 = GUICtrlCreateInput($top, 80, 210, 40, 20)
$Input_14 = GUICtrlCreateInput($right, 140, 210, 40, 20)
$Label_16 = GUICtrlCreateLabel("Color Wait", 20, 243, 50, 20)
$Input_19 = GUICtrlCreateInput($cwait, 80, 240, 40, 20)
$Input_15 = GUICtrlCreateInput($bottom, 200, 210, 40, 20)
$Label_16 = GUICtrlCreateLabel("Search Wait", 135, 243, 60, 20)
$Input_17 = GUICtrlCreateInput($Vary, 260, 210, 40, 20)
$Input_18 = GUICtrlCreateInput($wait, 200, 240, 40, 20)
$Group_19 = GUICtrlCreateGroup("Colors to Search  -  10 Max", 10, 280, 370, 70)
$Input_20 = GUICtrlCreateInput($Skip, 320, 210, 40, 20)
$Label_[1] = GUICtrlCreateLabel("1", 20, 300, 50, 20)
$Label_[2] = GUICtrlCreateLabel("2", 70, 300, 50, 20)
$Label_[3] = GUICtrlCreateLabel("3", 120, 300, 50, 20)
$Label_[4] = GUICtrlCreateLabel("4", 170, 300, 50, 20)
$Label_[5] = GUICtrlCreateLabel("5", 220, 300, 50, 20)
$Label_[6] = GUICtrlCreateLabel("6", 20, 320, 50, 20)
$Label_[7] = GUICtrlCreateLabel("7", 70, 320, 50, 20)
$Label_[8] = GUICtrlCreateLabel("8", 120, 320, 50, 20)
$Label_[9] = GUICtrlCreateLabel("9", 170, 320, 50, 20)
$Label_[10] = GUICtrlCreateLabel("10", 220, 320, 50, 20)
$Button_29 = GUICtrlCreateButton("Get Area", 280, 240, 90, 25)
$Button_30 = GUICtrlCreateButton("Get Colors", 280, 290, 90, 25)
$Button_31 = GUICtrlCreateButton("Clear All", 280, 320, 90, 25)
$Button_32 = GUICtrlCreateButton("Save Game Info", 10, 360, 110, 30)
$Button_33 = GUICtrlCreateButton("Run GameBot", 140, 360, 110, 30)
$Button_34 = GUICtrlCreateButton("Exit GameBot", 270, 360, 110, 30)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_34
            ExitLoop
        Case $msg = $Button_3
            $Ginfo = GUICtrlRead($Combo_2)
            If $Ginfo = "" Then
           ; nada
            ElseIf $Ginfo = "New Game" Then
                Set_new_game()
            Else
                Set_game()
            EndIf
        Case $msg = $Button_4
            $Ginfo = GUICtrlRead($Combo_2)
            If $Ginfo = "New Game" Or $Ginfo = "" Then
           ; nada
            Else
                FileDelete($Gloc & $Ginfo & ".ini")
                Set_Game_List()
            EndIf
        Case $msg = $Radio_6
            GUICtrlSetState($Radio_7, $GUI_UNCHECKED)
            GUICtrlSetState($Radio_9, $GUI_UNCHECKED)
            GUICtrlSetState($Input_8, $GUI_ENABLE)
            GUICtrlSetState($Radio_6, $GUI_CHECKED)
            GUICtrlSetState($Input_8, $GUI_DROPACCEPTED)
        Case $msg = $Radio_7
            GUICtrlSetState($Radio_6, $GUI_UNCHECKED)
            GUICtrlSetState($Radio_9, $GUI_UNCHECKED)
            GUICtrlSetState($Input_8, $GUI_ENABLE)
            GUICtrlSetState($Radio_7, $GUI_CHECKED)
            GUICtrlSetState($Input_8, $GUI_DROPACCEPTED)
        Case $msg = $Radio_9
            GUICtrlSetState($Radio_6, $GUI_UNCHECKED)
            GUICtrlSetState($Radio_7, $GUI_UNCHECKED)
            GUICtrlSetState($Input_8, $GUI_DISABLE)
            GUICtrlSetState($Radio_9, $GUI_CHECKED)
        Case $msg = $Button_29
            Get_Area()
        Case $msg = $Button_30
            Get_Colors()
        Case $msg = $Button_31
            Clear_Colors()
        Case $msg = $Button_32
            Save_Game()
        Case $msg = $Button_33
            Set_Run()
        Case Else
       ;;;
    EndSelect
WEnd
Exit

; --------------------- Functions -----------------------

Func Set_new_game()
    If FileExists($Gloc & $Ginfo & ".ini") Then
        MsgBox(262208, "Sorry!", "That File Already Exists!   " & @CRLF & $Gloc & $Ginfo & ".ini   ", 5)
        Return
    EndIf
    $NewG = InputBox("New GameBot", "Please type in a New Game Name ", "", "", 200, 120)
    If $NewG = "" Then Return
    DirCreate($Gloc)
    FileWrite($Gloc & $NewG & ".ini", "")
    GUICtrlSetState($Radio_9, $GUI_CHECKED)
    GUICtrlSetState($Radio_7, $GUI_UNCHECKED)
    GUICtrlSetState($Radio_6, $GUI_UNCHECKED)
    GUICtrlSetData($Input_8, "Type or Drag & Drop  -  URL or Game exe/link")
    GUICtrlSetState($Input_8, $GUI_DISABLE)
    GUICtrlSetData($Input_12, 1)
    GUICtrlSetData($Input_13, 1)
    GUICtrlSetData($Input_14, @DesktopWidth)
    GUICtrlSetData($Input_15, @DesktopHeight)
    GUICtrlSetData($Input_17, 5)
    GUICtrlSetData($Input_18, 1000)
    GUICtrlSetData($Input_19, 1000)
    GUICtrlSetData($Input_20, 5)
    Set_Game_List()
EndFunc ;==>Set_new_game

Func Set_Game_List()
    $FileList = _FileListToArray ($Gloc)
    If (Not IsArray($FileList)) Or (@error = 1) Then
        MsgBox(262208, "Sorry!", "No Files\Folders Found in." & @CRLF & $Gloc & "   ", 5)
        Return
    EndIf
    GUICtrlSetData($Combo_2, "")
    For $x = 1 To $FileList[0]
        GUICtrlSetData($Combo_2, StringTrimRight($FileList[$x], 4) & "|", 1)
    Next
    GUICtrlSetData($Combo_2, "New Game")
EndFunc ;==>Set_Game_List

Func Set_game()
    If Not FileExists($Gloc & $Ginfo & ".ini") Then
        MsgBox(262208, "Sorry!", "That File Does Not Exist!   " & @CRLF & $Gloc & $Ginfo & ".ini   " & @CRLF & 'Please choose "New Game" to Create a New GameBot   ', 5)
        Return
    EndIf
    $Run = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Run", "0")
    If $Run = 0 Then
        GUICtrlSetState($Radio_9, $GUI_CHECKED)
        GUICtrlSetState($Radio_7, $GUI_UNCHECKED)
        GUICtrlSetState($Radio_6, $GUI_UNCHECKED)
        GUICtrlSetData($Input_8, "No Launch")
        GUICtrlSetState($Input_8, $GUI_DISABLE)
        $Launcher = ""
    ElseIf $Run = 1 Then
        GUICtrlSetState($Radio_7, $GUI_UNCHECKED)
        GUICtrlSetState($Radio_9, $GUI_UNCHECKED)
        $Launcher = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Launcher", "Not Found")
        GUICtrlSetState($Input_8, $GUI_ENABLE)
        GUICtrlSetData($Input_8, $Launcher)
        GUICtrlSetState($Radio_6, $GUI_CHECKED)
    ElseIf $Run = 2 Then
        GUICtrlSetState($Radio_6, $GUI_UNCHECKED)
        GUICtrlSetState($Radio_9, $GUI_UNCHECKED)
        $Launcher = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Launcher", "Not Found")
        GUICtrlSetState($Input_8, $GUI_ENABLE)
        GUICtrlSetData($Input_8, $Launcher)
        GUICtrlSetState($Radio_7, $GUI_CHECKED)
    EndIf
; pixel search
    $left = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Left", "None")
    GUICtrlSetData($Input_12, $left)
    $top = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Top", "None")
    GUICtrlSetData($Input_13, $top)
    $right = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Right", "None")
    GUICtrlSetData($Input_14, $right)
    $bottom = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Bottom", "None")
    GUICtrlSetData($Input_15, $bottom)
    $Vary = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Vary", "5")
    GUICtrlSetData($Input_17, $Vary)
    $cwait = IniRead($Gloc & $Ginfo & ".ini", "Settings", "CWait", "0")
    GUICtrlSetData($Input_19, $cwait)
    $wait = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Wait", "1000")
    GUICtrlSetData($Input_18, $wait)
    $Skip = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Skip", "5")
    GUICtrlSetData($Input_20, $Skip)
; colors
    If IniRead($Gloc & $Ginfo & ".ini", "Colors", "1", "") = "" Then
        MsgBox(262208, "Sorry!", "No Colors were Found!   ", 5)
        Return
    EndIf
    $Colors = IniReadSection($Gloc & $Ginfo & ".ini", "Colors")
    For $i = 0 To $Colors[0][0]
        $data[$i] = IniRead($Gloc & $Ginfo & ".ini", "Colors", $i, "")
   ;GUICtrlSetData($Label_[$i], $data[$i])
        GUICtrlSetBkColor($Label_[$i], $data[$i])
        If $i >= 10 Then ExitLoop
    Next
    
EndFunc ;==>Set_game

Func Get_Colors()
    $Ginfo = GUICtrlRead($Combo_2)
    If $Ginfo = "New Game" Or $Ginfo = "" Then
        MsgBox(262208, "Sorry!", "Please Select a Game Name First   ", 5)
        Return
    EndIf
    If GUICtrlRead($Button_30) = "Get Colors" Then
        HotKeySet("{F9}", "set_color")
        ToolTip('Press "F9" to Get the Color under the Mouse, Click "Done" when Finished', 0, 0)
        GUICtrlSetData($Button_30, "Done")
        Return
    Else
        HotKeySet("{F9}")
        ToolTip('')
        GUICtrlSetData($Button_30, "Get Colors")
        MsgBox(262208, "Saved!", "The Colors have been Saved to " & @CRLF & $Gloc & $Ginfo & ".ini" & "   ", 5)
        $Count = 0
    EndIf
EndFunc ;==>Get_Colors

Func set_color()
    $Ginfo = GUICtrlRead($Combo_2)
    $pos = MouseGetPos()
    $CHex = Hex(PixelGetColor($pos[0], $pos[1]), 6)
    $Count = $Count + 1
    If $Count > 10 Then
        MsgBox(262208, "Sorry!", "Colors pre-selected is Full!    ", 5)
        Return
    Else
        IniWrite($Gloc & $Ginfo & ".ini", "Colors", $Count, "0x" & $CHex)
        GUICtrlSetBkColor($Label_[$Count], "0x" & $CHex)
    EndIf
EndFunc ;==>set_color

Func Clear_Colors()
    For $x = 1 To 10
        GUICtrlSetBkColor($Label_[$x], 0xECE9D8)
    Next
    $Count = 0
EndFunc ;==>Clear_Colors

Func Get_Area()
    $Ginfo = GUICtrlRead($Combo_2)
    If $Ginfo = "New Game" Or $Ginfo = "" Then
        MsgBox(262208, "Sorry!", "Please Select a Game Name First   ", 5)
        Return
    EndIf
    $Count = 0
    If GUICtrlRead($Button_29) = "Get Area" Then
        HotKeySet("{F9}", "set_Area")
        ToolTip('Press "F9" to Get the Area under the Mouse Left-Top-Right-Bottom, Click "Done" when Finished', 0, 0)
        GUICtrlSetData($Button_29, "Done")
        Return
    Else
        HotKeySet("{F9}")
        ToolTip('')
        GUICtrlSetData($Button_29, "Get Area")
        $Count = 0
    EndIf
EndFunc ;==>Get_Area

Func set_Area()
    $Count = $Count + 1
    $Mpos = MouseGetPos()
    If $Count = 1 Then GUICtrlSetData($Input_12, $Mpos[0])
    If $Count = 2 Then GUICtrlSetData($Input_13, $Mpos[1])
    If $Count = 3 Then GUICtrlSetData($Input_14, $Mpos[0])
    If $Count = 4 Then GUICtrlSetData($Input_15, $Mpos[1])
    If $Count >= 4 Then $Count = 0
EndFunc ;==>set_Area

Func Save_Game()
    $Ginfo = GUICtrlRead($Combo_2)
    If $Ginfo = "New Game" Or $Ginfo = "" Then
        MsgBox(262208, "Sorry!", "Please Select a Game Name First   ", 5)
        Return
    EndIf
    If Not FileExists($Gloc & $Ginfo & ".ini") Then
        MsgBox(262208, "Sorry!", "That File Does Not Exist!   " & @CRLF & $Gloc & $Ginfo & ".ini   " & @CRLF & 'Please choose "New Game" to Create a New GameBot   ', 5)
        Return
    EndIf
    $Run = "L"
    If BitAND(GUICtrlRead($Radio_9), $GUI_CHECKED) = $GUI_CHECKED Then
        $Run = 0
        $Launcher = "No Launch"
    ElseIf BitAND(GUICtrlRead($Radio_7), $GUI_CHECKED) = $GUI_CHECKED Then
        $Run = 2
        $Launcher = GUICtrlRead($Input_8)
    ElseIf BitAND(GUICtrlRead($Radio_6), $GUI_CHECKED) = $GUI_CHECKED Then
        $Run = 1
        $Launcher = GUICtrlRead($Input_8)
    EndIf
    If $Run = "L" Or $Launcher = "" Then
        MsgBox(262208, "Sorry!", "Run Select Error   ", 5)
        MsgBox(0, $Run, $Launcher)
        Return
    EndIf
    $left = GUICtrlRead($Input_12)
    $top = GUICtrlRead($Input_13)
    $right = GUICtrlRead($Input_14)
    $bottom = GUICtrlRead($Input_15)
    $Vary = GUICtrlRead($Input_17)
    $wait = GUICtrlRead($Input_18)
    $cwait = GUICtrlRead($Input_19)
    $Skip = GUICtrlRead($Input_20)
    If $Run = 0 Then
        IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Run", $Run)
        IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Launcher", "No Launch")
    Else
        IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Run", $Run)
        IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Launcher", $Launcher)
    EndIf
    IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Left", $left)
    IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Top", $top)
    IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Right", $right)
    IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Bottom", $bottom)
    IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Vary", $Vary)
    IniWrite($Gloc & $Ginfo & ".ini", "Settings", "CWait", $cwait)
    IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Wait", $wait)
    IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Skip", $Skip)
    MsgBox(262208, "Done!", "File appears to be written Correctly!   ", 5)
EndFunc ;==>Save_Game

Func Set_Run()
    $Ginfo = GUICtrlRead($Combo_2)
    If $Ginfo = "New Game" Or $Ginfo = "" Then
        MsgBox(262208, "Sorry!", "Please Select a Game Name First   ", 5)
        Return
    EndIf
    If Not FileExists($Gloc & $Ginfo & ".ini") Then
        MsgBox(262208, "Sorry!", "That File Does Not Exist!   " & @CRLF & $Gloc & $Ginfo & ".ini   " & @CRLF & 'Please choose "New Game" to Create a New GameBot   ', 5)
        Return
    EndIf
    If IniRead($Gloc & $Ginfo & ".ini", "Colors", "1", "") = "" Then
        MsgBox(262208, "Sorry!", "No Colors were Found!   ", 5)
        Return
    EndIf
    If $Run = 1 Then
        Run(@ComSpec & " /c Start " & $Launcher, "", @SW_HIDE)
    ElseIf $Run = 2 Then
        $Launched = FileGetShortName($Launcher)
        Run(@ComSpec & " /c Start " & $Launched, "", @SW_HIDE)
    EndIf
    GUISetState(@SW_MINIMIZE, $Gamebot)
    ToolTip('Press F9 to Start Game', 0, 0)
    _ReduceMemory()
    HotKeySet("{F9}", "_start")
EndFunc ;==>Set_Run

Func _start()
    $Colors = IniReadSection($Gloc & $Ginfo & ".ini", "Colors")
    For $i = 0 To $Colors[0][0]
        $data[$i] = IniRead($Gloc & $Ginfo & ".ini", "Colors", $i, "")
        If $i >= 10 Then ExitLoop
    Next
    $pause = Not $pause
    While $pause
        ToolTip('GameBot is "Running"..   Press F9 to Quit', 0, 0)
        $t = 0
        Do
            $t = $t + 1
            If $t > 10 Then ExitLoop
            Sleep($cwait)
            $Cpos = PixelSearch($left, $top, $right, $bottom, $data[$t], $Vary, $Skip)
        Until Not @error
        If $t > 10 Then ContinueLoop
        MouseClick("left", $Cpos[0], $Cpos[1], 1, 0)
   ;MouseMove($left, $top)
        Sleep($wait)
    WEnd
    ToolTip('')
    GUISetState(@SW_RESTORE, $Gamebot)
    HotKeySet("{F9}")
EndFunc ;==>_start

Func _ReduceMemory()
    Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    Return $ai_Return[0]
EndFunc ;==>_ReduceMemory

Func Terminate()
    Exit
EndFunc ;==>Terminate
Thanks in advance
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...