> teletype: grid # code exchange

teletype

#205

@EqualTemperament suggested using SCENE op as a way to extend scripts - dedicate one scene to setting up your grid controls and then call it from the main scene.


#206

Wow! Why did I never think of this? That will open up lots of possibilities. Thanks!!


#207

This post (Teletype 3.+ feature requests and discussion) gave me a MS EXCEL flashback. Not exactly the same as a norm dist OP with mean and std, but you can calculate it outside and provide it as a discrete lookup table.

edit: One thing I have to fix is not every $1 trig provides a value.

edit 2: need to fix output binning, skews to right.

Edit 3: I think I fixed it. Also using local K to free up global R at the expense of 1 line.

LAS VEGAS WEEKEND V3
RANDOM FROM DISCRETE DISTRIBUT
-----
PN 0: LOOKUP DIST (/100)
PN 1: OUTPUT DIST (COUNT)
$ 1: STEP BY 1
$ 2: STEP BY 1000



#1
P.I 0; J P.HERE
K RRAND 0 99
W <= J K: J + J P.NEXT
PN.+ 1 P.I 1

#2
L 0 1000: $ 1

#I
INIT.P 1

#P
...
5	0	0	0
11	0	0	0
21	0	0	0
26	0	0	0
21	0	0	0
11	0	0	0
5	0	0	0

#208

The code for Grid ops is extremely complicated to me at the moment, dunno if I’ll ever get my head around it.


#209

Is it perhaps that there is so much available? (of course a good thing). When I first came across it I was a bit overwhelmed - and I’m not a coder. So I set myself some simple tasks - like light up each button going right to left and when all buttons are fully lit - clear and start again. Do the same for going up and then down; throw in a little random. Found it useful just to get the feel of it.


#210

this study should be a good start: https://github.com/scanner-darkly/teletype/wiki/STARTING-SIMPLE


#211

I’ve tried this technique with SCENE to extend scripts, but I’m not sure to understand how to implement it, it has to be called manually, is that correct ? If I call a SCENE from another one, it won’t execute the INIT script of this second SCENE ? Is it possible to provide an example of how to use this technique please ?


#212

yeah, it doesn’t execute init when you use SCENE:

but i think there are several ways to work around that (disclaimer: i haven’t tried any of this, just brainstorming). let’s say scene 1 is your main scene and scene 2 is the grid controls setup.

the easiest solution is to manually execute the init script. so in scene 1 init you do whatever you need to setup in your main scene and then the last line does SCENE 2. at this point it loads scene 2, you press F10 (or use grid control to execute init if you have grid already connected), it does what it needs to do and then as the last step executes SCENE 1.

a variation of the above that could make it easier: in scene 2 you create an extra button somewhere that executes the init script, and in the init just before it switches back to scene 1 you hide the button so it’s not in the way. this way you don’t have to switch to grid control mode.

another option: do initialization in metro script in scene 2. so, scene 1 loads, the init script switches to scene 2, at the next metro execution it will create all the grid controls and switch to scene 1. in this case you have to make sure you don’t put SCENE 2 in your scene 1 metro, otherwise it’ll create an endless loop!


#213

Thanks for your reply and this detailed explanation. I will try one of these solutions.


#214

YEAH (+ 16 characters)


#215

Just wondered whether there could be an option on this - either at firmware load or specialised word?


#216

yeah, perhaps a separate op which could be marked as “experimental” similarly to M!. this thread is a better place for discussion: Teletype 3.+ feature requests and discussion do you want to post there?