(mod note: started a new thread for this topic as it could become a longer topic)
combining scripts is not necessarily hard, but it also requires quite a bit of attention to the inner-workings of both scripts you want to combine.
what @Dan_Derks suggested is correct in terms of tracking some sort of
focus variable and switching your
redraw, and grid(…) functions.
but there are quite a few other things that will possibly get messy:
- if both scripts have same-named variables or tables
- if both scripts are trying to control or interpret the same MIDI ports or softcut or (etc)
- DEFINITELY if both scripts are using an ENGINE this will not work, unless it’s the same engine, but that still may be difficult to navigate depending on the context.
but others would be very simple to merge. i could see a simple tutorial where:
- script 1 takes input into softcut and makes a parameterized echo effect with custom screen/enc controls
- script 2 is a sequencer that loads an engine and has a full interface
combining these two and then assigning a “switch view” control (such as ENC 1, given both scripts didn’t use it) would be very trivial.
a more in-depth option for “modular” recombinatory (that’s not a word i guess) would require following some very specific conventions to ensure that things worked together consistently— a task which might be hard to achieve. essentially scripts would need to be written as libraries with very thin “launcher” wrappers (and there could be wrappers to combine a stack of scripts, if they are compatible)
but again the current approach to DSP using supercollider right now is limited.
and some of these ideas end up being difficult to reconcile from a design perspective given the goal of easy accessibility for norns scripting. it’s important to keep this goal in mind— but there may be an elegant solution for combining/layering scripts.