It is currently April 25th, 2024, 7:01 am

Pop Quiz on DyamicVariables

Get help with creating, editing & fixing problems with skins
User avatar
overlayed
Posts: 5
Joined: May 7th, 2009, 11:03 pm

Pop Quiz on DyamicVariables

Post by overlayed »

Q1: Without testing the code in Rainmeter, what is the expected display from [MeterCnt]?
Q2: Compare your answer with the result from Rainmeter. Discuss - do you think the results from Rainmeter represent a bug or a feature?
Be honest and no cheating!!! :heehee:

Code: Select all

[Variables]
TestVar=0

[TestCnt1]
DynamicVariables=1
Measure=Calc
Formula=#TestVar#+1
ifAboveValue=0
ifAboveAction=!execute [!RainmeterSetVariable TestVar [TestCnt1]]

[TestCnt2]
DynamicVariables=1
Measure=Calc
Formula=#TestVar#+1
ifAboveValue=0
ifAboveAction=!execute [!RainmeterSetVariable TestVar [TestCnt2]]

[TestCnt3]
DynamicVariables=1
Measure=Calc
Formula=#TestVar#+1
ifAboveValue=0
ifAboveAction=!execute [!RainmeterSetVariable TestVar [TestCnt3]]

[MeterCnt]
DynamicVariables=1
Meter=String
X=15
Y=0
Text=[TestCnt1], [TestCnt2], [TestCnt3]
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Pop Quiz on DyamicVariables

Post by Alex2539 »

It should be 2.00000, 2.00000, 2.00000. Each of those measures sees #TestVar# as zero at the same time so they will all have the same value. Then, when they each trigger IfAboveAction, They are all going to try to set #TestVar# to 1. Since they've all triggered it at the same time and the value would need to dip below 1 and then back up again to re-fire the action, everything is done. The final values is therefore 2 (ie: 1+1) for each of them. When you then go and show those in the string meter, because you are using the measure values as dynamic variables and not using MeasureName keys and %1, %2 and %3, they each would get 5 (I think it's 5... it might be 6) decimal places automatically. Therefore: 2.00000, 2.00000, 2.00000.

Any questions?
ImageImageImageImage
User avatar
overlayed
Posts: 5
Joined: May 7th, 2009, 11:03 pm

Re: Pop Quiz on DyamicVariables

Post by overlayed »

Bravo!!! :clap: