[Solved] Conditional Background
#1
Dear All,

Can I pick your genius brains once again. I've been playing with conditional visibility, but can't get the following to work. I'm trying to get the background to correspond to the type of music playing, but this patently ain't right as it will always default to the second image. Is it a complete no-no to try and use labels in this way, or have I just got the conditions wrong?

Thanks

Code:
            <control type="image">
                <description>Background image</description>
                <posx>0</posx>
                <posy>0</posy>
                <width>1280</width>
                <height>720</height>
                <texture>Violin and Music 2.jpg</texture>
                <visible>MusicPlayer.Genre(Classical) | MusicPlayer.Genre(Operatic)</visible>
                </control>
            <control type="image">
                <description>Background image</description>
                <posx>0</posx>
                <posy>0</posy>
                <width>1280</width>
                <height>720</height>
                <texture>Electric Guitar.jpg</texture>
                <visible>!MusicPlayer.Genre(Classical) + !MusicPlayer.Genre(Operatic)</visible>
                </control>
Reply
#2
I didn't test but for the second try:
Code:
![MusicPlayer.Genre(Classical) | MusicPlayer.Genre(Operatic)]
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#3
Can't really tell as it defaults to that anyway, presumably as the conditions are returning No regardless of whether its able to read it or not. I've tried $INFOs before them and that doesn't work. I'm also not sure the OR operator is right as I don't seem to have a keyboard key for "|" so I'm copying it from the wiki.
Reply
#4
Does stringcompare work? Stringcompare($INFO[MusicPlayer.Genre],Classical) | Stringcompare($INFO[MusicPlayer.Genre],Operatic)
Reply
#5
Sadly not Toiva. Thanks for the suggestion, never used that before but just did a bit of reading up and also tried SubString but neither work.
Reply
#6
This works.
Code:
<visible>Substring(MusicPlayer.Genre,pop) | Substring(MusicPlayer.Genre,rap)</visible>
<visible>![Substring(MusicPlayer.Genre,pop) | Substring(MusicPlayer.Genre,rap)]</visible>

I think the others methods are not working because you are getting more then one genre back from:
Code:
<label>$INFO[MusicPlayer.Genre]</label>
So make a test label to see what you get as text output while playing a song. Then use that for the substring.
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#7
I would start by creating a simple text label which returns the genre of the playing media and making sure that it's actually returning Olassical or Operatic.
Reply
#8
You're right MassIV, that does work. I obviously had to switch from Beethoven to ABBA to test (pop rather than rap of course). I'll go away to puzzle over why this works, while you can bask in the glory of your supreme knowledge. Thanks both so much for your input.
Reply

Logout Mark Read Team Forum Stats Members Help
[Solved] Conditional Background0