It is currently May 3rd, 2024, 9:03 pm

IfEqualValue Issue

Get help with creating, editing & fixing problems with skins
User avatar
cwfrizzell
Posts: 77
Joined: August 10th, 2009, 9:03 pm

IfEqualValue Issue

Post by cwfrizzell »

I'm using the following code as an exercise to help me better understand IfEqualValue:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Color1=255, 255, 255, 217
FontName=Agency FB
FontHeight1=14
CapsLock=No
CapsImage=#ROOTCONFIGPATH#Images\Alpha_Color

[MeasureCAPS]
Measure=Plugin
Plugin=KeyState.dll
KeyName=CAPS
IfAboveValue=1
IfEqualAction=!Execute [!RainmeterSetVariable CapsImage "#ROOTCONFIGPATH#Images\Alpha_Color"][!RainmeterSetVariable CAPS_Lock "Yes"]
IfEqualValue=1
IfEqualAction=!Execute [!RainmeterSetVariable CapsImage "#ROOTCONFIGPATH#Images\Alpha_Color"][!RainmeterSetVariable CAPS_Lock "Yes"]
IfBelowValue=1
IfBelowAction=!Execute [!RainmeterSetVariable CapsImage "#ROOTCONFIGPATH#Images\Alpha_BW"][!RainmeterSetVariable CAPS_Lock "No"]

[MeterCAPS]
Meter=Image
ImageName=#CapsImage#.png
X=0
Y=0
H=25
W=25

[MeterCAPSWord]
Meter=STRING
MeasureName=MeasureCAPS
X=25r
Y=4
H=15
W=50
FontColor=#Color1#
FontFace=#FontName#
FontSize=#FontHeight1#
StringAlign=LEFT
StringEffect=SHADOW
StringStyle=NORMAL
Text=#CapsLock#
Unfortunately, while the measure itself works (verified in log), the meters themselves do not change. I think it's either due to the way IfEqualValue interprets the result or how I have it coded. Does anything look out of the ordinary? Am I missing something?
Cheers!

Chuck
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: IfEqualValue Issue

Post by smurfier »

You need to add DynamicVariables=1 to your meters.

Whenever you are using a variable that changes value or use a [MeasureName] in brackets, you need to turn DynamicVariables on or that meter/measure only sees the initial value set in the [Variables] section.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
cwfrizzell
Posts: 77
Joined: August 10th, 2009, 9:03 pm

Re: IfEqualValue Issue

Post by cwfrizzell »

smurfier wrote:You need to add DynamicVariables=1 to your meters.

Whenever you are using a variable that changes value or use a [MeasureName] in brackets, you need to turn DynamicVariables on or that meter/measure only sees the initial value set in the [Variables] section.
Ah... missed that. Thanks smurfier!
Cheers!

Chuck
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: IfEqualValue Issue

Post by Seahorse »

I'm trying to use this to represent the STATE of NowPlaying to have an image corresponding to 0, 1 or 2 using Black/blue/Red images, however I'm failing horribly and need a hand with this which doesn't work with or without dynamic variables and in only displays REd (STATE 2):

Code: Select all

;Measures

[mState]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[mPlayer]
PlayerType=STATE

[CalcState]
Measure=Calc
Formula=mState
IfAboveAction=!execute [!RainmeterShowMeter MeterState0]
IfEqualValue=0
IfEqualAction=!execute [!RainmeterShowMeter MeterState1]
IfEqualValue=1
IfEqualAction=!execute [!RainmeterShowMeter MeterState2]
IfAboveValue=1

;Measures

[MeterState0]
Meter=IMAGE
X=10
Y=205
ImageName=Blue.png
DynamicVaribles=1

[MeterState1]
Meter=IMAGE
X=10
Y=205
ImageName=Black.png
DynamicVaribles=1

[MeterState2]
Meter=IMAGE
X=10
Y=205
ImageName=Red.png
DynamicVaribles=1
I think this shoudl simply display whatever colour dorresponds to the state, but this is not the case. Does each one need to be hidden if not in use and if so is that via the bang or Hidden=1 in the Meter?

Or am I trying to hard and you simply substitute 0 for Black.png etc?
Last edited by Seahorse on May 30th, 2011, 7:30 am, edited 1 time in total.
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

User avatar
cwfrizzell
Posts: 77
Joined: August 10th, 2009, 9:03 pm

Re: IfEqualValue Issue

Post by cwfrizzell »

I think you need to hide them based on the state:

Code: Select all

IfAboveAction=!execute [!RainmeterShowMeter MeterState0][!RainmeterHideMeter MeterState1][!RainmeterHideMeter MeterState2]
IfEqualValue=0
IfEqualAction=!execute [!RainmeterShowMeter MeterState1][!RainmeterHideMeter MeterState0][!RainmeterHideMeter MeterState2]
IfEqualValue=1
IfEqualAction=!execute [!RainmeterShowMeter MeterState2][!RainmeterHideMeter MeterState0][!RainmeterHideMeter MeterState1]
IfAboveValue=1
Cheers!

Chuck
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: IfEqualValue Issue

Post by smurfier »

You are using two instances of IfEqualAction/IfEqualValue. Only one of each each is allowed per meter.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: IfEqualValue Issue

Post by Seahorse »

cwfrizzell, that seems to partially work.

Smurfier - I'm not sure I understad, if there are only two options, how do I get them to cover 3? or do I make 1 measure per option?
Last edited by Seahorse on May 29th, 2011, 4:59 pm, edited 1 time in total.
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: IfEqualValue Issue

Post by jsmorley »

Seahorse wrote:cwfrizzell, that seems to partially work.

Smurfier - if there are only two options, how do I get them to cover 3?
Say the value could be 0, 1 or 2

IfBelowValue=1
IfAboveValue=1
IfEqualValue=1
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: IfEqualValue Issue

Post by Seahorse »

I presume I pop on bothe the bang and the xxx=1 lines,

Code: Select all

[CalcState]
Measure=Calc
Formula=mState
IfBelowAction=!execute [!RainmeterShowMeter MeterState0][!RainmeterHideMeter MeterState1][!RainmeterHideMeter MeterState2]
IfBelowValue=1
IfEqualAction=!execute [!RainmeterShowMeter MeterState1][!RainmeterHideMeter MeterState0][!RainmeterHideMeter MeterState2]
IfEqualValue=1
IfAboveAction=!execute [!RainmeterShowMeter MeterState2][!RainmeterHideMeter MeterState0][!RainmeterHideMeter MeterState1]
IfAboveValue=1
the reason I ask it it's still malfunctioning.. O.O
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

User avatar
cwfrizzell
Posts: 77
Joined: August 10th, 2009, 9:03 pm

Re: IfEqualValue Issue

Post by cwfrizzell »

In your original code, you had [MeterState0] twice. Not sure if that's playing a part in the confusion...

I took a look at poiru's Soita skin. Here's something you might consider:

Code: Select all

[mStateButton]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[mPlayer]
PlayerType=STATE
Substitute="0":"Play.png","1":"Pause.png","2":"Play.png"
Maybe consider Substitute instead?
Cheers!

Chuck