Kodi Community Forum

Full Version: Where's the documentation for $VAR?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
See title.
Yay. Thanks for this - I was also in the dark as to how to use/implement $VAR. Very helpful!
Thanks.

I've noticed that variables can't be declared in list items. It would be good if there was more info about where variables can be declared and how often they are updated. Maybe scope, precedence, persistence, naming rules and the other usual features that may be assumed to be packaged with something called a "variable".

After playing around I realise that what I need is a function...
Code:
<function name="Rainbow" param="input">
    <value  condition="Skin.String(input,'0'">red</value>
    <value  condition="Skin.String(input,'1'">green</value>
    <value>blue</value>
</variable>

<itemlayout>
   <texture>$FUNC[Rainbow, ListItem.Property(variable1)].png</texture>
</itemlayout>

#wishfulthinking
(2013-12-20, 13:34)powlo Wrote: [ -> ]I've noticed that variables can't be declared in list items.

$VAR[] should work for listitems as well

eg:
Code:
<itemlayout>
   <texture>$VAR[thumb]</texture>
</itemlayout>

<variable name="thumb">
   <value condition="!IsEmpty(ListItem.Art(thumb))">$INFO[ListItem.Art(thumb)]</value>
   <value>$INFO[ListItem.Icon]</value>
</variable>
(2013-12-20, 15:18)ronie Wrote: [ -> ]$VAR[] should work for listitems as well

Ah You're right it does.

However I can only get it to work when it's declared in either includes.xml or outside the include that I actually want the variable to be used in.

Ie i have this:

Code:
<includes>
   <include name="myincludename">
       ... with the control list and reference to the $VAR[]
   </include>
   <variable name = ....>
      <value condition=..>...</value>
   </variable>

Defining it on the same level as itemlayout, as you suggest above, doesn't work.