Im beginner at AutoIt, and i cant figure out how to make Pause in other functions
Example
My script is hunting,
can anyone teach me how to Stop hunting script if theres a item on the ground and make my script to First loot that item then start hunting again ?
(Sorry for my english)
(Im working on these functions right now)
Use Path to walk im writing right now
Can anyone tell me how to make it ?
My script is pretty Basic ( Still learning, )
Open Spoiler to see it
; ================
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("PixelGame", 195, 76, 192, 124)
Global $Start = GUICtrlCreateButton("Start", 8, 40, 75, 25)
Global $Exit = GUICtrlCreateButton("Exit", 96, 40, 75, 25)
Global $Input1 = GUICtrlCreateInput("MonsterColor", 8, 8, 161, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
; Gui
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Exit
MsgBox(0,"Good Bye","Exiting Bot")
Exit
Case $Start
StartMainTask()
EndSwitch
WEnd
; Gui End ===========================
; Skrypt ============================
Func StartMainTask()
While(1)
; Globalne zmienne
Global $LootColor = 0xF6F6F6
Global $MobColor = GuiCtrlRead($Input1)
Global $Attacking = False;
Global $NeedHealing = False;
; Hotkeye
HotKeySet("{F1}","StopBot") ; Zatrzymanie bota
WinActivate("PixelGame") ; Aktywne okno
Send("{Space}")
Sleep(10)
; Otwieranie skrzyni
OpenChest()
;Szukanie Dropa
StartLooting()
; Atakowanie Potwora
StartKilling()
; Leczenie
$HPBAR = PixelSearch(248,77,251,77,0x232323,1)
If Not(@Error) Then
NeedHealing()
Else
If @Error Then
EndIf
EndIf
WEnd
EndFunc
;Funkcje =============================
func StartLooting()
; Podnoszenie Dropa ===================
$Loot = PixelSearch(68,138,1261,571,$LootColor,1,1)
If not(@Error) Then
MouseClick("Left",$Loot[0],$Loot[1],1,1)
Sleep(500)
Else
If @error Then
EndIf
EndIf
EndFunc
Func StartKilling()
$Attack = PixelSearch(68,138,1261,571,$MobColor,1,1)
If not(@Error) Then
MouseClick("Left",$Attack[0],$Attack[1],1,1)
Send("{1}")
Sleep(100)
$Attacking = True
Sleep (10)
While($Attacking)
Send("1")
Sleep(1500)
$isAttacking = PixelSearch(532,122,534,122,0x424242,1,1)
If Not(@Error) Then
Else
If @error Then
$Attacking = False
EndIf
EndIf
WEnd
EndIf
EndFunc
Func StopBot()
MsgBox(0,"Ending","Bot has been Stopped")
Exit
EndFunc
Func NeedHealing()
; Healing your self using Self HealingSpell/Potion ===================
send("{0}")
Sleep(250)
EndFunc
Func OpenChest()
$ChestButton = PixelSearch(996,590,1164,645,0x2A4608,1)
if not(@Error) Then
MouseClick("Left",$ChestButton[0],$ChestButton[1],1,1)
Sleep(100)
Else
If @error Then
EndIf
EndIf
EndFunc
Func GoToArea()
EndFunc
Func GoToArea2()
EndFunc
#Edit1 - Dont ask me why i add "Send("{1}") to my bot :)
Im going to tell u now, cause sometimes i meet agro monsters, and if theyr not selected by mouse click, my charracter wont attack them, thats why i added Send(1) to script ( On "1" Hotkey i got "Auto Attack" Skill ;)