if i understand correctly what you’re trying to do the easiest way is to use non latching buttons and G.LED to indicate the current position (although you could also do it with latching buttons, using the buttons themselves to display the current position).
let’s store the current position in pattern bank 0 (as we’ll probably want multiple playheads). so what we need is:
- a script that advances the current position and displays it on the grid - let’s use script 1 for this
- a script that gets triggered when a button is pressed and resets to that position, we’ll use script 2
first we need to create the buttons. add this to the I script and execute:
G.BTX 0 0 0 1 1 0 0 2 16 1
this creates a row of 16 momentary buttons which will trigger script 2 when pressed. script 1 then looks like this:
G.CLR
PN 0 0 % + 1 PN 0 0 16
G.LED PN 0 0 0 15
this clears the currently displayed LED, advances it, and displays the new position by setting the corresponding LED level to 15. this is where you would also want to update CV outputs accordingly (for MLR if i understand correctly you want something like CV 1 N PN 0 0 which will output 1V/oct CV determined by the current position).
now script 2 gets triggered whenever a button is pressed (or released since it’s a momentary button). this is where we set the position according to the button pressed, and you’re right, G.BTNI will be useful here (we use IF G.BTNV so it only resets on press, not release):
IF G.BTNV: PN 0 0 % + G.BTNI 15 16
adding 15 here has the same effect as subtracting 1, with proper wrapping - the reason we want to do this is that when script 1 advances to the next step you want it to be the step we selected.
that’s it! disclaimer, i’m not near teletype right now so can’t confirm, but i think this should work. i gotta run for now but will add how to make it multi row in a bit.
edit: fixed some typos
edit2: fixed more errors