It is currently August 5th, 2024, 4:23 pm

## Simple countdown timer

Get help with creating, editing & fixing problems with skins
sl23
Posts: 1463
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

### Re: Simple countdown timer

As more of a visual aid, I thought about adding a Roundline meter for the countdown. But in order to get the code correct, I first attempted a normal Bar meter, but that's not working out either!

Here's the relevant code...

Code: Select all

[mTotalSeconds]
Measure=Calc
Formula=(#TimerHours# * 3600) + (#TimerMinutes# * 60) + #TimerSeconds#
UpdateDivider=-1
Disabled=1
Group=Timers

[TimerBar]
Meter=Bar
MeasureName=mTotalSeconds
BarColor=235,170,0,255
BarOrientation=Horizontal
SolidColor=255,255,255,60
;Flip=1
X=r
Y=12R
W=150
H=2
Am I on the right track?
- MuLab -
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

### Re: Simple countdown timer

sl23 wrote: July 22nd, 2021, 5:40 pm As more of a visual aid, I thought about adding a Roundline meter for the countdown. But in order to get the code correct, I first attempted a normal Bar meter, but that's not working out either!

Here's the relevant code...

Code: Select all

[mTotalSeconds]
Measure=Calc
Formula=(#TimerHours# * 3600) + (#TimerMinutes# * 60) + #TimerSeconds#
UpdateDivider=-1
Disabled=1
Group=Timers

[TimerBar]
Meter=Bar
MeasureName=mTotalSeconds
BarColor=235,170,0,255
BarOrientation=Horizontal
SolidColor=255,255,255,60
;Flip=1
X=r
Y=12R
W=150
H=2
Am I on the right track?
Unfortunately you are not.

Bar or Roundline need a percentual value. So in measure calc divide the value by total time and multiply by 100.
from the Realm of Death
jsmorley
Developer
Posts: 22654
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

### Re: Simple countdown timer

death.crafter wrote: July 22nd, 2021, 5:54 pm Unfortunately you are not.

Bar or Roundline need a percentual value. So in measure calc divide the value by total time and multiply by 100.
Or simply set MinValue and MaxValue on a measure in order to enable Rainmeter to see the value as a percentage.
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

### Re: Simple countdown timer

jsmorley wrote: July 22nd, 2021, 5:59 pm Or simply set MinValue and MaxValue on a measure in order to enable Rainmeter to see the value as a percentage.
It works this way... I wasted 2 years of my life converting values to percent

Thanks for letting me know.
from the Realm of Death
balala
Rainmeter Sage
Posts: 16437
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

### Re: Simple countdown timer

death.crafter wrote: July 22nd, 2021, 5:54 pm So in measure calc divide the value by total time and multiply by 100.
No, in fact this in this way doesn't work. With such a measure the Bar meter is filled up always. This is caused by the fact that, as even yourself said, the Bar meter needs a percentual value, which, as jsmorley posted, is returned by setting the proper MinValue and MaxValue options on the measure. If you don't set such MinValue and MaxValue options, Rainmeter, as usually, uses the default value for these options. This are 0 for MinValue and 1 for MaxValue. Accordingly on the second measure (which divides the value by total time and multiplies it by 100), the MaxValue is set to 1 (by default), but the values returned by the measure are going from 0 to 100. Excepting the case when the value which has to be shown in the Bar meter is 0, practically on any other cases the value returned by the measure exceds the MaxValue (1) and accordingly the Bar meter is filled up entirely.
As you probably figured out from now, setting the appropriate MinValue and MaxValue is the proper procedure to get the Bar meter working it has. Even if you don't set them, their default values are still used. An eventual solution as you described would be not to multiply the result of division by 100.
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

### Re: Simple countdown timer

balala wrote: July 22nd, 2021, 7:01 pm No, in fact this in this way doesn't work. With such a measure the Bar meter is filled up always. This is caused by the fact that, as even yourself said, the Bar meter needs a percentual value, which, as jsmorley posted, is returned by setting the proper MinValue and MaxValue options on the measure. If you don't set such MinValue and MaxValue options, Rainmeter, as usually, uses the default value for these options. This are 0 for MinValue and 1 for MaxValue. Accordingly on the second measure (which divides the value by total time and multiplies it by 100), the MaxValue is set to 1 (by default), but the values returned by the measure are going from 0 to 100. Excepting the case when the value which has to be shown in the Bar meter is 0, practically on any other cases the value returned by the measure exceds the MaxValue (1) and accordingly the Bar meter is filled up entirely.
As you probably figured out from now, setting the appropriate MinValue and MaxValue is the proper procedure to get the Bar meter working it has. Even if you don't set them, their default values are still used. An eventual solution as you described would be not to multiply the result of division by 100.
Ohh I see. I use shapes for bar and arc for roundline so never noticed. Thanks for letting me know.
from the Realm of Death
balala
Rainmeter Sage
Posts: 16437
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

### Re: Simple countdown timer

death.crafter wrote: July 22nd, 2021, 7:26 pm Ohh I see. I use shapes for bar and arc for roundline so never noticed. Thanks for letting me know.
sl23
Posts: 1463
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

### Re: Simple countdown timer

jsmorley wrote: July 22nd, 2021, 5:59 pm Or simply set MinValue and MaxValue on a measure in order to enable Rainmeter to see the value as a percentage.
Thanks for your replies. So the MaxValue would be total number of seconds in this case?
- MuLab -
eclectic-tech
Rainmeter Sage
Posts: 5453
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

### Re: Simple countdown timer

sl23 wrote: July 22nd, 2021, 8:29 pm Thanks for your replies. So the MaxValue would be total number of seconds in this case?
Yes.

Code: Select all

[mTotalSeconds]
Measure=Calc
Formula=(#TimerHours# * 3600) + (#TimerMinutes# * 60) + #TimerSeconds#
UpdateDivider=-1
Disabled=1
Group=Timers
MinValue=0
MaxValue=((#TimerHours# * 3600) + (#TimerMinutes# * 60) + #TimerSeconds#)

sl23
Posts: 1463
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

### Re: Simple countdown timer

Ahh! I was literally putting the value in seconds rather than the formula.

Unfortunately this doesn't seem to work.
- MuLab -