Sign in to follow this  
Followers 0
xation

Help with user input boxes & Combining scripts

3 posts in this topic

#1 ·  Posted (edited)

Hi, I'm trying to create my GUI for a bot. For the user, I want them to put in a color code of an object so that the PixelSearch will find it. I have tried many ways, and this is one of my last options to post. Thank you for taking the time to look at this. The code is below. I only need the "Select Kill Time" button working right now, Soon I will implement a time between clicks ( a user input function, alike the color selector) but I will need to know how to do this first.

#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

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

#Region ### START Koda GUI section ### Form=
$_1 = GUICreate("Auto-Grinder", 404, 273, 192, 164)
GUICreate("Auto-Grinder"); will create a dialog box that when displayed is centered
GUICtrlCreateLabel("Press Escape to exit the bot, Press ", 160, 300, 100, 100)
$Button_1 = GUICtrlCreateButton("Run Bot", 20, 200, 90, 30)
$Button_2 = GUICtrlCreateButton("Normal Window", 20, 240, 90, 30)
$Button_3 = GUICtrlCreateButton("Exit Bot", 20, 280, 90, 30)
$Button_4 = GUICtrlCreateButton("Bot (Max Window)", 20, 160, 90, 30)
$combo = GUICtrlCreateCombo("", 120, 2, 145, 25)
GUICtrlSetData(-1, "10|15|20") ; add other item snd set a new default
$btn = GUICtrlCreateButton("Select Kill Time", 146, 154, 80, 20, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("Auto-Grinder", 72, 40, 252, 57)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


GUISetState()
While GUIGetMsg() <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_2
            WinSetState("WINDOW", "", @SW_RESTORE)
        Case $msg = $Button_3
            ExitLoop
        Case $msg = $Button_4
            WinSetState("WINDOW", "", @SW_MAXIMIZE)
        Case $msg = $btn
            MsgBox(64, "window", $combo)
    EndSelect
WEnd

Func Terminate()
    Exit
EndFunc   ;==>Terminate

The color code that will be inputted by the user will be put into the bot, the bot is listed below aswell. Also, Is there any way possible to combine these scripts? I've tried a number of ways, but all I can figure out is that I need to do a call command (when together) but it doesn't work. Seperate, I use a run command to launch the bot.exe from C:\Program FIles\ Directory. And when on exit of the second code, to run the first again.

#include <GUIConstants.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>

Dim $Monstercolor1 = 0x9F40B1
Dim $Monstercolor = 0xB58218
Dim $AGRO, $DOMO, $Coords, $Cam
HotKeySet("{F9}", "Attack2")
HotKeySet("{Esc}", "Terminate")

While GUIGetMsg() <> $GUI_EVENT_CLOSE ; loop until the message recieved is equal to event close
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Func Attack2()
    $AGRO = Not $AGRO
    While $AGRO
        If $AGRO Then ToolTip("Press F10 to start / stop. Press Esc to Exit", 100, 100)
        $Pixel = PixelSearch(260, 160, 1380, 800, $Monstercolor1, 20, 30)
        If Not @error Then
            ControlClick("WINDOW", "", 1, "left", 6, $Pixel[0], $Pixel[1])
            Sleep(8000)
        Else
            If @error Then Send("{RIGHT}")
        EndIf
        $Pixel = PixelSearch(260, 157, 1380, 800, $Monstercolor, 20, 30)
        If Not @error Then
            ControlClick("WINDOW", "", 1, "left", 6, $Pixel[0], $Pixel[1])
            Sleep(8000)
        Else
            If @error Then Send("{RIGHT}")
        EndIf
        $Cam = Not $Cam
        If Random() < 0.5 Then ; Returns a value between 0 and 1.
            SendKeepActive("WINDOW")
            Send("{RIGHT}")
        Else
            SendKeepActive("WINDOW")
            Send("{RIGHT}")
        EndIf
    WEnd
EndFunc   ;==>Attack2

Func Terminate()
    Run("C:\Program Files\Auto-Grinder\Auto-Grinder\First.exe")
    Exit
EndFunc   ;==>Terminate
Edited by xation

Share this post


Link to post
Share on other sites



xation,

Hi, I'm trying to create my GUI for a bot.

I take it you have not read this. Do not expect too much help here.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I, infact, have read that sticky. The bot will not violate any rules/ Does not have any multiplayer function.

Edited by xation

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  
Followers 0