This has been driving me mad for the past hour or so, so I thought I’d ask for some help.
I have a number and a list.
Lets say the number is 4 and the list is 1 2 3 4
I want to format this for use with [forward] so i need it to read:
send actor4, 1 2 3 4
I’ve been trying to adapt some [sprintf] and [regexp] examples from other posts but don’t understand these enough to get this right.
Any help would be appreciated,
Here you go :)
----------begin_max5_patcher---------- 492.3ocuUtsbaBCDF9Z3oXGMStilAIaGW2WfdS6SPISGgzZiZ.IFIQiSyj28 BB7XRsaLNG7M5vxxt+6G6N7XbDI2rEcD3KvOfnnGiihBl5LDMbOhTw2JJ4tf aDgopB0dRR+y73VevdFAcBdMlQ.eABYjj1S2q7E.Gx4h6bsQn.7Ff+aiRBem uEPq0Xc6hToRiBSiNDN1fQcSkowWh9PxSGrVy8hBkdyOsnv2K9aRuNMAnoK5 1XoztsYsWfaGdm0Fs2o9C14Nkc8tPs1tIuOBg.regN5caUgRuSDzAiJYntM4 +5STFYTVz7pPVHeqQnjb3qVtVhjNGdJNtaIYhrtMu4nkbTVv9+rfFfv7v5hP wvFWM8Aw+PM16NQ084DH4b8Fxo30oPwpOFRTgNGeCdPWGEXvLX9wQD8EPzP+ ROiXgyqdIFcdfgcHXV9A0hf22F8C3RsUseFcxCQ83XXHZ1mOny4U1Sr3hV5d i6gpbS4qsmnet4l4mdt4MOrvtnfwEZJVCNTKAtvarWUJyxRfqbmOqBPZYe+x 6OqNx7C87XUHcg+o7O+cKTLc1eN.clFqXmXGxGrudjnyqzbuxnG4yhm4SgRJ Q83QrJkr1zx7AI.2dzOlSUQqlfhnWTEwlnhnWLEsbBJh8FXT6kmh+K.hjeh5 -----------end_max5_patcher-----------
Here’s a way to do it, using [sprintf] and [zl join]:
----------begin_max5_patcher---------- 924.3oc2XssiaBCD84juBKjpZqT5J7EHPeqeG6FUQ.mf2Rri.m8p5+d8ERB6 tABjRH6tRQ33gam4LGFOddd7Hm4hGnENfeBtFLZzyiGMxXRaXT47QNqhdHNK pvbYNwhUqnboyD64jzGjF6eKJSRy4QR1czrGA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7gCFlfgsMxcpXRM4ui+GvRrZXN -----------end_max5_patcher-----------
Where did you get stuck? Was it in creating the "send actorX," or in joining that to the list? If it is always ever going to be numbers you can simplify it, so it depends of course on the application.
Hope this helps :) (remember that when needing to format in a comma, you need to add a forward slash before the comma)
Hmm, mine doesn’t work when feeding [forward] – use laonikoss’s
So simple when you know how!
If anyone knows of some good tutorials to help understand sprintf, I’d love hear about them.
Aah yes, thanks for your version laonikoss.
I got stuck with adding the comma to the word actor. I could only get actor4,
Really through my lack of understanding when it comes to sprintf though…
Just a note: You don’t need to mess with a comma at all. The commas in the message boxes in the forward.help file are just there in order to combine two messages in a single clickable message box. But you can just use sprintf to construct the desired receiver name (such as "actor4"), then tell forward what you want to send.
By the way, the help file for sprintf has a link to an informative Wikipedia page (can’t get much more helpful than that!), although that’s probably way more information than you want or need, so GIYF.
----------begin_max5_patcher---------- 404.3ocyUF0aBBCDG+Y3SQSS1aNCWEQcusOGKlkJT0t.sj1ZzMie2GsfLzfF 1D21KWfqG89e+50i89d3ExcLMF8D5Ejm2deOOmKqCup28vYzcwoTsKLbFSqo qX3AkqI2XRYFy64rxMAiQyqVZoTXz7ObK.jgAUtyol30bwpWUrXS4GQHgEKi lEYsQSrVX5vf5chm3RsbwaOBvwLK1jwEE41IKRibJnYtbheVwooMBuTqt3Aq yC99VyfNV4B11BEbb+LrcN0iUHZrQpB6WhLg3XgiKiAqkDzNQlzJPB9E.xYs B0DAPDzHT+BjQNdDF3rWsCI5OqA4R7neIA.MPQAVFeYTD9e6txRoZKUkf+gG +kCHt90ARq0L7Mq4f9ql04JtvrDoYhjxQEOjbOZHJmU.jfqQGnWnSyNBWVvo bw4+FwoTq+SQlVtQEerbqleg9RqILsgKnFtTzHF6TeDTGzZdRBSzbLWFOIWV f4JMfl254WWkTTGjD4jXt2JB5eEADvN6X5LqMr94aTngc4z7FPWwKG7+DvgO 8eI -----------end_max5_patcher-----------
@ Christopher, Thanks for pointing that out… I can’t believe I didn’t notice that! Actually I didn’t realize message boxes worked in this way, so that’s probably the most useful thing learned today.
As for the sprintF commands, Probably there’s no shortcuts to learning that stuff, just a shame Google can’t break it up and feed it to me a bit at a time, perhaps while I’m sleeping?
What Christopher said. The comma in message boxes has been the stumbling block of many a Max user. Once you know that it’s just a shorthand for combining messages into a single message box, things get a lot easier.
When not using the comma, you just need to make sure the order in which the messages arrive at [forward] is correct – i.e. you must first send the [send actor4] message, and then the list you want to send to "actor4", or whatever.
sprintf comes from C (programming language) – as the help page for [sprintf] says, "For complete documentation, refer to a standard C library reference manual." which I guess answers your question as to where to find more information.
Forums > MaxMSP