Forums > MaxMSP

Help with using $1 in messages

August 12, 2011 | 2:36 am

I’d like test$1 to work the same way that $1test does. Is this possible somehow? See the attached code.

`

– Pasted Max Patch, click to expand. –

August 12, 2011 | 3:21 am

The following works. (But in situations such as this you can also question whether the exigencies you have created for yourself are really strictly necessary. That is, could you change your requirements so that 2test would be satisfactory?)

– Pasted Max Patch, click to expand. –

August 12, 2011 | 3:24 am

Ah thank you. Yes I will investigate just changing the format needed, I was just curious as to if there was a to format it or something so that it knew what I was doing, like a test"$1" or something like that. Thank you for your solution!


August 12, 2011 | 8:41 pm

[sprintf] or [combine] or [regexp] are needed to attach variables *into* symbols, as part of the symbol. Without using them they’ll typically turn into "test 2", the way messages deal with $1 etc. This is also important when using #1 etc. as arguments in abstractions, or if you want to use [forward] with different symbols:

– Pasted Max Patch, click to expand. –

Viewing 4 posts - 1 through 4 (of 4 total)