Working Around 9 Variable Limit in Message Box
Greetings list,
I'm porting a patch from PD that uses message boxes with more than 9 variables, i.e. ($1 $3 $13). The message boxes are used to format OSC commands. How can I work around this?
Unfortunately I can't just split the list because some messages take variables >9 spaces apart.
Please have a look at this patch:
Thanks!
Just found this post: https://cycling74.com/forums/11-12-13
Totally forgot about sprintf, but I'm not sure if there's a good solution there nevertheless.
Ok, here's my disgusting hack using [zl nth], [zl join] and [sprintf]. I hope there's a better way.
if the input is of a constant lenght, and the type of the variables
is known, you could just use list/pack/pak.
stupid 100 200 300
|
"set $1 thing $2 $3 $4"
==
[list set x thing 0 0 0]
@Roman I'm not sure I understand.
(1 2 3 4 5 6 7 8 9 10)
|
[pak $10]
==
"$10"
I need to access the nth element of a list and pack it into a message. See my final (ugly, but hidden) solution below using nth and join.
Couldn't you just send OSC messages at the source and use osc-route at the receiver?, or am I missing something?
(1 2 3 4 5 6 7 8 9 10)
|
[unpack]
||||||||||
[pak 0 0 0 0 0 or have some symbols and a 7 here 0 0 0 0 0]
no?
@spectro I can't modify the receiver's API
@Roman Oh, I see. Indeed that would work, though it would lead to a mess of wires. At this point I have it working with my convoluted [zl] mess and its sufficiently abstracted, so I think I'll leave it that way.
Thanks for the suggestions. For those in the future, here's the basic idea:
The patch I listed uses pak and sprintf to get around the limit.