Working Around 9 Variable Limit in Message Box

Mar 21, 2011 at 4:09am

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:

– Pasted Max Patch, click to expand. –

Thanks!

#55706
Mar 21, 2011 at 4:15am

Just found this post: http://www.cycling74.com/forums/topic.php?id=8708

Totally forgot about sprintf, but I’m not sure if there’s a good solution there nevertheless.

#200301
Mar 21, 2011 at 4:32am

Ok, here’s my disgusting hack using [zl nth], [zl join] and [sprintf]. I hope there’s a better way.

– Pasted Max Patch, click to expand. –
#200302
Mar 21, 2011 at 4:46am

 
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]
 
 

#200303
Mar 21, 2011 at 4:54am

@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.

– Pasted Max Patch, click to expand. –
#200304
Mar 21, 2011 at 6:46am

Couldn’t you just send OSC messages at the source and use osc-route at the receiver?, or am I missing something?

#200305
Mar 21, 2011 at 7:00am

(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?

#200306
Mar 21, 2011 at 8:02am

@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:

– Pasted Max Patch, click to expand. –
#200307
Mar 23, 2011 at 1:54am

http://www.aranarproductions.com/enable_files/13_Lights.zip

The patch I listed uses pak and sprintf to get around the limit.

#200308

You must be logged in to reply to this topic.