Help - Custom Cooldown Timer

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DarkKitten
Posts: 42
Joined: 10 Mar 2016, 00:20

Help - Custom Cooldown Timer

Post by DarkKitten » 27 Jun 2022, 01:05

Trying to work on a custom cooldown timer that will trigger when I press a hotkey but it's in the very early stages and I am having a lot of trouble figuring out where to go next with this.

The idea is to have a picture icon and a small timer under it that will countdown from say 8 seconds, and I'd like the timer to not reset until it reaches 0, currently it will reset anytime the hotkey is pressed even if it's in the middle of cooldown.

Eventually I'd like to add around 5 icons/timers but right now I'm starting with 1 until I figure things out more.

Some questions I have/things I'd like to do with this:

How do I make the icon transparent? setting transparency doesn't seem to work.

How do I remove the gray bar where the timer is located? Ideally I'd love to have say a green colored bold timer with the numbers slightly bigger, and for the numbers to just be sitting there under the icon without the gray gui/boarder/whatever that is.

How do I edit the timer to include Milliseconds? I don't really need the HH:MM:SS Format, mainly I need MM:SS.MS or even SS.MS

How do I make it click-through? I thought +E0x20 was the correct setting but it doesn't appear to be working for me.


Thanks very much! If anyone can help me out with this I'd very much appreciate it a lot!

Code: Select all

#SingleInstance Force








;-------------------------------------------------------------------------------------------------------------------------------
TimerXY		=	x0 y100 w50
;-------------------------------------------------------------------------------------------------------------------------------
FormatSeconds(NumberOfSeconds)  ;Convert the specified number of seconds to hh:mm:ss format.
{
   hours := Format("{:02}", NumberOfSeconds//3600)
   ts := 1601
   ts += NumberOfSeconds, s
   FormatTime, var, % ts, %hours%:mm:ss
   Return var
}
;-------------------------------------------------------------------------------------------------------------------------------




TransColor = 0xdddddd
WinSet, Transparent, 100

Gui, 1:Color, %TransColor%
Gui, 1:+E0x20 -Caption +LastFound +ToolWindow +AlwaysOnTop
Gui, 1: Add, Picture, x0 y0 w100 h100 +BackgroundTrans, 13093614.png
Gui, 1:Font, s9, Comic Sans MS
Gui, 1:Show, x900 y900 w100 h115, Wyverns
Gui, 1:Add, Text, %TimerXY% vTimer, -
Return









;=============================================================================================================================================================================================
;Timer
5::
Settimer, TimerCD, 1000
TimerVar := 8

TimerCD: 
{
TimerVar--
GuiControl,, Timer, % FormatSeconds(TimerVar)
}

if TimerVar = 0
{
    settimer, TimerCD, off
	GuiControl,, Timer, -
}
Return
;=============================================================================================================================================================================================



F1::Exitapp

Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help - Custom Cooldown Timer

Post by Rohwedder » 27 Jun 2022, 03:44

Hallo,
a little closer to the finish:

Code: Select all

; https://www.autohotkey.com/boards/viewtopic.php?f=76&t=105812
#SingleInstance Force
;-------------------------------------------------------------------------------------------------------------------------------
TimerXY		=	x0 y100 w60 h27
TransColor = 0xdddddd
Gui, 1:Color, %TransColor%
Gui, 1:+E0x20 -Caption +LastFound +ToolWindow +AlwaysOnTop
Gui, 1:Add, Picture, x0 y0 w100 h100, 13093614.png
Gui, 1:Add, Progress, %TimerXY% BackgroundWhite:
Gui, 1:Font, s15 cGreen bold, Comic Sans MS
Gui, 1:Add, Text, xp yp wp BackgroundTrans vTimer, -
Gui, 1:Show, x900 y900 w100 h130, Wyverns
WinSet, TransColor, %TransColor% 255, Wyverns
WinSet, ExStyle, ^0x20

Return
;=============================================================================================================================================================================================
;Timer
5::
Settimer, TimerCD, 50
TimerVar := 8 + A_TickCount/1000
TimerCD: ;
	GuiControl,, Timer,% StrReplace(Format("{:05.2f}", Max(0, Var := TimerVar - A_TickCount/1000)),".",":")
if Var <= 0
{
	settimer, TimerCD, off
	GuiControl,, Timer, -
}
Return
;=============================================================================================================================================================================================
F1::Exitapp

DarkKitten
Posts: 42
Joined: 10 Mar 2016, 00:20

Re: Help - Custom Cooldown Timer

Post by DarkKitten » 27 Jun 2022, 10:39

Thanks! That is a lot of improvements and much better then I expected, things are really on the right track now!

For some reason the click-through function still doesn't seem to work for me though, any ideas what could be preventing the click-through for me? Everything else looks great, I appreciate it!

I have a small feeling it may have to do with my .png file somehow but I'm not positive.

Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help - Custom Cooldown Timer

Post by Rohwedder » 27 Jun 2022, 10:49

Replace

Code: Select all

Gui, 1:+E0x20 -Caption +LastFound +ToolWindow +AlwaysOnTop
by

Code: Select all

Gui, 1:-Caption +LastFound +ToolWindow +AlwaysOnTop

Post Reply

Return to “Ask for Help (v1)”