It is currently May 4th, 2024, 1:28 am

Variable Updating

Get help with creating, editing & fixing problems with skins
NewWave
Posts: 23
Joined: April 15th, 2012, 5:39 am

Variable Updating

Post by NewWave »

Code: Select all

[Rainmeter]
Update=1000

[Day]
Measure=Time
Format=%d
IfAboveValue=0
IfAboveAction=!SetVariable Day [Day]

[Meter]
Meter=String
Text=[Day] - #Day#
FontSize=20
FontColor=255,0,0
DynamicVariables=1
The [measure] updates every second. Why does the #Variable# require a refresh?
prince1142003
Posts: 56
Joined: December 27th, 2011, 12:32 pm

Re: Variable Updating

Post by prince1142003 »

Because the IfActions are only fired once. In your case, the action fires on the first refresh because [Day] is greater than 0. During all updates afterwards, [Day] is still greater than 0, and therefore the IfAboveAction doesn't fire.

I'm not entirely sure what you're trying to achieve here though.
NewWave
Posts: 23
Joined: April 15th, 2012, 5:39 am

Re: Variable Updating

Post by NewWave »

:oops: Sorry, I remember reading that about IfActions, it just wasn't clicking with me.

I have some Meters that need to update when the day changes, either naturally or based on some user actions. I had been using two Measures to set the initial/default value:

Code: Select all

[preMeasureDay]
Measure=Time
Format=%d

[MeasureDay]
Measure=Calc
Formula=preMeasureDay
I could then, upon a user's action, adjust the value using "!SetOption MeasureDay Formula ..."

So I was just exploring to see if I could do it with Variables and !SetVariable instead of Measures.

Anywho, thanks for the help. :)
prince1142003
Posts: 56
Joined: December 27th, 2011, 12:32 pm

Re: Variable Updating

Post by prince1142003 »

I think your original idea can work, you just need to modify the formula slightly.

Code: Select all

[Variables]
Day=0

[preMeasureDay]
Measure=Time
Format=%d

[MeasureDay]
Measure=Calc
Formula=([preMeasureDay] <> #Day#)
IfEqualValue=0
IfEqualAction=!SetVariable Day [preMeasureDay]
Basically, the new formula equals 1 when the values match, and 0 when they don't. When they don't match, the IfAction resets the variable value, and they match again. This should force the IfAction to fire like you need it to.

Keep in mind that I quickly threw this code together and haven't tested it.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Variable Updating

Post by smurfier »

Just a couple corrections:

Code: Select all

[Variables]
Day=0

[preMeasureDay]
Measure=Time
Format=%d

[MeasureDay]
Measure=Calc
Formula=preMeasureDay <> #Day#
IfEqualValue=1
IfEqualAction=!SetVariable Day [preMeasureDay]
DynamicVariables=1
MeasureDay becomes 1 when the values are not equal thus firing the action.

This post can be used as reference.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
NewWave
Posts: 23
Joined: April 15th, 2012, 5:39 am

Re: Variable Updating

Post by NewWave »

This is good. Thank you both. :)