Support and General Use > Theming and Appearance Customization
%if, %and, %or not working for me
sockbox:
I'm not sure if I'm using the conditional tags wrong so I wanted to ask here before filing a bug.
I'm trying to use multiple %if conditionals in an %and and %or statement but it only works if the conditional is using the %mp tag. It never works when I add more than one %bl or %pv conditional.
Below, all the commented lines do not work.
--- Code: ---%?and(%if(%mp,>,1),%if(%mp,<,3))<hello>
%?and(%if(%mp,>,0),%if(%bl,<,100))<dog>
%?or(%if(%mp,=,1),%if(%mp,=,2))<play>
#%?and(%if(%bl,<=,100),%if(%bl,>,90))<%bl>
#%?and(%if(%pv,<,100),%if(%bl,<,90))<%bl>
#%?and(%if(%mp,=,1),%if(%bl,<,90),%if(%pv,<,80))<cat>
#%?or(%if(%pv,<,100),%if(%bl,<,90))<%bl>
--- End code ---
sockbox:
It turns out that the inequality symbols require % signs in front. Thanks to kiwicam and his Alien theme for the workaround.
--- Code: ---%?and(%if(%pv,%<,100),%if(%bl,%<,90))<%bl>
%?and(%if(%mp,%>,1),%if(%bl,%<,90),%if(%pv,%<,80))<cat>
%?or(%if(%pv,%<,100),%if(%bl,%<,90))<%bl>
%?and(%if(%bl,%>,50),%if(%bl,%<,90),%if(%pv,%<,80))<cat>
--- End code ---
KiwiCam:
Works like a treat. I'm pretty sure that credit goes to JdGordon :-* for that solution.
That's some pretty interesting code you've got going on there. I gave up on trying to use %and & %or, and that's probably where I was getting caught out myself. But now you've got me thinking about what I can do with those.
That's one thing I love about this theme-ing malarkey. I see what others are doing and I get inspired.
JdGordon:
Damn, OK I thought I fixed this problem.
What happens is the parser is a bit stupid and it sees < without realising it cant possibly be a conditional list so errors out. I fixed it to work for when %if() is by itself, but didnt realise it fails when it it nested.
I'm going to try fixing this today/soon, but yeah, put %'s in front untill it is fixed.
JdGordon:
http://gerrit.rockbox.org/214 fixes this issue but needs to be tested properly before I'll commit it.
Navigation
[0] Message Index
[#] Next page
Go to full version