Page 2 of 2

Re: [Feature Suggestion] How about a new function: StrCmp ?

Posted: February 28th, 2020, 4:46 pm
by SilverAzide
jsmorley wrote: February 28th, 2020, 3:48 pm[...], I sorta like the flexibility of "if this string and this value", [...]
What got me looking at this is (sorry, again) weather data. Dark Sky API has terrible icons compared to weather.com. They basically use a few strings like "cloudy" or "rain", and that's it... no distinction of "how cloudy" or "how rainy". The magnitude of these is contained in the data, so to make Dark Sky icons that are as expressive as weather.com, you end up wanting to do a lot of this:

IfCondition=(StrCmp([@CurrentIcon], "rain") == 0 && [@CurrentPrecipitation] > .05 && [@CurrentPrecipitation] < .09)
IfTrueAction=[set the icon number to the "showers" icon]


In other words, mapping their single crappy "rain"" icon to the weather.com's more useful drizzle/showers/rain/heavy rain icons. This is more a job for a Lua script, I know, but it's what got me thinking of strcmp in the first place.

Re: [Feature Suggestion] How about a new function: StrCmp ?

Posted: February 28th, 2020, 6:29 pm
by balala
SilverAzide wrote: February 28th, 2020, 4:46 pm IfCondition=(StrCmp([@CurrentIcon], "rain") == 0 && [@CurrentPrecipitation] > .05 && [@CurrentPrecipitation] < .09)
IfTrueAction=[set the icon number to the "showers" icon]
Note that I read the documentation and found out that the above condition this way in Rainmeter is wrong. It should be
IfCondition=(StrCmp([@CurrentIcon], "rain") == 0 && [@CurrentPrecipitation] > 0.05 && [@CurrentPrecipitation] < 0.09).
The condition doesn't work if you don't add the appropriate zeros.