Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Welcome to the Rockbox Technical Forums!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Theming and Appearance Customization
| | |-+  %if, %and, %or not working for me
« previous next »
  • Print
Pages: [1]

Author Topic: %if, %and, %or not working for me  (Read 2464 times)

Offline sockbox

  • Member
  • *
  • Posts: 111
%if, %and, %or not working for me
« on: April 12, 2012, 06:28:04 PM »
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: [Select]
%?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>
Logged

Offline sockbox

  • Member
  • *
  • Posts: 111
Re: %if, %and, %or not working for me
« Reply #1 on: April 15, 2012, 03:24:21 AM »
It turns out that the inequality symbols require % signs in front. Thanks to kiwicam  and his Alien theme for the workaround.

Code: [Select]
%?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>
« Last Edit: April 15, 2012, 03:33:21 AM by sockbox »
Logged

Offline KiwiCam

  • Artist
  • Member
  • *
  • Posts: 92
Re: %if, %and, %or not working for me
« Reply #2 on: April 15, 2012, 04:58:17 AM »
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.

Logged

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
Re: %if, %and, %or not working for me
« Reply #3 on: April 16, 2012, 12:49:36 AM »
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.
Logged


Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
Re: %if, %and, %or not working for me
« Reply #4 on: April 16, 2012, 01:44:49 AM »
http://gerrit.rockbox.org/214 fixes this issue but needs to be tested properly before I'll commit it.
Logged


Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline KiwiCam

  • Artist
  • Member
  • *
  • Posts: 92
Re: %if, %and, %or not working for me
« Reply #5 on: May 21, 2012, 03:01:08 AM »
I apologise. I'm not sure what else I'm required to do for testing it, as as far as I'm aware, I think it works. I don't know what else to do. I wasn't really certain about what I had to do, to do this for you, in the first place. I thought I knew.

So, I'm sorry, I'd really love to help, but you'll either have to take me through what I need to do from the beginning step by step, or tell me where, or what, it is that I need to do, from where I left off, so that you've got your confirmation.

Then hopefully, I can also provide some future help. So, please.

Logged

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
Re: %if, %and, %or not working for me
« Reply #6 on: May 21, 2012, 03:26:51 AM »
That patch is merged already... does the origional wps code still not work?
Logged


Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline KiwiCam

  • Artist
  • Member
  • *
  • Posts: 92
Re: %if, %and, %or not working for me
« Reply #7 on: May 21, 2012, 04:48:27 AM »
Quote from: JdGordon on May 21, 2012, 03:26:51 AM
That patch is merged already... does the origional wps code still not work?

You mean with the %? As I understand it, I have two Sansa's with that patch installed from my builds. My themes work with both the % and no %, with that patched build. ie, both ways of coding work. Is that what you were expecting? It's been  since then that I've done anything with Rockbox, so I'm rusty again.
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Theming and Appearance Customization
| | |-+  %if, %and, %or not working for me
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.078 seconds with 15 queries.