It is currently May 9th, 2024, 10:10 pm
Weather Problem...
-
- Posts: 17
- Joined: August 29th, 2012, 5:41 am
Weather Problem...
I'm having an issue with a weather skin I'm trying to make. I'm trying to make it display a short code for ranges of temperature, like HOT for 80+, WRM for 80-70, CUL for 70-60, and CLD for 60-. I think this code should work, but it won't ever show me WRM or CUL. I am just using different weather codes in my #weathercode# variable to get different ranges of temperatures, and when I use one below 70°, it shows CLD, and above 70°, it shows HOT.
Any ideas?
-
- Rainmeter Sage
- Posts: 889
- Joined: September 6th, 2011, 6:34 am
Re: Weather Problem...
I think your problem is most likely due to those IfActions only firing once, when the condition becomes true for the first time. You need something that handles all the cases at the same time. Something like this might work:
This complicated formula transforms those temperature intervals into integer numbers. In case you don't know that construct, it essentially means:
<condition> ? <return_this_if_true> : <else_return_this>
Very handy in a lot of cases.
Code: Select all
[MeasureWeatherTemp]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureWeatherRSS]
StringIndex=3
[MeasureTempCode]
Measure=Calc
Formula=MeasureWeatherTemp < 60 ? 1 : (MeasureWeatherTemp < 70 ? 2 : (MeasureWeatherTemp < 80 ? 3 : 4))
Substitute="1":"CLD", "2":"CUL", "3":"WRM", "4":"HOT"
[MeterWeatherTXT]
Meter=String
MeasureName=MeasureTempCode
X=57
Y=0
FontColor=#color#
FontFace=Arial Black
FontSize=7
AntiAlias=1
<condition> ? <return_this_if_true> : <else_return_this>
Very handy in a lot of cases.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
-
- Developer
- Posts: 22632
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Weather Problem...
There is a little more explanation and a couple of examples of using "conditional formulas" here:
http://rainmeter.net/cms/Measures-Calc_beta
http://rainmeter.net/cms/Measures-Calc_beta
-
- Posts: 17
- Joined: August 29th, 2012, 5:41 am
Re: Weather Problem...
Gotcha. I totally should've thought of that, except I didn't know what that Substitute function did :P