Help - Search - Members - Calendar
Full Version: Conditions And Total Number Of Menu Items
Scenyx Entertainment Community > Xbox1 Forums > Dashboard Forums > Official MediaXMenu (MXM) Forum > MXM WIP Beta forum
diffident
I'm thinking about a new skin, and there are two questions I can't answer:

First, is it possible to nest conditions to get the equivalent of

IF x AND y THEN z
or
IF x OR y THEN z

I could probably get a similar effect by clever layering of items, but I'd love there to be an easier way.

Second, I'm wondering whether a skin can discover and use the total number of items in a menu, so you could show, for instance, the string 'There are 9 games in this list'?

Thanks for any advice.

geniusalz
Well, the first question will really be: Are you writing a script or skin? Because as of now, skins don't support scripting features.

As for nesting (it's not elegant, but it works)

IF x AND y THEN z
CODE
IF x THEN
IF y THEN
z
ENDIF
ENDIF


IF x OR y THEN z
CODE
IF x THEN
z
ENDIF
IF y THEN
z
ENDIF

Or you could use GOTO's
CODE
IF x GOTO trueCondition
IF y GOTO trueCondition
GOTO falseCondition
:trueCondition
z
:falseCondition


This is better in the sense that it doesn't require writing z twice.



Don't think as skin can do that for now.
BenJeremy
I think he's referring to the use of conditionals in skin elements.

All skin conditionals also have "not" equivalents; which ones are you looking to use, and for what effect?
diffident
Yes, I'm thinking of conditionals in skin elements. I'm muddling some ideas around in my head, and in this case what I wanted to be able to do was (uninteresting in itself) to pick out all the odd (and later all the even) numbered items in a short (root) menu, ie

IF this is the MainMenu AND ItemSelected is number 1 OR 3 OR 5 THEN show this element
otherwise
IF this is the MainMenu AND ItemSelected is number 2 OR 4 THEN show this element

I could do the numerical OR bit with a list of individual elements

<LayoutElement Type="Image" Source="Whatever">
<Condition Arg1="1">ItemSelected</Condition>
</LayoutElement>

<LayoutElement Type="Image" Source="Whatever">
<Condition Arg1="3">ItemSelected</Condition>
</LayoutElement>

and so on, but as far as I can see to do the AND starts to require clever element layering (a layer to hide all this stuff if it's NOT the MainMenu or something like that), so I wondered if there was an easier more general way available to skinners, that would make this kind of IF/THEN/AND/OR stuff easy:

<Condition>MainMenu</Condition> AND <Condition arg="1">ItemSelected</Condition> OR <Condition arg="3">ItemSelected</Condition>

or something...

For this trivial application it would also be interesting to be able count the number of items in a menu, although I'm racing on to something like 'for ItemSelected is ODD from 1 to Count of Menu items' which is unlikely to happen smile.gif

I was just thinking last night what a great thing it is to have a community where you can toss out questions like this and know someone's going to try to help.

Thanks all.
BenJeremy
Well, the conditionals are "AND" only, but through clever usage of the NOT, you could simulate the OR operation.
diffident
QUOTE
conditionals are "AND" only


BJ, this doesn't mean I could use several conditionals for one element to get a logical AND does it? I mean like this:

<LayoutElement Type="Image" Source="Whatever">
<Condition>ItemEntry</Condition>
<Condition Arg1="0">ItemSelected</Condition>
</LayoutElement>

(ie IF the currently selected item isn't a submenu AND it's the first item in the list THEN show this image)

I've had a fairly thorough go at making this work, but I can only get the first conditional to have any effect (I'm testing using the WIP, so the <Condition Arg1="0">ItemSelected</Condition> does work on its own, or if I put it first).

Have I misinterpreted what you meant?
BenJeremy
QUOTE (diffident @ Feb 15 2004, 12:53 PM)
QUOTE
conditionals are "AND" only


BJ, this doesn't mean I could use several conditionals for one element to get a logical AND does it? I mean like this:

<LayoutElement Type="Image" Source="Whatever">
<Condition>ItemEntry</Condition>
<Condition Arg1="0">ItemSelected</Condition>
</LayoutElement>

(ie IF the currently selected item isn't a submenu AND it's the first item in the list THEN show this image)

I've had a fairly thorough go at making this work, but I can only get the first conditional to have any effect (I'm testing using the WIP, so the <Condition Arg1="0">ItemSelected</Condition> does work on its own, or if I put it first).

Have I misinterpreted what you meant?

I believe all conditionals need to pass in order for the item to be displayed. It should work... but I haven't tested it much.
diffident
QUOTE (BenJeremy @ Feb 15 2004, 07:31 PM)
I believe all conditionals need to pass in order for the item to be displayed.  It should work... but I haven't tested it much.

I'll give it another go - that's what I thought you meant.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.