Littlefoot: metadata variables, vectors and onChange scripts

While experimenting with the metadata section in Littlefoot, I’ve discovered an interesting detail. Elements of metadata vectors can be accessed from onChange scripts by appending the elements index to the variables name. Here’s an example Littlefoot program:

<metadata description="Display parameters only for active elements">
        <group name="element" displayName="Element *" count="3"  />

        <variable name="count" displayName="Element count" type="int" min="1" max="3" value="2" />

        <vector group="element" count="3" wantsGetFunctions="true" wantsSetFunctions="false">
            <variable name="type" displayName="Type" type="option" value="Apples" options="Apples;Oranges;Bananas;" />

    <script onChange="count">
        if (count.value == 1)
            type0.visible = true;
            type1.visible = false;
            type2.visible = false;
        else if (count.value == 2)
            type0.visible = true;
            type1.visible = true;
            type2.visible = false;
            type0.visible = true;
            type1.visible = true;
            type2.visible = true;


void repaint()

Using this can get quite cumbersome, because you can’t iterate over the elements (maybe I am missing something and devs will correct me).

Still, I found it useful for creating more dynamic parameter layouts for Dashboard. Until metadata tags are replaced with new tools, I hope you might find this helpful too.

Update on the onChange script functionality based on more experiments with Littlefoot:

onChange scripts allow to change following metadata variable attributes:

  • .value (doesn’t refresh GUI)
  • .min, .max (does refresh GUI when variable is visible, doesn’t update the value)
  • .displayName (does refresh GUI when variable is visible)
  • .enabled (does refresh GUI when variable is visible)
  • .visible (does refresh GUI)

onChange scripts can’t change:

  • .options
  • .type (it is allowed, but resulting variables do not work properly)
1 Like