It is currently April 25th, 2024, 4:50 am

Timer based on variables

Get help with creating, editing & fixing problems with skins
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Timer based on variables

Post by JpsCrazy »

I'm trying to create a timer that has a pause option.

As of now, I have:

Code: Select all

[msTimeTaken]
Measure=Calc
Formula=[msTimeTaken]+1
DynamicVariables=1

[mtTimeTaken]
Meter=String
MeasureName=msTimeTaken
Text=%1 Seconds
X=55
Y=20R
LeftMouseUpAction=!RainmeterDisableMeasure msTimeTaken
As you could guess, the timer resets to zero when paused.
I was thinking I could have a variable substituted for [msTimeTaken]+1 such as #TimeTaken#+1 but it never gets higher than one. Why is that?
If it did work how I hoped it would, when you disabled the measure, #TimeTaken# would still be at whatever number it was on, but the measure would stop adding one.

Also tried:

Code: Select all

[msTime]
Measure=Calc
Formula=#Time#+1
DynamicVariables=1

[mtTime]
Meter=String
Text=#Time#
SolidColor=00000001
DynamicVariables=1

Code: Select all

[msTime]
Measure=Calc
Formula=#Time#+1
DynamicVariables=1
IfAboveValue=0
IfAboveAction=!Execute [!RainmeterSetVariable Time [msTime]]
IfBelowValue=0
IfBelowAction=!RainmeterSetVariable Time [msTime]

[mtTime]
Meter=String
Text=#Time#
SolidColor=00000001
DynamicVariables=1
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Timer based on variables

Post by Alex2539 »

Try this:

Code: Select all

[Rainmeter]
Update=100

[Variables]
Pause=0

[Timer]
Measure=Calc
Formula=Timer+(#Pause#?0:1)
DynamicVariables=1

[Seconds]
Measure=Calc
Formula=[Timer]/10
DynamicVariables=1

[String]
Meter=String
MeasureName=Seconds
X=75
NumOfDecimals=1
FontSize=14
StringAlign=CENTER
FontColor=FFFFFF
SolidColor=000000
W=150
H=25
AntiAlias=1

[Start]
Meter=String
SolidColor=50,200,30
W=75
H=15
Text=START
FontColor=FFFFFF
StringAlign=CENTER
X=37
Y=25
Antialias=1
LeftMouseUpAction=!RainmeterSetVariable Pause 0

[STOP]
Meter=String
SolidColor=200,20,30
W=75
H=15
Text=STOP
FontColor=FFFFFF
StringAlign=CENTER
X=112
Y=25
Antialias=1
LeftMouseUpAction=!RainmeterSetVariable Pause 1
ImageImageImageImage
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Timer based on variables

Post by JpsCrazy »

Works beautifully. Thanks!
Never would've considered making a condition like that...
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Timer based on variables

Post by Alex2539 »

Pro Tip: Conditional statements are f***ing magic.
ImageImageImageImage
looklookis
Posts: 16
Joined: September 4th, 2009, 11:39 am

Re: Timer based on variables

Post by looklookis »

Please forgive me my English is poor , previously asked similar questions , get answers here , I used the dynamic production of the skin , is to open a folder.

[youtube]http://www.youtube.com/watch?v=oSPLZfJVumM[/youtube]