It is currently April 16th, 2024, 11:05 pm

Simple countdown timer

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

Re: Simple countdown timer

Post by sl23 »

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 -
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Simple countdown timer

Post by death.crafter »

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
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Simple countdown timer

Post by jsmorley »

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.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Simple countdown timer

Post by death.crafter »

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
User avatar
balala
Rainmeter Sage
Posts: 16142
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Simple countdown timer

Post by balala »

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.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Simple countdown timer

Post by death.crafter »

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
User avatar
balala
Rainmeter Sage
Posts: 16142
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Simple countdown timer

Post by balala »

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.
:thumbup:
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

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 -
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Simple countdown timer

Post by eclectic-tech »

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#)
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

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

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