It is currently May 2nd, 2024, 6:27 am

Using variables with bars...

Get help with creating, editing & fixing problems with skins
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Using variables with bars...

Post by Kyremi »

Hello all,
I'm attempting to make a bar which is actually two semi-transparent bars on top of each other. The underlying bar has a constant width in pixels, and the one on top should have the varying parameter which has a maximum value of the underlying bar. However, whatever I put in the code, my bar lengths end up looking exactly the same. Here's the relevant code:

Code: Select all

[MeterDailyRain]
Meter = Bar
MeasureName = MeasureDailyRain
BarColor = #Colour8#
X = 150
Y = 190
W = 75
H = 12
MinValue = 0
MaxValue = #MeasureMonthlyRain#
BarOrientation = HORIZONTAL

[MeterDailyRainUnderlay]
Meter = Bar
MeasureName = MeasureMonthlyRain
BarColor = #Colour8#
X = 150
Y = 208
W = 75
H = 12
MinValue = 0
MaxValue = #MeasureMonthlyRain#
BarOrientation = HORIZONTAL
Essentially I want to show MeasureDailyRain as a fraction of MeasureMonthlyRain where both are normal values. What I get now is just two equal-length bars, even though the two Measure values are different...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using variables with bars...

Post by jsmorley »

The likely problem is that MinValue and MaxValue are options that are put on the Measures returning the data, not the meters showing the data. So you are in effect ending up with MinValue=0 and MaxValue=0 on both measures, and getting a 100% value on the Bar meter in both cases.
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Using variables with bars...

Post by Kyremi »

How would I go about fixing it? I added Min and MaxValue bits to the actual measures...

Code: Select all

[MeasureAnnualRain]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MainMeasure]
StringIndex=6
MinValue = 0
MaxValue = 1000

[MeasureMonthlyRain]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MainMeasure]
StringIndex=5
MinValue = 0
MaxValue = #MeasureAnnualRain#

[MeasureDailyRain]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MainMeasure]
StringIndex=4
MinValue = 0
MaxValue = #MeasureMonthlyRain#
...but that didn't change anything.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using variables with bars...

Post by jsmorley »

zip up and host your entire skin folder on http://mediafire.com or somewhere and post a link here so I can see the entire thing and test it.
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Using variables with bars...

Post by Kyremi »

The whole skin is just one .ini file, conveniently enough. https://dl.dropbox.com/u/29730989/weathershef.ini is the link for it.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using variables with bars...

Post by jsmorley »

You are using two variables:

MaxValue = #MeasureAnnualRain#
MaxValue = #MeasureMonthlyRain#

And neither of them are defined in the [Variables] section of the skin. So they are both "0", and we are right back where we were before...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using variables with bars...

Post by jsmorley »

I think what you meant to do is:

Code: Select all

[MeasureAnnualRain]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MainMeasure]
StringIndex=6
MinValue = 0
MaxValue = 1000

[MeasureMonthlyRain]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MainMeasure]
StringIndex=5
MinValue = 0
MaxValue = [MeasureAnnualRain]
DynamicVariables=1

[MeasureDailyRain]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MainMeasure]
StringIndex=4
MinValue = 0
MaxValue = [MeasureMonthlyRain]
DynamicVariables=1
Then it should work.

Note: Don't set the Update= to such a high value in the [Rainmeter] section of the skin. Leave it as Update=1000 and do any controlling of how often things happen with UpdateRate= on the WebParser measures and UpdateDivider= on other measures. To be honest, WebParser defaults to every 10 minutes if you don't tell it otherwise, and that is generally pretty good for a weather skin. Leave Update=1000 and don't worry about the rest.
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Using variables with bars...

Post by Kyremi »

Ahh, damnit. I've not used Rainmeter for a while and completely forgot the Variables section; I assumed that it was possible to directly use a Measure as a variable in a Meter. I added two variables:

MeasureAnnualRainVar = MeasureAnnualRain
MeasureMonthlyRainVar = MeasureMonthlyRain

where they reference the two relevant measures, and corrected the variable references. Something's changed, since the second Bar is now a lot shorter... however, that's the Underlay bar which should ideally be at 100% constantly...

(The .ini file in the Dropbox link has been updated to reflect my latest modifications, so I don't have to post another link)
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using variables with bars...

Post by jsmorley »

Kyremi wrote:Ahh, damnit. I've not used Rainmeter for a while and completely forgot the Variables section; I assumed that it was possible to directly use a Measure as a variable in a Meter. I added two variables:

MeasureAnnualRainVar = MeasureAnnualRain
MeasureMonthlyRainVar = MeasureMonthlyRain

where they reference the two relevant measures, and corrected the variable references. Something's changed, since the second Bar is now a lot shorter... however, that's the Underlay bar which should ideally be at 100% constantly...

(The .ini file in the Dropbox link has been updated to reflect my latest modifications, so I don't have to post another link)
Read my previous post carefully, I think it solves your problem.
Kyremi
Posts: 41
Joined: September 22nd, 2011, 1:03 pm

Re: Using variables with bars...

Post by Kyremi »

Ohh. Yes, I got it now... the other bar now has the MaxValue set to MeasureAnnualRain which makes it much shorter. I've put an Image meter under each bar and now the whole thing looks exactly like I intended it to.

Many thanks for the help :)