Two questions: No-Press Display and Indirection

  1. I’m sure this is simple but … Given a global variable @myVar which frequently changes its value, how can that value be displayed in a second button without needing to do/press anything. Every time @myVar changes, the new value should be immediately displayed in the second button.

  2. I think what I’m looking for here is called Indirection.
    A statement such as:

    [(press){@myItem:#getitem(@Dex,@myList)#}{text:#@myItem#}]

    can be used to pull item @Dex (a number from 1 to 5) from a list named @myList and place it into the variable @myItem. BUT I want it to pull the item not from @myList but rather from a list which is named INSIDE @myList?

For example, the @myList variable might hold a list name @Use34M (or any of dozens of other dynamic list names) in which case @Use34M is the real list I want to pull a value from.

I hope that makes some sense. Can it be done?

Thanks.

[(@myVar:*){text:#@myVar#}]

I don’t know how “dynamic” the “dynamic list names” are, but I would solve it something like this:

[(@myList:Use34M){@usedList:#@Use34M#}]
[(@myList:Use35M){@usedList:#@Use35M#}]
[(@myList:Use36M){@usedList:#@Use36M#}]
[(@myList:Use37M){@usedList:#@Use37M#}]
… and so on
[(press){@myItem:#getitem(@Dex,@usedList)#}{text:#@myItem#}]

So store a list name (without the @ character) in @myList, and then populate @usedList based on the contents of @myList.

Loved the answer to question 1; would never have come up with that and will be using it a lot.

Not as much love for question 2 because there are 50 or 60 possibilities – but ya gotta do whatever works! Maybe by the time you get to MidiScript v10 you can add indirection. So that @myVar means use the contents of variable myVar but something like <@myVar> or |@myVar| means use the contents of the variable stored inside the variable myVar. What could be easier?! :laughing:

Thanks again for your help.

“MidiScript v10”, aka “JavaScript” where you can have indirection to global variables. :wink:

JavaScript would just add many more items to my “Things I Don’t Know How To Do” list.

I saw something in one of your videos that suggested a way I might accomplish what I want without indirection (while waiting for v10). I’m setting up the lists like this …

[(@selList:“cp11”){@listItems:“24,25,26,27,28,29”}]
[(@selList:“cp12”){@listItems:“18,19,20,21,22,23”}]
[(@selList:“cp13”){@listItems:“3,9,14,15,16,17”}]
[(@selList:“cp21”){@listItems:“54,55,56,57,58,59”}]
[(@selList:“cp22”){@listItems:“48,49,50,51,52,53”}]
[(@selList:“cp23”){@listItems:“30,31,35,41,46,47”}]

… which I think means if the selected list name is “cp11”, set the items in that list as shown. And so on for the next 50 or so combinations. I guess this should go somewhere where it will execute only once.

And finally, to pull the required item from the required list …

[(@selList:*){@theCC:#getitem(@dexMode,@listItems)#}{text:#@theCC#}]

… which pulls the CC I need from the list any time a new list is selected. At the moment, everything seems to be working – but tomorrow is another day. Thanks for your help.