Bug $VAR[] to position an image?
#1
I'm trying to use a var to position an image. The most basic trial doesn't work:

Code:
<control type="image">
    <left>$VAR[Thingumy]</left>
    <top>570</top>
    <width>50</width>
    <height>50</height>
    <texture>somepic.png</texture>
</control>

<variable name="Thingumy">
    <value>100</value>
</variable>

I know the variable is being set because I can change its value for the texture name and use it in the <texture>, and it works fine.

Any ideas?
Reply
#2
Not supported for positions
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#3
Variables don't work with integer values. Only strings are supported atm. Don't know if pieh is working on it but I wouldn't wait for support anytime soon.
Image
Reply
#4
OK That totally blows my understanding of how $VARs work.

Why does the renderer care where a $VAR is used? Shouldn't it just scan for all uses of $VAR and substitute values?

Why does the renderer care what type a $VAR has? In my mind a $VAR value is just a piece of data.

Anyway, thanks for the clarification.
Reply
#5
(2014-01-08, 14:52)powlo Wrote: Why does the renderer care what type a $VAR has? In my mind a $VAR value is just a piece of data.
Second this.
I also think that the renderer shouldn't care where or how the $VAR is used, it should be a (fairly simple) substitution-type mechanism.

(2014-01-07, 22:29)`Black Wrote: Variables don't work with integer values. Only strings are supported atm. Don't know if pieh is working on it but I wouldn't wait for support anytime soon.
I've tried this on another use-case that involves strings, still no luck.
My case is about displaying different items from the Skin Widgets service. Something like this:

PHP Code:
<item id="1">
    <
visible>!IsEmpty(Window.Property($VAR[itemtype].1.File))</visible>
    <
label>$INFO[Window.Property($VAR[itemtype].1.Title)]</label>
    <
onclick>PlayMedia($ESCINFO[Window(Home).Property($VAR[itemtype].1.File)])</onclick>
</
item>

<
variable name="itemtype">
    <
value condition="Skin.HasSetting(itemtype2)">RandomEpisode</value>
    <
value>RecentEpisode</value>
</
variable

I want to use user-defined settings to say if I show recent or random items.

Is this possible currently?
If not - has anyboy figured a workaround for this? (other than copy-pasting the entire block twice)
Reply
#6
"The renderer" is a shit load of code. I'd be happy if someone wishes to improve it.

$VAR is evaluated at runtime (i.e. per frame). It doesn't work everywhere for just that reason, as not everything is queried at runtime.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#7
(2014-01-27, 21:11)EtgarDizz Wrote:
PHP Code:
<item id="1">
    <
visible>!IsEmpty(Window.Property($VAR[itemtype].1.File))</visible>
    <
label>$INFO[Window.Property($VAR[itemtype].1.Title)]</label>
    <
onclick>PlayMedia($ESCINFO[Window(Home).Property($VAR[itemtype].1.File)])</onclick>
</
item>

<
variable name="itemtype">
    <
value condition="Skin.HasSetting(itemtype2)">RandomEpisode</value>
    <
value>RecentEpisode</value>
</
variable

I want to use user-defined settings to say if I show recent or random items.

Is this possible currently?
If not - has anyboy figured a workaround for this? (other than copy-pasting the entire block twice)

This is something I will love to see
Reply
#8
(2014-01-27, 21:11)EtgarDizz Wrote:
(2014-01-08, 14:52)powlo Wrote: Why does the renderer care what type a $VAR has? In my mind a $VAR value is just a piece of data.
Second this.
I also think that the renderer shouldn't care where or how the $VAR is used, it should be a (fairly simple) substitution-type mechanism.

(2014-01-07, 22:29)`Black Wrote: Variables don't work with integer values. Only strings are supported atm. Don't know if pieh is working on it but I wouldn't wait for support anytime soon.
I've tried this on another use-case that involves strings, still no luck.
My case is about displaying different items from the Skin Widgets service. Something like this:

PHP Code:
<item id="1">
    <
visible>!IsEmpty(Window.Property($VAR[itemtype].1.File))</visible>
    <
label>$INFO[Window.Property($VAR[itemtype].1.Title)]</label>
    <
onclick>PlayMedia($ESCINFO[Window(Home).Property($VAR[itemtype].1.File)])</onclick>
</
item>

<
variable name="itemtype">
    <
value condition="Skin.HasSetting(itemtype2)">RandomEpisode</value>
    <
value>RecentEpisode</value>
</
variable

I want to use user-defined settings to say if I show recent or random items.

Is this possible currently?
If not - has anyboy figured a workaround for this? (other than copy-pasting the entire block twice)

Just use conditional includes - one for Recent and one for Random items - and then fill each include with all the relevant items. this is exactly how I do it for Alaska HD.
Reply
#9
@powlo - why not just use a conditional slide animation with time="0" to reposition the control -- e.g.

Code:
<control type="image">
    <width>50</width>
    <height>50</height>
    <texture>somepic.png</texture>
    <animation effect="slide" start="0" end="100,0" time="0" condition="Condition1">Conditional</animation>
    <animation effect="slide" start="0" end="200,100" time="0" condition="Condition2">Conditional</animation>
    <animation effect="slide" start="0" end="500,100" time="0" condition="Condition3">Conditional</animation>
</control>
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#10
(2014-01-27, 23:43)Hitcher Wrote: Just use conditional includes - one for Recent and one for Random items - and then fill each include with all the relevant items. this is exactly how I do it for Alaska HD.

Ok, I see how that would help to clean the code... But it still means I will have to have two copies of the same block, with the only difference being the Random/Recent bit...
... and once I want to add an option for "Recommended"... three copies of the same block. And so on.
Reply
#11
It's literally a Copy/Paste/Find/Replace job though.
Reply
#12
(2014-01-28, 19:11)Hitcher Wrote: It's literally a Copy/Paste/Find/Replace job though.

RoflRoflRoflRoflRoflRofl
Reply
#13
(2014-01-28, 19:11)Hitcher Wrote: It's literally a Copy/Paste/Find/Replace job though.

Not to take away from the sheer joy of search/replace (especially when using regular expressions for the job)...
Wasn't quite what I meant by "workaround". I'm trying to avoid having huge files with redundant code in them.

Would be nice if someone figured out a creative way to accomplish this.
Reply
#14
I wouldn't worry as they'll have no impact on performance, in fact using conditional includes are better for performance as they're loaded on window load whereas variables are checked every screen refresh.
Reply

Logout Mark Read Team Forum Stats Members Help
$VAR[] to position an image?0