I am looking to get some help on creating a timer which will be used as an indicator as to how much air someone would have left on their air set (fire fighting).
Below is a brief idea of what I am looking to accomplish, however I am not sure how to display time remaining. Eg I can do minutes for example.

When the guys enter we say they have 20 minutes of air. To be fair its more like 30 minutes but we work on 20 minutes to play it safe.
When it gets to the 10 minute mark we announce they have 10 minutes of air remaining, same for 5 minutes left, 2 minutes left & their time out. Now they also have an extra 2 minutes & another extra 2 meaning they have upto 24 minutes.
What I am wanting is multiple progress bars to show the time remaining on each count. I think I have that with the attached code, very messy was thrown together pretty quick, however I can't for the life of me work out how to display the time remain on each call in minutes and seconds.
Eg for the 10 minute call there is 2 minutes and 10 seconds before I need to announce 10 minutes remaining. Once the script is working I will look at including sounds and voices as well. But the main part is the visual indicators first.
If anyone can assist that would be appreciated.
Code: Select all
Let>APP_TITLE=SACFS ECO Timer
Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1
GetTime>now
TimeAdd>now,M,10,10mincal
TimeAdd>now,M,15,15mincal
TimeAdd>now,M,18,18mincal
TimeAdd>now,M,20,20mincal
TimeAdd>now,M,22,22mincal
TimeAdd>now,M,24,24mincal
MDL>10 Minutes Remaining: %10mincal%%CRLF%05 Minutes Remaining: %15mincal%%CRLF%02 Minutes Remaining: %18mincal%%CRLF%Time Out: %20mincal%%CRLF%Extra Two Minutes: %22mincal%%CRLF%Extra Two Minutes x2: %24mincal%
GetTime>now
TimeDiff>now,10mincal,S,numberMins
TimeDiff>now,15mincal,S,15numberMins
//MDL>%numberMins%
Dialog>Dialog1
object Dialog1: TForm
Left = 247
Top = 96
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 256
ClientWidth = 314
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 8
Width = 296
Height = 13
Caption = 'SACFS Compartment Fire Behaviour Entry Control Officer Timer'
end
object Label2: TLabel
Left = 8
Top = 32
Width = 72
Height = 13
Caption = '10 Minutes Call'
end
object Label3: TLabel
Left = 160
Top = 32
Width = 90
Height = 13
Caption = 'Minutes Remaining'
end
object Label4: TLabel
Left = 8
Top = 96
Width = 66
Height = 13
Caption = '5 Minutes Call'
end
object Label5: TLabel
Left = 160
Top = 96
Width = 90
Height = 13
Caption = 'Minutes Remaining'
end
object Edit1: TEdit
Left = 8
Top = 48
Width = 145
Height = 21
Enabled = False
TabOrder = 0
Text = 'Edit1'
end
object MSButton1: tMSButton
Left = 8
Top = 224
Width = 107
Height = 25
Caption = 'Start'
TabOrder = 1
DoBrowse = False
BrowseStyle = fbOpen
end
object MSButton2: tMSButton
Left = 200
Top = 224
Width = 107
Height = 25
Caption = 'Exit'
ModalResult = 2
TabOrder = 2
DoBrowse = False
BrowseStyle = fbOpen
end
object ProgressBar1: TProgressBar
Left = 8
Top = 72
Width = 297
Height = 17
Max = 600
Smooth = True
MarqueeInterval = 0
SmoothReverse = True
Step = 1
TabOrder = 3
end
object Edit2: TEdit
Left = 160
Top = 48
Width = 145
Height = 21
Enabled = False
TabOrder = 4
Text = 'Edit2'
end
object Edit3: TEdit
Left = 8
Top = 112
Width = 145
Height = 21
Enabled = False
TabOrder = 5
Text = 'Edit3'
end
object Edit4: TEdit
Left = 160
Top = 112
Width = 145
Height = 21
Enabled = False
TabOrder = 6
Text = 'Edit4'
end
object ProgressBar2: TProgressBar
Left = 8
Top = 136
Width = 297
Height = 17
Max = 900
MarqueeInterval = 0
TabOrder = 7
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,MSButton2,OnClick,Exit
AddDialogHandler>Dialog1,MSButton1,OnClick,Start
SetDialogProperty>Dialog1,ProgressBar1,Position,0
SetDialogProperty>Dialog1,ProgressBar2,Position,0
SetDialogProperty>Dialog1,Edit1,Text,%10mincal%
SetDialogProperty>Dialog1,Edit2,Text,10
SetDialogProperty>Dialog1,Edit3,Text,%15mincal%
SetDialogProperty>Dialog1,Edit4,Text,15
Show>Dialog1,Dialog1Result
SRT>Start
Label>D1Start
GetTime>now
TimeDiff>10mincal,now,S,10minSec
TimeDiff>10mincal,now,M,10minMin
TimeDiff>15mincal,now,S,15minSec
TimeDiff>15mincal,now,M,15minMin
Let>Possie10=600-%10minSec%
Let>Possie15=900-%15minSec%
SetDialogProperty>Dialog1,ProgressBar1,Position,%Possie10%
SetDialogProperty>Dialog1,Edit2,Text,%10minMin%
SetDialogProperty>Dialog1,ProgressBar2,Position,%Possie15%
SetDialogProperty>Dialog1,Edit4,Text,%15minMin%
If>%Possie%>600
Goto>Exit
Else
Endif
Wait>1
Goto>D1Start
END>Start
SRT>Exit
Exit>0
END>Exit
Label>Exit