Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GUIConstantsEx.au3>
- Global $mainWindow, $optionCheckbox[7], $isRunning = False
- $mainWindow = GUICreate("AutoIt Automation", 300, 300)
- $optionCheckbox[0] = GUICtrlCreateCheckbox("Clicking", 10, 100, 100, 20)
- $optionCheckbox[1] = GUICtrlCreateCheckbox("Skills", 10, 130, 100, 20)
- $optionCheckbox[2] = GUICtrlCreateCheckbox("Auto Heal", 10, 160, 100, 20)
- $optionCheckbox[3] = GUICtrlCreateCheckbox("Camera Turning", 10, 190, 120, 20)
- $optionCheckbox[4] = GUICtrlCreateCheckbox("Target Closest", 10, 220, 100, 20)
- $optionCheckbox[5] = GUICtrlCreateCheckbox("Pickup Items", 10, 250, 100, 20)
- ;;$optionCheckbox[6] = GUICtrlCreateCheckbox("HP Bar", 10, 280, 100, 20)
- ;;$optionCheckbox[7] = GUICtrlCreateCheckbox("HP Count", 10, 310, 100, 20)
- $btnStart = GUICtrlCreateButton("Start", 10, 220, 100, 30)
- $btnStop = GUICtrlCreateButton("Stop", 120, 220, 100, 30)
- $btnExit = GUICtrlCreateButton("Exit", 230, 220, 60, 30)
- HotKeySet("{End}", "PanicButton") ; Set the "end" key as the panic button
- ; Adjusted pixel search logic
- $color = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x5A2568, 40)
- If IsArray($color) Then
- MouseClick("left 4", $color[0], $color[1])
- Sleep(100) ; Add a delay after the click
- EndIf
- GUISetState(@SW_SHOW)
- While 1
- Switch GUIGetMsg()
- Case $GUI_EVENT_CLOSE, $btnExit
- Exit
- Case $btnStart
- If Not _IsChecked($optionCheckbox) Then
- MsgBox(48, "Error", "Please select at least one option.")
- Else
- $isRunning = True
- StartAutomation()
- EndIf
- Case $btnStop
- $isRunning = False
- MsgBox(64, "Stop", "Stopping automation.")
- ; Add logic to stop automation tasks
- EndSwitch
- WEnd
- Func _IsChecked($checkboxArray)
- For $i = 0 To UBound($checkboxArray) - 1
- If GUICtrlRead($checkboxArray[$i]) = $GUI_CHECKED Then Return True
- Next
- Return False
- EndFunc
- Func StartAutomation()
- Local $appWindow, $coords, $result
- $appWindow = WinGetHandle("AsdaGlobal")
- If $appWindow = 0 Then
- MsgBox(16, "Error", "Failed to find the target application window.")
- Return
- EndIf
- While $isRunning
- =If GUICtrlRead($optionCheckbox[0]) = $GUI_CHECKED Then
- ; Clicking option selected
- $coords = PixelSearch(1110, 642, 360, 110, 0x5A2568, 40)
- If Not @error Then
- MouseClick("left", $coords[0], $coords[1], 2, 1)
- Sleep(700)
- Else
- ; Turn camera 45 degrees
- MouseMove(590, 420)
- MouseDown("right")
- MouseMove(690, 420)
- MouseUp("right")
- EndIf
- ; Adjusted pixel search logic
- $color = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0xB3111E, 40)
- If IsArray($color) Then
- MouseClick("left 2", $color[0], $color[1])
- Sleep(100) ; Add a delay after the click
- EndIf
- If GUICtrlRead($optionCheckbox[1]) = $GUI_CHECKED Then
- ; Skills option selected
- Send("1")
- Sleep(100)
- Send("3")
- Sleep(100)
- Send("1")
- Sleep(100)
- Send("3")
- Sleep(100)
- EndIf
- If GUICtrlRead($optionCheckbox[2]) = $GUI_CHECKED Then
- ; Auto Heal option selected
- $result = PixelSearch($200, $60, $270, $70, "3500", $tolerance) ; Replace with actual coordinates and number
- If Not @error Then
- ; Found the target number within the specified area
- Send("{F1}") ; Activate F1 key for auto heal
- Sleep(1000)
- EndIf
- EndIf
- If GUICtrlRead($optionCheckbox[3]) = $GUI_CHECKED Then
- ; Camera Turning option selected
- MouseMove(590, 420) ; Move to the first set of coordinates
- Sleep(50) ; Wait for the mouse to move
- MouseMove(690, 420) ; Move to the second set of coordinates
- Sleep(50) ; Wait for the mouse to move
- EndIf
- If GUICtrlRead($optionCheckbox[4]) = $GUI_CHECKED Then
- ; Target Closest option selected
- Send("{TAB 5}") ; Presses the Tab key 5 times.
- Sleep(100)
- EndIf
- Sleep(100) ; Add a delay between iterations to prevent excessive CPU usage
- WEnd
- If GUICtrlRead($optionCheckbox[5]) = $GUI_CHECKED Then
- PickupStuff($times)
- For $i = 1 To Random(1, 15) ; Send "2" a random number of times between 1 and 15
- Send("2")
- Sleep(Random(100, 300)) ; Add a random sleep after each keypress
- Next
- EndIf
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement