send variables thru command id packages
hello,
I'm chaining 4 scripts together using the sf.soundflow.runCommand with the next script commandId.
I would like to send a variable from the 1st in line to the 3rd. I'm storing it in globalState and works, but was wondering if theres a different way.
Thank you
Chris Shaw @Chris_Shaw2021-02-05 18:23:10.597ZFrom what I understand, using
globalStateis the best, easy method for doing this as it requires the least amount or script rewriting.
Chris Shaw @Chris_Shaw2021-02-05 18:24:10.752ZHaving said that, I'm sure Christian or Kitch may offer a better solution :).
In reply tosamuel_henriques⬆:Christian Scheuer @chrscheuer2021-02-05 18:48:48.767ZYou can set the "result" (output) of a script like this:
event.setResult('test result');So, in the script that calls it, you get the result out like this:
var res = sf.soundflow.runCommand({ commandId: 'package:ckimmgdb20000yh10z0t280w7', }).result; log(res);You can also give a script input (arguments) like this:
sf.soundflow.runCommand({ commandId: 'package:ckimmgdb20000yh10z0t280w7', args: { arg1: 'test123', }, });You fetch that argument "arg1" like this:
log(event.arguments.arg1);
Christian Scheuer @chrscheuer2021-02-05 18:50:03.467ZInstead of this though, you may want to use modules and require syntax instead.
Please see here for an example of how to use that:
samuel henriques @samuel_henriquesAwesome guys, and thank you so much!!