Jump to content

Recommended Posts

Posted

Hi :)

I know that there were thousands of such topics, but after reading dozens, I still can't solve my problem. I have a script that is probably terrible for you, but I only learn for 1 day and the script works as I want, so it suits me :D

Everything would be great, but I can't make the script stop working after hitting the "STOP" button. I looked through a lot of topics and watched a lot of videos and I can't do it... Could someone give me a solution to my problem?

Thank you and sorry for the confusion :)

 

My script code

;====================================================================================================;
;========================================== Made by Mnichv ==========================================;
;====================================================================================================;

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\mnichv\desktop\taern autoit\taernbot - gui.kxf
$TaernBot = GUICreate("Taern Bot", 232, 110, -1, -1)
GUISetIcon("C:\Users\MNICHV\Desktop\Taern AutoIT\Icon\icon.ico", -1)
GUISetBkColor(0xFFFBF0)
$START = GUICtrlCreateButton("START", 24, 8, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "@Microsoft YaHei")
$STOP = GUICtrlCreateButton("STOP", 136, 8, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "@Microsoft YaHei")
$WYJDZ = GUICtrlCreateButton("WYJDŹ", 80, 48, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "@Microsoft YaHei")
GUICtrlCreateLabel("Made by Mnichv", 80, 88, 79, 18)
GUICtrlSetFont(-1, 7, 400, 0, "@Microsoft YaHei")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $START
            StartBot()

        Case $STOP
            StopBot()

        Case $WYJDZ
            Exit

    EndSwitch
WEnd

Func StartBot()
    While 1
        PixelSearch(160,292,202,293,0xFE5D5D,1) ;Hp
        If @error Then
            ToolTip("Uzupełniam zdrowie")
            MouseClick("left",184,357,1,5) ;Klika odpoczynek
            Sleep(35000)
            ToolTip("")
        ElseIf Not @error Then
            ToolTip("Zdrowie wystarczające")
            Sleep(500)
            ToolTip("")
        EndIf
        ;===========================================================================
        PixelSearch(135,307,201,307,0x0097FD,1) ;Mana
        If @error Then
            ToolTip("Uzupełniam mane")
            MouseClick("left",184,357,1,5) ;Klika odpoczynek
            Sleep(35000)
            ToolTip("")
        ElseIf Not @error Then
            ToolTip("Mana wystarczająca")
            Sleep(500)
            ToolTip("")
        EndIf
        ;===========================================================================
        PixelSearch(135,321,201,321,0x00FC00,1) ;Kondycja
        If @error Then
            ToolTip("Uzupełniam kondycje")
            MouseClick("left",184,357,1,5) ;Klika odpoczynek
            Sleep(35000)
            ToolTip("")
        ElseIf Not @error Then
            ToolTip("Kondycja wystarczająca")
            Sleep(500)
            ToolTip("")
        EndIf
        ;===========================================================================
        While 1
        PixelSearch(622,225,1243,858,0xFEFE32,5) ;Szukanie Moba
            If @error Then
                ToolTip("Szukam moba") ;Nie ma Moba, czeka 0.5s i szuka znowu
                Sleep(500)
            ElseIf Not @error Then
                ToolTip("Mob znaleziony, atakuje") ;Znalazło Moba
                Sleep(500)
                ToolTip("")
                $mob = PixelSearch(622,225,1243,858,0xFEFE32,5)
                MouseClick("left", $mob[0], $mob[1],1,5) ;Klika na Moba
                MouseClick("left", $mob[0] + 30, $mob[1],1,5) ;Klika na atak
                Sleep(5000) ;Czeka 5s na załadowanie walki itd.
                MouseClick("left", 1263, 310, 1,5) ;Wybiera 1 taktykę
                MouseClick("left", 1332, 350, 1,5) ;Klika zegar
                Sleep(2000) ;Czeka 2s
                MouseClick("left", 1264, 340, 1,5) ;Wybiera 2 taktykę na wypadek przedłuzenia się walki
                Sleep(9000)
                While 1
                    PixelSearch(1327,350,1337,355,0xFFA94C,1) ;Szuka pomarańczowego zegara
                    If @error Then
                        ToolTip("Czekam na kliknięcie zegara") ;Czeka na klikniecie zegara
                        ExitLoop
                    ElseIf Not @error Then
                        Sleep(1000)
                        MouseClick("left", 1332, 350, 1,5) ;Klika zegar
                        ExitLoop
                    EndIf
                WEnd
                While 1
                    PixelSearch(1245,703,1363,743,0xFFFFFF,1) ;Szuka przycisku wyjscia
                    If @error Then
                        ToolTip("Czekam na koniec walki")
                        Sleep(2000) ;Czeka 2s i znowu szuka przycisku wyjscia
                    ElseIf Not @error Then
                        MouseClick("left", 1307, 721,1,5) ;Klika wyjscie
                        ExitLoop
                    EndIf
                WEnd
                MouseMove(960,540,5)
                Sleep(1000)
                ExitLoop
            EndIf
        WEnd
    WEnd
EndFunc

Func StopBot()

EndFunc

 

  • Moderators
Posted

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...