#Persistent
#NoEnv
SetBatchLines, -1
Gui, Color, White
Gui, Font, S12, Verdana
; Timer 1
Gui, Add, Text, x10 y0 w150 Center vTimer1Text, 02:00 Время до свапа локи
Gui, Add, Button, x10 y40 w150 gStartTimer1, Start Timer 1
Gui, Add, Button, x10 y80 w150 gResumeTimer1, Resume Timer 1
Gui, Add, Button, x10 y120 w150 gStopTimer1, Stop Timer 1
Gui, Add, Button, x10 y160 w150 gResetTimer1, Reset Timer 1
; Timer 2
Gui, Add, Text, x170 y0 w150 Center vTimer2Text, 05:00 Время до свапа зоны
Gui, Add, Button, x170 y40 w150 gStartTimer2, Start Timer 2
Gui, Add, Button, x170 y80 w150 gResumeTimer2, Resume Timer 2
Gui, Add, Button, x170 y120 w150 gStopTimer2, Stop Timer 2
Gui, Add, Button, x170 y160 w150 gResetTimer2, Reset Timer 2
; Timer 3
Gui, Add, Text, x330 y0 w150 Center vTimer3Text, 01:00 Контроль трупов
Gui, Add, Button, x330 y60 w150 gStartTimer3, Start Timer 3
Gui, Add, Button, x330 y100 w150 gStopTimer3, Stop Timer 3
Gui, Add, Button, x330 y140 w150 gResetTimer3, Reset Timer 3
Gui, +AlwaysOnTop +ToolWindow -Caption +Border
Gui, Show, AutoSize x1280 y0
; Set transparency to 50% after showing the GUI
WinSet, Transparent, 128, ahk_class AutoHotkeyGUI
; Set the countdown durations
DefaultTimer1Seconds := 2 * 60
DefaultTimer2Seconds := 5 * 60
DefaultTimer3Seconds := 1 * 60
Timer1Seconds := DefaultTimer1Seconds
Timer2Seconds := DefaultTimer2Seconds
Timer3Seconds := DefaultTimer3Seconds
; Flags to control the timers
Timer1Running := false
Timer2Running := false
Timer3Running := false
; Ensure timers are off initially
SetTimer, UpdateTimer1, Off
SetTimer, UpdateTimer2, Off
SetTimer, UpdateTimer3, Off
; Set a timer to call ResetTimer1 after 1 second
SetTimer, AutoResetTimer1, -1000
return
StartTimer1:
; Start Timer 1 if it's not running
if (!Timer1Running) {
SetTimer, UpdateTimer1, 1000
Timer1Running := true
WinActivate, Majestic RP
SendInput, {T}
Sleep, 500
A_Min1 := A_Min + 02
FormattedTime01 := Format("{:02}:{:02}:{:02}", A_Hour, A_Min, A_Sec)
FormattedTime011 := Format("{:02}:{:02}:{:02}", A_Hour, A_Min1, A_Sec)
SendInput, /cb Вы заняли локацию в %FormattedTime01%, смена локации в %FormattedTime011%
}
Return
StopTimer1:
; Stop Timer 1 if it's running
if (Timer1Running) {
SetTimer, UpdateTimer1, Off
Timer1Running := false
WinActivate, Majestic RP
SendInput, {T}
Sleep, 500
SendInput, /cb Таймер приостановлен, оставшееся время в локации %FormattedTime1%
}
Return
ResumeTimer1:
if (!Timer1Running) {
SetTimer, UpdateTimer1, 1000
Timer1Running := true
WinActivate, Majestic RP
SendInput, {T}
Sleep, 500
A_Min1 := A_Min + Minutes1
A_Sec1 := A_Sec + Seconds1
FormattedTime0111 := Format("{:02}:{:02}:{:02}", A_Hour, A_Min1, A_Sec1)
SendInput, /cb Таймер возобновлён, смена локации в %FormattedTime0111%
}
Return
StartTimer2:
; Start Timer 2 if it's not running
if (!Timer2Running) {
SetTimer, UpdateTimer2, 1000
Timer2Running := true
WinActivate, Majestic RP
SendInput, {T}
Sleep, 500
A_Min1 := A_Min + 05
FormattedTime02 := Format("{:02}:{:02}:{:02}", A_Hour, A_Min, A_Sec)
FormattedTime022 := Format("{:02}:{:02}:{:02}", A_Hour, A_Min1, A_Sec)
SendInput, /cb Вы заняли зону в %FormattedTime02%, смена зоны в %FormattedTime022% {Left 39}
}
Return
StopTimer2:
; Stop Timer 2 if it's running
if (Timer2Running) {
SetTimer, UpdateTimer2, Off
Timer2Running := false
WinActivate, Majestic RP
SendInput, {T}
Sleep, 500
SendInput, /cb Таймер приостановлен, оставшееся время в зоне %FormattedTime2%
}
Return
ResumeTimer2:
if (!Timer2Running) {
SetTimer, UpdateTimer2, 1000
Timer2Running := true
WinActivate, Majestic RP
SendInput, {T}
Sleep, 500
A_Min1 := A_Min + Minutes2
A_Sec1 := A_Sec + Seconds2
FormattedTime0222 := Format("{:02}:{:02}:{:02}", A_Hour, A_Min1, A_Sec1)
SendInput, /cb Таймер возобновлён, смена зоны в %FormattedTime0222%
}
Return
StartTimer3:
; Start Timer 3 if it's not running
if (!Timer3Running) {
SetTimer, UpdateTimer3, 1000
Timer3Running := true
}
Return
StopTimer3:
; Stop Timer 3 if it's running
if (Timer3Running) {
SetTimer, UpdateTimer3, Off
Timer3Running := false
}
Return
ResetTimer1:
; Reset Timer 1 to its default duration
Timer1Seconds := DefaultTimer1Seconds
Minutes1 := Floor(Timer1Seconds / 60)
Seconds1 := Mod(Timer1Seconds, 60)
FormattedTime1 := Format("{:02}:{:02}", Minutes1, Seconds1)
GuiControl,, Timer1Text, %FormattedTime1% Время до свапа локи
; Stop the timer if it's running
if (Timer1Running) {
SetTimer, UpdateTimer1, Off
Timer1Running := false
}
Return
ResetTimer2:
; Reset Timer 2 to its default duration
Timer2Seconds := DefaultTimer2Seconds
Minutes2 := Floor(Timer2Seconds / 60)
Seconds2 := Mod(Timer2Seconds, 60)
FormattedTime2 := Format("{:02}:{:02}", Minutes2, Seconds2)
GuiControl,, Timer2Text, %FormattedTime2% Время до свапа зоны
; Stop the timer if it's running
if (Timer2Running) {
SetTimer, UpdateTimer2, Off
Timer2Running := false
}
Return
ResetTimer3:
; Reset Timer 3 to its default duration
Timer3Seconds := DefaultTimer3Seconds
Minutes3 := Floor(Timer3Seconds / 60)
Seconds3 := Mod(Timer3Seconds, 60)
FormattedTime3 := Format("{:02}:{:02}", Minutes3, Seconds3)
GuiControl,, Timer3Text, %FormattedTime3% Контроль трупов
; Stop the timer if it's running
if (Timer3Running) {
SetTimer, UpdateTimer3, Off
Timer3Running := false
}
Return
UpdateTimer1:
; Update Timer1
if (Timer1Running && Timer1Seconds > 0) {
Timer1Seconds -= 1
Minutes1 := Floor(Timer1Seconds / 60)
Seconds1 := Mod(Timer1Seconds, 60)
FormattedTime1 := Format("{:02}:{:02}", Minutes1, Seconds1)
GuiControl,, Timer1Text, %FormattedTime1% Время до свапа локи
} else if (Timer1Seconds <= 0 && Timer1Running) {
GuiControl,, Timer1Text, Time's up! Время свапа локи
SetTimer, UpdateTimer1, Off
Timer1Running := false
}
Return
UpdateTimer2:
; Update Timer2
if (Timer2Running && Timer2Seconds > 0) {
Timer2Seconds -= 1
Minutes2 := Floor(Timer2Seconds / 60)
Seconds2 := Mod(Timer2Seconds, 60)
FormattedTime2 := Format("{:02}:{:02}", Minutes2, Seconds2)
GuiControl,, Timer2Text, %FormattedTime2% Время до свапа зоны
} else if (Timer2Seconds <= 0 && Timer2Running) {
GuiControl,, Timer2Text, Time's up! Время свапа зоны
SetTimer, UpdateTimer2, Off
Timer2Running := false
}
Return
UpdateTimer3:
; Update Timer3
if (Timer3Running && Timer3Seconds > 0) {
Timer3Seconds -= 1
Minutes3 := Floor(Timer3Seconds / 60)
Seconds3 := Mod(Timer3Seconds, 60)
FormattedTime3 := Format("{:02}:{:02}", Minutes3, Seconds3)
GuiControl,, Timer3Text, %FormattedTime3% Вспомогательный таймер`nконтроль трупов
} else if (Timer3Seconds <= 0 && Timer3Running) {
GuiControl,, Timer3Text, Time's up! Вспомогательный таймер`nконтроль трупов
SetTimer, UpdateTimer3, Off
Timer3Running := false
}
Return
AutoResetTimer1:
; Automatically reset Timer 1 after 1 second
Gosub, ResetTimer1
Return