First time here? Check out the FAQ!

Generating green variable names in a script

0 votes

Is there a way to generate a series of green variable names, so i can use them in a script futher up my sound.

My code is this:

1 to: 4 do: [ :i |
output start: 0 s
parameter: '?ControlOut' & (i asString)
ccNumber: i.

I'm trying to generate ?ControlOut1, ?ControlOut2, ?ControlOut3, and ?ControlOut4. And even more later.
All of this is used in MIDIOutputController. I want to be able to assign things to the ?ControlOut1 and so on, later up my chain in another script.
But when I run this I get this error message. What do i need to do to a string to get it accepted as a ?-variable


asked Apr 29, 2022 in Capytalk & Smalltalk by anders-skibsted (Adept) (1,320 points)
Could you do it all in one Script rather than in two stages like this?

1 Answer

0 votes
pretty sure you can't create green variable names in that way...


but you can create ConcreteEvents ( HotValues ) in a similar way,

1 to: 4 do: [ :i |
start: 0 s
parameter: (('ControlOut' & i) asHotValue)
ccNumber: i.
answered Apr 29, 2022 by cristian-vogel (Master) (8,370 points)
Yes, the asHotValue was why i thought it might work with green variables as well…
But i Found out it works with a replicator, so the suffix or prefix Will be added to the  ?ControlOut and then be adressed from a script. So there might be a Way to do it