Simple Overlay Timer for a game

Ask gaming related questions (AHK v1.1 and older)
Huncho69
Posts: 2
Joined: 29 Mar 2020, 06:32

Simple Overlay Timer for a game

Post by Huncho69 » 30 Mar 2020, 14:48

Hello everybody!

I need a timer which counts from 30 minutes to 0, which should be shown on a small overlay in a game (GTA: SAMP)

For example, i press f1 for start.

Can someone help me?
Rohwedder
Posts: 7551
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Simple Overlay Timer for a game

Post by Rohwedder » 01 Apr 2020, 10:02

Hallo,
try:

Code: Select all

F1::
Time = 20000101003000
SetTimer, Clock, 1000
Clock:
FormatTime, Clock, %Time%, mm:ss
Time += -1, Seconds
ToolTip, %Clock%, 200, 100
IF Clock = 00:00
	SetTimer, Clock, Off
Return
Romero
Posts: 4
Joined: 02 Jan 2021, 00:09

Re: Simple Overlay Timer for a game

Post by Romero » 10 Jan 2021, 15:34

Hello, good morning mate, sorry for the question, I tried to increase the font size but I couldn't. Gui, Font, s32; Set a large font size (32-point).
Any suggestions, I have no programming knowledge
User avatar
mikeyww
Posts: 26588
Joined: 09 Sep 2014, 18:38

Re: Simple Overlay Timer for a game

Post by mikeyww » 10 Jan 2021, 17:17

Code: Select all

Gui, Font, s32
Gui, Add, Text,, Test
Gui, Show, x40

Gui, New
Gui, Font, s60
Gui, Add, Text,, Test
Gui, Show, x250
Romero
Posts: 4
Joined: 02 Jan 2021, 00:09

Re: Simple Overlay Timer for a game

Post by Romero » 10 Jan 2021, 22:53

Thanks friend but with this code I want the font to be larger, since the window where 30 minutes is shown is very small

Code: Select all

F1::
Time = 20000101003000
SetTimer, Clock, 1000
Clock:
FormatTime, Clock, %Time%, mm:ss
Time += -1, Seconds
ToolTip, %Clock%, 200, 100
IF Clock = 00:00
	SetTimer, Clock, Off
Return
[Mod edit: [code][/code] tags added.]
User avatar
mikeyww
Posts: 26588
Joined: 09 Sep 2014, 18:38

Re: Simple Overlay Timer for a game

Post by mikeyww » 10 Jan 2021, 23:29

Code: Select all

width := 180, time := 20000101003000
Gui -Caption
Gui, Font, s32
Gui, Add, Text, w%width% vtext
Gui, Show, w%width%, Timer
SetTimer, Clock, 1000
Clock:
FormatTime, clock, %time%, mm:ss
time += -1, Seconds
GuiControl,, text, %clock%
If (clock = "00:00")
 SetTimer, Clock, Off
Return
Romero
Posts: 4
Joined: 02 Jan 2021, 00:09

Re: Simple Overlay Timer for a game

Post by Romero » 10 Apr 2021, 22:27

mikeyww wrote:
10 Jan 2021, 23:29

Code: Select all

width := 180, time := 20000101003000
Gui -Caption
Gui, Font, s32
Gui, Add, Text, w%width% vtext
Gui, Show, w%width%, Timer
SetTimer, Clock, 1000
Clock:
FormatTime, clock, %time%, mm:ss
time += -1, Seconds
GuiControl,, text, %clock%
If (clock = "00:00")
 SetTimer, Clock, Off
Return
Compañero una pregunta estoy intentando que lea un archivo, configuracion.ini la posición del tiempo en pantalla y tamaño de letra por ejemplo

Code: Select all

ApplicationName=D:\Tarea
IfNotExist , %ApplicationName%.ini
{
IniWrite , 100, %ApplicationName%.ini, Configuracion, PocicionX
IniWrite , 5, %ApplicationName%.ini, Configuracion, PocicionY
IniWrite , 32, %ApplicationName%.ini, Configuracion, tamaño_letra
}

IniRead , NroMinutos, %ApplicationName%.ini, Configuracion, NroDeMinutos
IniRead , X, %ApplicationName%.ini, Configuracion, PocicionX
IniRead , Y, %ApplicationName%.ini, Configuracion, PocicionY
IniRead , Font, %ApplicationName%.ini, Configuracion, tamaño_letra 


Pero no me funciona cual podría ser el error.
User avatar
mikeyww
Posts: 26588
Joined: 09 Sep 2014, 18:38

Re: Simple Overlay Timer for a game

Post by mikeyww » 11 Apr 2021, 06:18

If you don't write NroMinutos, then you won't be able to read it, but you could set a default value instead.

Explained: IniRead
Post Reply

Return to “Gaming Help (v1)”