> teletype : code exchange

llllllll

#663

While scanning through some of the old posts I became really fascinated by the idea of storing pages of grid buttons states and trig patterns as binary. Not coming from a computer science background binary is still a little cryptic to me. After a lot of frustration about how to actually use BSET/BCLR I slimmed the code down to 2 scripts and documented it all here because writing things out helps me a lot.

I’m new to all this so if anything could be better/cleaner please help me out.

#I
G.BTX 0 0 0 1 1 1 3 8 16 6
G.FDR 0 0 7 8 1 2 3 8

#8
J + G.BTNY A; K G.BTNX
IF G.BTNV: P J BSET P J K
ELSE: P J BCLR P J K
A * G.FDRN 6
L 0 95: $ 7

#7
K + A / I 16
G.BTN.V I BGET P K WRP I 0 15

#664

thank you! incredibly helpful to a fellow binary struggler


#665

that’s great, thanks for documenting it! i’ve linked it to one of the grid studies.

noticed a couple of typos, under “Manage presses” point 5 should say 96 in “Loop 95 times” and under “Update buttons” in “32-47 becomes 3” it should be 2 instead.


#666

Thanks for catching those and for sharing. :pray:It’s like being quoted by the prophet who’s words you live your own life by.


#667

forgot to mention one more thing: it shares the same script for both the buttons and the fader, which is fine for this scene but might cause potential issues if you add more buttons. if you press one of the added buttons and then press the fader it might cause one of the pattern values to change as well. this can be fixed by either using 2 different scripts, or creating the fader and other controls in a different group and then using G.GRPI to check which control called the script.