Jump to content

need help with a little Guild Wars Bot


Recommended Posts

Hey everyone ,

I´am new at writing Bots especially using Auto-it.

I am currently working on a GW-Bot which i call a "Drunkbot" which takes several flasks of Alcohol during a certain time.

The Bot itself works fine but i got Problems with a GUI.

At first i want to post the Sourcecode :

#include <GUIConstants.au3>

Opt("GUICoordMode",1)
#region - GUI Create
GUICreate('Drunkbot')

;controls
GUICtrlCreateLabel ("Drunkbot",20,20 ); added for show
$Button_1 = GUICtrlCreateButton ("OK",  50, 300, 80); OK Button
$Button_2 = GUICtrlCreateButton ("Cancel",  250, 300, 80); Cancel Button


GUISetState(@SW_SHOW)
#endregion

#region - GUI SelectLoop
While 1
    $msg = GUIGetMsg(@SW_SHOW)
    Select
        Case $msg = $GUI_EVENT_CLOSE; $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button_1; Button Ok starts the bot             <<-------------------------------------------------------------
             Func _A()                                          <---------------
        Case $msg = $Button_2
                MsgBox ( 0 , "Ok..." , "Cya Soon :)" ,10)
                Exit
        Case $msg = 1
        Case $msg = 1
    EndSelect
WEnd
#endregion

;Functions
#region - Functions

Func _A()                              <-------------------------------------------------------
Opt("WinWaitDelay",100)
    Opt("WinTitleMatchMode",4)
    Opt("WinDetectHiddenText",1)
    Opt("MouseCoordMode",0)
    WinWait("Guild Wars","")
    If Not WinActive("Guild Wars","") Then WinActivate("Guild Wars","")
    WinWaitActive("Guild Wars","")
    Sleep(8000)
    MouseClick("left",1206,933,2)
    Sleep(1800)
    MouseClick("left",1206,933,2)
    Sleep(2100)
    MouseClick("left",1206,933,2)


    $count = 0
    While $count < 1
    Sleep(56270)
    MouseClick("left",1206,933,2)
    Sleep(57780)
    MouseClick("left",1206,933,2)
    Sleep(58630)
    MouseClick("left",1206,933,2)
    Sleep(55310)
    MouseClick("left",1206,933,2)
    wEnd
EndFunc

I marked the Problem with arrows .. so how can i connect the Loop which starts the bot with the Operation after Pressing "$Button1"?

At the Time nothing happens after pressing the Button "Ok".

greetz

Edited by PornoRalle
Link to comment
Share on other sites

While 1
    $msg = GUIGetMsg(@SW_SHOW)
    Select
        Case $msg = $GUI_EVENT_CLOSE; $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button_1; Button Ok starts the bot 
             _A()
        Case $msg = $Button_2
                MsgBox ( 0 , "Ok..." , "Cya Soon :)" ,10)
                Exit
        Case $msg = 1
        Case $msg = 1
    EndSelect
WEnd

Replace Func _A() to _A()

Edited by Dieuz
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...