97 lines
2.2 KiB
AutoHotkey
97 lines
2.2 KiB
AutoHotkey
#Requires AutoHotkey v2.0
|
|
#SingleInstance Force
|
|
SetTitleMatchMode 2
|
|
CoordMode "Mouse", "Client"
|
|
|
|
; Hotkey to stop the script (Ctrl+Alt+S)
|
|
^!s:: ExitApp
|
|
|
|
; Settings
|
|
targetWindow := "DirtyLeague" ; Window title to look for
|
|
intervalMinutes := 100 ; Execution interval in minutes
|
|
intervalMs := intervalMinutes * 60000 ; Convert to milliseconds
|
|
delayMinutes := 1
|
|
delayMs := delayMinutes * 60000
|
|
|
|
target1_x := 1860
|
|
target1_y := 1250
|
|
|
|
; Initialize variables
|
|
nextRunTime := 0
|
|
remainingTime := 0
|
|
|
|
; Main timer (runs every 100 minutes)
|
|
SetTimer AutoClick, intervalMs
|
|
|
|
; Countdown timer (updates every second)
|
|
SetTimer UpdateCountdown, 1000
|
|
|
|
; Delay timer
|
|
SetTimer () => AutoClick(), -3000 ;-delayMs
|
|
|
|
UpdateCountdown() {
|
|
global nextRunTime, remainingTime
|
|
|
|
if (nextRunTime = 0) {
|
|
ToolTip "Waiting for first run..."
|
|
return
|
|
}
|
|
|
|
remainingTime := nextRunTime - A_TickCount
|
|
|
|
if (remainingTime <= 0) {
|
|
ToolTip "Running now..."
|
|
return
|
|
}
|
|
|
|
; Convert milliseconds to minutes:seconds
|
|
remainingMinutes := Floor(remainingTime / 60000)
|
|
remainingSeconds := Mod(Floor(remainingTime / 1000), 60)
|
|
|
|
; Display countdown
|
|
ToolTip "Next run in: " remainingMinutes "m " remainingSeconds "s", 10, 10
|
|
}
|
|
|
|
AutoClick() {
|
|
global nextRunTime, intervalMs
|
|
|
|
; Set next scheduled run time
|
|
nextRunTime := A_TickCount + intervalMs
|
|
|
|
ToolTip "STARTING...", 10, 10
|
|
SetTimer () => ToolTip(), -2000
|
|
|
|
; Activate the window
|
|
if WinExist(targetWindow) {
|
|
WinActivate
|
|
WinWaitActive
|
|
} else {
|
|
ToolTip "ERROR: Window not found", 10, 10
|
|
SetTimer () => ToolTip(), -2000
|
|
return
|
|
}
|
|
|
|
; Perform click sequence with feedback
|
|
ToolTip "Clicking opponent...", 10, 10
|
|
MouseMove target1_x, target1_y
|
|
Click
|
|
Sleep 4000
|
|
|
|
ToolTip "Starting battle...", 10, 10
|
|
MouseMove 1945, 1780
|
|
Click
|
|
Sleep 30000
|
|
|
|
ToolTip "Closing results...", 10, 10
|
|
MouseMove 980, 1630
|
|
Click
|
|
Sleep 4000
|
|
|
|
ToolTip "Closing shop...", 10, 10
|
|
MouseMove 3700, 120
|
|
Click
|
|
Sleep 4000
|
|
|
|
ToolTip "Cycle complete!", 10, 10
|
|
SetTimer () => ToolTip(), -2000
|
|
} |