Sign in to follow this  
Followers 0
Azumijpn

GUI x other functions

3 posts in this topic

i try to make 2buttons. start and stop/exit

if i don´t start bot. i can click exit. and appz exit.

if i start the prog. exit button dont work -_-

sorry im new on autoit

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $fPaused = False
Opt('MustDeclareVars', 1)

MainGUI()

Func MainGUI()
  Local $Button1, $Button2, $msg
  GUICreate("MeiaFoda FTW", 250, 70, 0,0, $WS_EX_TOPMOST)

  Opt("GUICoordMode", 2)
  $Button1 = GUICtrlCreateButton("start", 10, 5, 100)
  $Button2 = GUICtrlCreateButton("Sair", 0, -1)


  GUISetState()

  ; Run the GUI until the window is closed
  While 1
    $msg = GUIGetMsg()
    Select
     Case $msg = $GUI_EVENT_CLOSE
       ExitLoop
     Case $msg = $Button1
       MsgBox(0, 'MeiaFoda - Iris ', 'Comecando...',2)
       kiki()
     Case $msg = $Button2
       MsgBox(0, 'MeiaFoda - Iris', 'Saindo.... Obrigado', 1)
      Terminate()
    EndSelect
  WEnd
EndFunc

Func kiki()
While 999999999

Local $aCoord = PixelSearch(296, 217, 1554, 982, 0xFCFFEB)
If Not @error Then
   ToolTip("Cor Encontrada", 0, 0)
   Sleep(100)
                MouseClick("primary", $aCoord[0], $aCoord[1], 1, 0)
                Sleep(10000)
                Call("Fmatar")
                EndIf
   WEnd
EndFunc

Func Fmatar()
Local $CN2 = PixelGetColor( 134 , 100 )
If $CN2 = Dec("0x800303") Then
   Call("kiki")
Else
   Call("fkill")
EndIf
EndFunc

Func Fkill()
Local $kadu = PixelGetColor(1556,187)
If $kadu = Dec("130A131") Then
      ToolTip("Em combate", 0, 0)
   Call("kiki")
EndIf
EndFunc


Func Terminate()
Exit
EndFunc

Share this post


Link to post
Share on other sites



A small thing: You can use simple While 1 instead of While 999999999. It will loop forever too!

Second thing: You are looping your code forever. Autoit can handle only one thing at once (single threading). This way you can't look for the exit button while looping your code which really seems to be a bot and stating it's not a but is more suspicious :D

You should try Adlibregister and GuiOnEventMode. Look atthe help file, it will give you some examples. If you are stuck again write and let us help you if the mods don't close it.

Share this post


Link to post
Share on other sites

ty Universalist :thumbsup:

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