;------------------------------
; Timer
; Restores toggled items like health when warcraft III window is active
;------------------------------
settimer, timer_Warcraft, 1000 ; check every 1 second
timer_Warcraft:
{
ifWinActive, Warcraft III ; restore state once
{
if (BackupHealthBarOnFriendly == True) {
Send, {[ Down}
HealthBarOnFriendly := True
BackupHealthBarOnFriendly := False ; not needed anymore
}
if (BackupHealthBarOnEnemy == True) {
Send, {] Down}
HealthBarOnEnemy := True
BackupHealthBarOnEnemy := False ; not needed anymore
}
} else ifWinNotActive, Warcraft III ; backup state once
{
; temporarily turn off
if (HealthBarOnFriendly == True) {
Send, {[ Up}
BackupHealthBarOnFriendly := True
HealthBarOnFriendly := False ; not needed anymore
}
if (HealthBarOnEnemy == True) {
Send, {] Up}
BackupHealthBarOnEnemy := True
HealthBarOnEnemy := False ; not needed anymore
}
}
}
OnExit, ExitSub
return
;------------------------------
; Health
; [ disables/enables health bar for friendly units
; ] disables/enables health bar for enemy units
;------------------------------
*[::
if (HealthBarOnFriendly == False) {
Send, {[ Down}
HealthBarOnFriendly := True
} else {
Send, {[ Up}
HealthBarOnFriendly := False
}
return