Hi all
I have multiple scripts that perform a function depending on the track name. eg colour the track depending on the track name. They all use the same Switch function set.
ie
switch (true) {
// lead vocal
case (trackName.includes('lv')) || (trackName.includes('lead')) && (trackName.includes('vocal')) || (trackName.includes('vox')):
functionToPerform(8, "Section 2", 2);
break
// backing vocal
case ((trackName.includes('harm') || trackName.includes('group') || trackName.includes('chant') || trackName.includes('gang') || trackName.includes('bv')) || (trackName.includes('back') && (trackName.includes('vocal') || trackName.includes('vox')))):
functionToPerform(8, "Section 2", 3);
pickColour(22, 2);
break
Problem is, if i want to add or amend one of the arguments, I have to do it to every single script.
Would it be possible for the Switch set to sit somewhere, and have each script refer to that single Switch set that i can update as I go?
Template is not ideal as I'd have to change my whole folder structure... but if that's the only way, I'd appreciate some help with how to accomplish this.
Thanks all
Best
Alex
- Christian Scheuer @chrscheuer2022-06-16 14:19:20.799Z
Hi Alex,
See here for how to reuse functions across scripts without templates:
- AAlex Oldroyd @Alex_Oldroyd8
Whoop! This looks like exactly what I was after!! :)
Thanks Christian!
- In reply tochrscheuer⬆:AAlex Oldroyd @Alex_Oldroyd8
So do you do this often to stop scripts getting too convoluted?
Christian Scheuer @chrscheuer2022-06-17 13:57:55.611Z
Yes, this is standard practice when building packages for publishing where several scripts will depend on the same code or configuration.
- AAlex Oldroyd @Alex_Oldroyd8
Thanks Christian