Is there an object that makes it easy to change the verb on any message?
eg, [set "Some Text"] -> [remessage append] => [append "Some Text"]
Kind of like prepend, only it lops off the first element before prepending.
You don’t need to look very deep – a simple combination of [zl] and [prepend] will do the job:
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 363.3ocyTtraBCCDEccxWgkWmhhSJMP20ug1cETkIYJXThcTrQkBh+8hGiKO JQ7PfT2DKemIyb8Idxxv.5H0bPSIOSdmDDrLLH.krBAa1GPq3yyK4ZLMZEn0 7w.MxEy.yMnNutFjEjAzWUU.4s0xCn9jDEXJpQSeHM0K9oRZj7J.C8RifW5i HmUIjkfAaXxFwZtIehPN9iFH23LLqW2NwQjjzL6B6wDboWmXxvsURMy3KEam NqEKvNyrujS1ko46ZvUdJkLzFYUXn8QzYBHI705C5e3ScCf.xwoiQF1ERFV6 jIMtGRFFytz2sI9+IXVTRzkhbfvNBTRxtcWWRxhcWPPbzM6DPI4RgRz0Bl1F ozf4zyS2d97DRl9cuqSSXQokB4g+8AMlUeefoUyZx8kxeyfv90aEf1HjbiPI 2II6LEY6AXhnn.v3dWVIJpUBoYiIZ4y245oCZWKdJcOie28zYXIjkWKlVuYU 3OvLZR2F -----------end_max5_patcher-----------
Thanks for the quick reply.
This almost works, but it fails when the first argument is a message recognized by [prepend], like "set"
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 446.3ocuTssbBBCD8Y3qXm7L0Qnnf8s9cXc5DfUMcvDFxR0pS+2KIH0K058w WBvlkcOmydRV45vRTKPMCdAFBNNqbcbrgLAbV+sCaFeQZNWaSikTQjRx7Z1p fSoSExIuWhoTSY760oq250ftsqvn0+grZlPlijsZ9qCJxr0Vk7wSw9rMYppn 8SsID8UA1zNVBWNgAiL69sqqYw6LohDmW2w11Q3BKCXEkBI0FcrRRR9LayXu VJ34ml5QCLOdN7h4dzfCy8taAFsXoEL9Ac5dO4LVfxLfWXdbKjOLpSOOXP7k S93iO32m7+me357BFk.yD+N2+jW9KyM6MWHyTyGFN5ORmFIXFBzTDzjRUnA0 XnNcDpJTx53bBHdRN9VY6+lWuappRZKPv0K1g8MZsefUr6EeIhczlhWV2TBK eGkFTtsea2AQ3kNH7.l8jTyq20ynKyActHEA+awq522JbQG2qFb.4q+g8pAW gDsqtXgf0fr2sxVVXhuqXoUUkoskq8XDrgIYnlDRNIpuydqjFrSRSEYYnb6I elPaLCVFe3qYNW7XtO+z3I5ggm8Z0+fm9ON7XZk+ovS7UhmZu02t+PpmVWC -----------end_max5_patcher-----------
Here I have text coming out of a textedit box going into [zl slice 1] -> [prepend append] -> [print]. The text in the box is "set me the stoops of wine upon that table".
Because it starts with "set", this text never makes it to [print]. And now the next thing I send down the pipe will not be prepended with "append", but with "me the stoops of wine upon that table"!
I think I need an object that removes the old verb and prepends the new one in a single step, so my text never has a chance of being interpreted as a message.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 628.3ocyVF0bhBCDG+Y5L86PFd1igfDwduceNpctI.QM2.ILIKUu149teIAg RskJWEsmynQ2rxt4W18exy2dimepbOS6i9N5djm2yFKdNaVKdsF77Ko6yJnZ mi9YxxRl.7mcXRfsGZlXKUrggnnRdddACsSpx67ZsT.BZIy44OTbZQ2Th5Rt nfAtGOt0JO24pL8WeKoy0JESahME3RwOUrLnI0wyIAgyPQQ3.xLTn86lOPOz KBxZnMDg8yIM+IWNgiB5rWQgrsbwl9QXYXSDbCXRyubAw8m9ys2XGMCyFMHE rclU2a4XkhK.TzjfNh+DxfH2hl3FhWFDGZdEcwvftNUCbnFXHMHkUZTJUoXE 5+YvD8NfYw.fI5TfowW32UrFp36Oy79kZsgAWasCI.aI2hylbmpSbMWogoqM LdjsgXSsQ3koMLJD2FAxT0FNHE2v.jhmijqQqbVW4OIbb9D1S1HKgwKlNYoz Z.jhwubVhGX8fGrkI0TddhVllJIR654xJ1NMmRc2zuulbmsNed7ED.8kYME7 a3OxlDA1jkWQE1C3pQ3AiSBRrJrjyFZVJwx4uTf7HU0AD6j63hb4t6ie3c.q glkLDrs67KiPhweFptRJL1o.BnoErUpt+bgY5LYs.dCn9zUkICrMD+o1FbMK i5LOWqa7BmNcjaegr7hT.+TARWvyXH7zT2dUuY.om7MIYv17lGhq733aq6dp 1INhcZYsJqMSNbiGTuCiyYl1dg6H7dNQdsSaM2jmIdkHl4x8URSYvg73i1PG cpYYNBepbawWStsbLbyJ9+eK3NdIbsRtjQQtulsU6sVFQxkb1Im0fY3uFTCc iA -----------end_max5_patcher-----------
My example works just fine on its own – it doesn’t fail when the first argument is "set" (it works perfectly when the first argument is "set"), but it fails because of [textedit]’s particular behaviour (of prepending ‘text’ to the output) just like DEvo pointed out, in which case just follows DEvo’s comments to fix it. :)
I think we’re misunderstanding each other. I don’t want to slice off the "set". I want to turn the output of the [textedit] — text set me the stoops of wine upon that table — into an append statement — append set me the stoops of wine upon that table. When I said the first *argument* was "set", I meant the second term in the sequence, the first term ("text") being (I think this is the right max lingo) the "message".
[route text] -> [prepend append] fails the same as [zl slice 1] -> [prepend append], by inadvertently sending a "set" message to [prepend].
[route text] -> [zl slice 1] -> [prepend append] would work in this case, but it’s not what I want to do (and it *would* fail if the text was, say, "please set the table").
Looking back I see I confused the issue because my original example did involve substituting "append" for "set" (set "Some Text" ==> append "Some Text").
[substitute] is exactly what I’m looking for, thanks. Specifically, [substitute text append 1] (the 1 prevents unwanted substitutions if "text" occurs somewhere in the text).
Forums > MaxMSP