It is currently April 27th, 2024, 1:29 pm

IfActions and Now Playing State

Get help with creating, editing & fixing problems with skins
Lightz39
Posts: 98
Joined: August 1st, 2012, 12:48 am

IfActions and Now Playing State

Post by Lightz39 »

Code: Select all

[mState]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PlayerName#
PlayerType=State
IfEqualValue=2
IfEqualAction=[!HideMeter Pause][!ShowMeter Play]
IfBelowValue=1
IfBelowAction=[!HideMeter Pause][!ShowMeter Play]
IfAboveValue=0
IfAboveAction=[!HideMeter Play][!ShowMeter Pause]
So what I am trying to do is have my "Pause" button show when the song is playing. When its either "Stopped" or "Paused" I would like my "Play" button to show instead. The code I have above works to get my "Play" button to appear when I pause or stop it but it won't change back to the "Pause" button when I return to playing. Any ideas why this may be? It could be the way I tried to number it I have a hard time wrapping my head around numbers.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: IfActions and Now Playing State

Post by Kaelri »

First, to explain the problem with your current method: IfActions must match mutually-exclusive conditions. You have: IfEqualValue=2 and IfAboveValue=0. So when you have a value of "2", it matches both of those conditions, and the actions aren't going to work right.

I have often found that instead of adding more meters, it's better to change the meters you already have. For example, I might do something like this:

Code: Select all

[mState]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PlayerName#
PlayerType=State
IfAboveValue=1
IfAboveAction=!SetOption Meter MeterStyle NotPlaying
IfEqualValue=1
IfEqualAction=!SetOption Meter MeterStyle Playing
IfBelowValue=1
IfBelowAction=!SetOption Meter MeterStyle NotPlaying

[Meter]
Meter=Image

[NotPlaying]
ImageName=Play.png
LeftMouseUpAction=!CommandMeasure mState "Play"

[Playing]
ImageName=Pause.png
LeftMouseUpAction=!CommandMeasure mState "Pause"
Lightz39
Posts: 98
Joined: August 1st, 2012, 12:48 am

Re: IfActions and Now Playing State

Post by Lightz39 »

That makes sense. Thank you once again.