Mnichv Posted October 5, 2020 Posted October 5, 2020 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 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 expandcollapse popup;====================================================================================================; ;========================================== 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
JockoDundee Posted October 5, 2020 Posted October 5, 2020 1 hour ago, Mnichv said: \taern autoit\taernbot - gui.kxf Code hard, but don’t hard code...
Moderators Melba23 Posted October 5, 2020 Moderators Posted October 5, 2020 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts