It is currently April 18th, 2024, 1:52 am

IfMatch What Am I Doing Wrong here?

Get help with creating, editing & fixing problems with skins
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

IfMatch What Am I Doing Wrong here?

Post by Mor3bane »

Hello, I am trying to use xxenium's weather - or rather a small portion of it to compare a decimal value from 0.1 to 100.0 it is percentile but I am fairly sure the string is just the decimal value. But now that I think of it, it could be a string then using <>= would be moot.

Here is the ini:
(also attached the rmskin as it is now)

Code: Select all

[Rainmeter]
Author=Morbane - Based on Xxenium Weatherxtd moon regexp.
Update=5000
Group=Dyna

[Variables]
@Include=#@#DynaVariables.inc
Location=#GlobalLocation#
Color=#GlobalFontColor#
Font=#GlobalFont#
ColorZ=#ColorOffset#
Goth=#Gothic#
Gothd=#Gothicd#

[MeasureMoonPercent]
Measure=WebParser
Url=http://iohelix.net/moon/moonlite.xml
RegExp=(?siU)<moon>.*<elongationToSun>.*</elongationToSun>.*<percentIlluminated>(.*)</percentIlluminated>.*<age>.*</age>.*<phase>(.*)</phase>.*<length>.*</length>.*<nextPhase>.*<daysToPhase>.*</daysToPhase>.*</nextPhase>
UpdateRate=900
;Phase %
StringIndex=1

;Phase String
[MeasureMoonPhaseTooltip]
Measure=WebParser
Url=[MeasureMoonPercent]
StringIndex=2

;Phase String
[MeasureMoonPhase]
Measure=WebParser
Url=[MeasureMoonPercent]
StringIndex=2

[Background]
Meter=Image
ImageName=#@##MyBackgroundImage#
X=40
Y=40

[MeterMoonBack]
Meter=Image
ImageName=#@#\Moon\0.png
X=70
Y=70
W=198
H=198
ImageAlpha=200
AntiAlias=1
PreserveAspectRatio=1
DynamicVariables=1

[MeterMoonPNG]
Meter=Image
X=70
Y=70
W=198
H=198
ImageAlpha=255
ImagePath=#@#Resources\Moon\
ImageFlip=Horizontal
AntiAlias=1
PreserveAspectRatio=1
DynamicVariables=1

[MeasureMoonPhasePNG]
Measure=WebParser
Url=[MeasureMoonPercent]
StringIndex=2
IfMatch=([MeasureMoonPercent] <= 1.5)
IfMatchAction=[!SetOption MeterMoonPNG ImageName "2.png"]
IfMatch2=Full
IfMatchAction2=[!SetOption MeterMoonPNG ImageName "FULL.png"]
IfMatch3=Last Quarter
IfMatchAction3=[!SetOption MeterMoonPNG ImageName "LSQT.png"]
IfMatch4=Waning Crescent
IfMatchAction4=[!SetOption MeterMoonPNG ImageName "WNCR.png"]
IfMatch5=Waning Gibbous
IfMatchAction5=[!SetOption MeterMoonPNG ImageName "WNGB.png"]
IfMatch6=Waxing Crescent
IfMatchAction6=[!SetOption MeterMoonPNG ImageName "WXCR.png"]
IfMatch7=Waxing Gibbous
IfMatchAction7=[!SetOption MeterMoonPNG ImageName "WXGB.png"]
IfMatch8=New
;IfMatchAction8=[!SetOption MeterMoonBack ImageName "Back.png"][!SetOption MeterMoonPNG ImageName "NEW.png"]
DynamicVariables=1
UpdateDivider=1

[MeterImageTop]
Meter=Image
ImageAlpha=200
ImageName=#@#ChapterC.png
ImageTint=#Gothd#
X=95
Y=82
W=150
H=38
Group=Digital
AntiAlias=1

[Text]
Meter=STRING
FontFace=#Font#
FontColor=#Color#
FontSize=20
StringAlign=Center
X=166
Y=121
ClipString=1
Text="MOON PHASE:"
StringEffect=Border
FontEffectColor=0,0,0,255
Antialias=1

[MeterMoonPhase]
Meter=STRING
MeasureName=MeasureMoonPhase
FontFace=#Font#
FontColor=210,170,90,185
FontSize=20
StringAlign=Center
X=r
Y=40r
Text="%1"
StringEffect=Border
FontEffectColor=0,0,0,255
InlineSetting=Case | UPPER
InlineSetting2=CharacterSpacing | 0.7
Antialias=1
Currently moon is 0.xx % for quick reference but it changes by 0.0XX roughly every hour-ish.
DynaMoon_0.01.rmskin
The basic idea is to use the percentile to manage the image showing a division of 24 images based on moon visible percentile.
So I'm just brain dead or something.. can't get the first image to show?
You do not have the required permissions to view the files attached to this post.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: IfMatch What Am I Doing Wrong here?

Post by jsmorley »

You can't use formulas in IfMatch.

IfMatch uses regular expression on the string contents of the measure it is on. It's an entirely different animal than IfCondition.

https://docs.rainmeter.net/manual/measures/general-options/ifconditions/
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: IfMatch What Am I Doing Wrong here?

Post by Mor3bane »

jsmorley wrote: February 24th, 2020, 2:54 pm You can't use formulas in IfMatch.

IfMatch uses regular expression on the string contents of the measure it is on. It's an entirely different animal than IfCondition.

https://docs.rainmeter.net/manual/measures/general-options/ifconditions/
Oh maaaan!

Code: Select all

IfCondition=([MeasureMoonPercent] <= 1.5)
IfTrueAction=[!SetOption MeterMoonPNG ImageName "2.png"]
This works. Thanks jsmorley :thumbup:
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: IfMatch What Am I Doing Wrong here?

Post by jsmorley »

Mor3bane wrote: February 24th, 2020, 3:00 pm Oh maaaan!

Code: Select all

IfCondition=([MeasureMoonPercent] <= 1.5)
IfTrueAction=[!SetOption MeterMoonPNG ImageName "2.png"]
This works. Thanks jsmorley :thumbup:
Sure thing...

Just as an aside, you can avoid DynamicVariables=1 on this measure by not using the [] brackets around the measure name in the IfCondition. Since IfCondition is always "numeric", it can and does assume that any reference to a measure name is the current number value of the measure, and so using it as a [SectionVariable] is not required.

Code: Select all

IfCondition=(MeasureMoonPercent <= 1.5)
IfTrueAction=[!SetOption MeterMoonPNG ImageName "2.png"]
You would only use the [] brackets if you wanted to use the string value of the measure, say if you had done a Substitute on it to turn "Nine" into "9" or some such. Then you would need DynamicVariables=1.

This is true of the Formula option in a Calc measure and any IfCondition[N] option. Those are the two places that MUST be numeric.