- Status Closed
- Percent Complete
- Task Type Patches
- Category User Interface → Themes
- Assigned To No-one
- Operating System All players
- Severity Low
- Priority Very Low
- Reported Version Release 3.6
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
FS#11516 - new skin tag... %if() allows you to have more control over conditionals
This patch adds a new tag which lets you have more control over conditionals.
%if( <tag>, <operator>, <value> [, num_options] ) ….
tag is a different token which you want to use (i.e %mp)
operator is any of: (without the quotes) “eq” for equality, “neq” for not equality, “lt” for less than. “lte” for less than or equal, “gt” for greater than” and “gte” for great than or equal. (If people would prefer I’m happy to change these to ==, !=, <, ⇐, >, >= )
value is the value to compare against.
num_options is an optional value to give to the tag to say how many options it “has” (some tags scale the value to the number of conditional options, i.e %pv)
OK, so how would you use this tag? Lets say you want to do a small animation when fast forwarding…
%?if( %mp, eq, 4)<%t(0.1)%xd(Aa);%t(0.1)%xd(Ab);%t(0.1)%xd(Ac);%t(0.1)%xd(Ad)>
and the opposite animation for rewind… %?if( %mp, eq, 5)<%t(0.1)%xd(Ad);%t(0.1)%xd(Ac);%t(0.1)%xd(Ab);%t(0.1)%xd(Aa)>
Compare that to:
%t(0.1)%?mp<|||%xd(Aa)|%xd(Ae)>;%t(0.1)%?mp<|||%xd(Ab)|%xd(Ad)>;%t(0.1)%?mp<|||%xd(Ac)|%xd(Ac)>;%t(0.1)%?mp<|||%xd(Ad)|%xd(Ab)>;%t(0.1)%?mp<|||%xd(Ae)|%xd(Aa)>;%t(0.1)%?mp<|||%xd(Af)|%xd(Ah)>;%t(0.1)%?mp<|||%xd(Ag)|%xd(Ag)>;%t(0.1)%?mp<|||%xd(Ah)|%xd(Af)>
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
Would this only work for numeric tags?
I wouldn’t mind seeing this in a slightly more general way, where value could also be a tag, and where string tags can be used. That would allow things like showing the next album/artist *only* if they’re different from the current one, which is something I’ve wanted to do a few times.
right now it is only numeric, and text tags are treated as 1 if there is text and 0 if not.
I was thinking that adding string comparisons would be fairly trivial. tag compare is slightly harder because the parser doesnt (yet) let you specify either a tag or a number param. but fixing that shuldnt be too hard.
To maintain some similitude with other programming languages, I suggest to avoid the three letter operator. So:
NEQ → NE
LTE → LE
GTE → GE
But, after all, ye old symbols are preferable…
I’m hoping to do string and tag comparisson tonight so maybe I’ll just use the actual symbols (and I’ll use the numeric string sorting code so < and > for strings work.)
I wonder if there is any point adding a “between” operator also. I’m not sure it would ever be used but I thought %if( %if( %pv, gte, -10), eq, %if(%pv, lte, 10)) might be a bit hard to read? :D