Hi! I have a question regarding my regular Teletype scene. I want to add some functionality to it, but I think I need to consolidate some code to make more space. I’m specifically looking for a way to consolidate my Scripts 7 and 8 into one script. What they do is serve as my Previous and Next sequence buttons on the grid. They define variables X and Y, which are pattern start and end, and uses the O command to increment or decrement (depending on whether I invoke Script 7/Previous or Script 8/Next). Variable Z sets the number that it increments by, so I’m using Z to set my sequence length.
I’m using Grid Ops to invoke all of it. I’m using a radio button (G.GBX) to set variable Z and I’m using two separate G.BTN buttons to invoke Script 7 and Script 8 separately.
I’d love to figure out a way to set variables X and Y (patt start/end) using one script, and perhaps using a G.GBX type button. But I’d still like to use Var Z as the sequence length or amount to increment X and Y.
Does that make sense? I’ve pasted my code below. I was thinking that perhaps LSH and RSH or maybe there’s a good way to do this with bitshifting but I have a lot of trouble getting my head around using bit style code. Any help is appreciated!!!
#1
CV 1 VV PN.NEXT 0
TR.P 1
#2
CV 2 N PN.NEXT 1
TR.P 2
#3
L 0 3: PN.START I X
L 0 3: PN.END I Y
L 0 3: PN.I I Y
#4
DEL 20: TR.P 4
#5
IF EQ G.BTNV 0: BREAK
G.GBTN.L 2 5 5; G.BTNL 10
Z G.BTNX
#6
IF EQ G.BTNV 0: BREAK
G.GBTN.L 3 2 5; G.BTNL 10
A - 64 + G.BTNX * G.BTNY 16
C PN 3 ABS A
D PN 3 + ABS A 1
L X Y: PN 0 I RRAND C D
#7
IF EQ G.BTNV 0: BREAK
O SUB X ADD Z 1
X O
Y ADD X Z
#8
IF EQ G.BTNV 0: BREAK
O.INC ADD Z 1
X O
Y ADD X Z
#M
#I
G.BTN 1 0 0 1 1 0 5 3
G.BTN 2 14 0 1 1 0 5 7
G.BTN 3 15 0 1 1 0 5 8
G.GBX 2 4 0 2 1 1 0 5 5 16 1
G.GBX 3 22 0 4 1 1 0 5 6 16 4