Page 1 of 1

Pass message as a string to variable

Posted: Fri Apr 30, 2021 7:21 am
by Abuwabu
This is probably a bit of a newbie question here but how do you concatenate a message string so that the whole thing passes as a variable? For example in the patch here "Pan" and "id" are passed when clicking the message boxes; but I'd like "Pan A" and "id 20" to be the variable.

Patch:

Code: Select all

----------begin_max5_patcher---------- 521.3oc0VssSbCCD84juBKSeLfV6ba21Wn+.n1mqPUlDCXTVmHamvVg3euYFmTVZCYAT.Q0p0VywS7wmwyLI2EFPundmzRIel7CRPvcgAAHD.DLXGP2J1UTIrnaTs715KtgF4WxI24PXGwB+FwUkHZumGyFwZDthqU5q9oQV37TlFyNYUDgmmASIqPi9Qx4COitcqRWIcH2rG.qacinwCndH2uZj98lRiF9SNG739vPXH5YpysRqUbk7eD52DZxWmPlYypyz0nz3afo3r40IeRcxdRctn5yVXTMNh+ZtW.jJUm7jRknhbZmvnEakjOwlH.jjOS.fml6UNFGXaR9eJBL3H4TvkoEeZ1LhOY8l8Eed9G.w+TkwWqrnBjloTIe1bb7RMINElx3ulZY9r0x+YmrhtwEN5LXoGcrIzu.CG8cXTpK8HuQoHkxKEsUPVguPwmxLUrat9C4L99YHoejaPnJ6OYSU+udtjiUw62.j8FpObKoUJ8e+dM7XA3OVz15VSw3VM7BKxCGrRo0ozBmpVumOPyNvoIiquDhXGfHnwxhPD+PDwV.hfbfCF6VBhxXuSDMdQOeriu.Lkxd2XJ60wjuxRzzzIM1AuQR5abbSsALWGglJs2DKYoFYmZzelGRX56P35aOzZvSFcWVB0+r0kRitUgNGB5qmSrqD7oG8c48RAadEde3uADEV9cG -----------end_max5_patcher-----------

Re: Pass message as a string to variable

Posted: Fri Apr 30, 2021 8:02 am
by Abuwabu
I found "tosymbol" which gets me most of the way there. The 'live.object' however is still not created using the whole symbol.

Patch:

Code: Select all

<pre><code>
----------begin_max5_patcher----------
550.3ocyVEsaaBCE8Y3qvxcOxhvNACz9R2Ovz1ySUSNfWqq.Cx1vRUU+2G1F
qtzQSBUrnjHYKe8Eetmqu2C7bX.bayNlBBtF7CPPvygAAVSFCAiqCf0zcEUT
k0Mnf86lsOBibaoY6zVy5F0S0aap7avKslGb8yXuMQWMWTwz1CBMZrkpKdfK
t+mRVg1EHn0Xzp3H.JljalSVaFwwqhA285Q0zoe6Y4Loepk4NHHDbmYmWBCM
CQmHEqYJE8d1+vwuQEfuLAAInIYH9PLLk3XHJyLulbYvPUgj2pAt63gnETw6
YqJ4zJvs8TofVy.eBMQJXS5rSAwDWJ.kjXmy2bglCFcDbqwkooeBY1zGmmsG
8SSOuz+85iefqrgKSNEO+.8xDa2KBiwlYB9HzD+tzLxR0wsUzd+FW8UyV6E3
.3Mlgq9tYjIJcV9OUlTx9EsqxTY3ZWbkMSk8luNQxnRnuJIgbYTk.Tl+SIDj
+gU6G9Yl2DeDJt9fUHQKsd.ubHXlhoYyW02+dsQUezxbYZeZXEW712jaiAi8
8ospoSV3OJ+kF30fnjozbAUyaD+sSoNmlL0NKjvGAISexxfD5XHQV.jvmRxK
eA.hfNAjvKQtK6LAjO+e3KoEAIz4BIeexbQx0ESaa6YR0n2VPFjodrQZVlEY
WxEtkV4Anj0y89iblnxAoG8ftSmzFYvcjMP2y1TxjhNt04PC+FvzpAZ91tgW
f5nhUpL7kv+.8+eyOA
-----------end_max5_patcher-----------
</code></pre>

Re: Pass message as a string to variable

Posted: Fri Apr 30, 2021 12:26 pm
by chapelier fou
or just put the " " inside the message boxes.

Also look at [join] which makes lists out of anything.
and [sprintf] that let you format messages using variables.

Re: Pass message as a string to variable

Posted: Fri Apr 30, 2021 12:28 pm
by chapelier fou
May I ask what your goal is ?

Re: Pass message as a string to variable

Posted: Sat May 01, 2021 1:09 pm
by Abuwabu
Thanks Chapelier

The message boxes are being generated on the fly. Sprintf is a good solution.

Thanks for the pointers. Half the battle at the beginning is knowing what objects are available to you.

Re: Pass message as a string to variable

Posted: Sat May 01, 2021 3:34 pm
by chapelier fou
Help files and their “see also” sections are the real MaxMSP manual, it’s good practice to always go check them.

Re: Pass message as a string to variable

Posted: Sun May 02, 2021 8:43 am
by Abuwabu
Indeed. As a developer I am used to picking through API documentation. I didn't actually know there was a Max/MSP manual; I just went straight for the help files for each object. Pleased to see they are so well documented. So far my experience with Max/MSP has been really good.

Re: Pass message as a string to variable

Posted: Sun May 02, 2021 11:27 am
by chapelier fou
There is no manual indeed.