Bug: Message box keeps the backslash in \$13, \$24 and \$25 but not \$10 or \$100

tomtomtom's icon

Hello!

I'm learning Max and have been playing around with the message box and following the user guide. I noticed that \$13 should output a $13 but the backslash comes through too. I put "I don't have \$13" in a message box and connected its outlet to the right inlet of a second message box. After I clicked the first box, the second showed "I don't have \$13". \$24 and \$25 do the same. \$10 and \$100 show "I don't have $10" and "I don't have $100" as expected.

I haven't tested many numbers but maybe there's a pattern! Screenshot below.

This is using Max 9.2.1

Wil's icon

HI. There is no bug. It is working as intended

Max Patch
Copy patch and select New From Clipboard in Max.

Try typing [I dont have $13] without the \ .

Also, check the print window

10, 100 are the same as tosymbol

I you want 13 you can use sprint or pak



TFL's icon

It's a funny one. As stated in the documentation, the $ notation to get a specific item from a list into a message only works with up to the 9th element. So $1 up to $9 . So anything above $9 should be treated as actual symbol and not a reference to an item in the incoming list. This is what happens when you type `I don't have $13` in a message box, which gets automatically transformed to `I don't have \$13`, the backslash escaping the dollar sign.

I think there is actually a bug in the auto-escaping mechanism from the message object, which will also accept $1 up to $9 followed by anything starting with 0. Which is why $10, $100, $90 or $20Y8 doesn't get escaped, but $11 $120 $91 or $21Y8 does.

If you send a b c d e f g h i j k into a the tenth letter is $10 you will get the tenth letter is a0 which matches the behavior described in the doc: $1 gets changed to the corresponding item in the list, and what follows (the 0) gets stuck to it. I assume that in this case, the tenth letter is $10 should be automatically transformed to the tenth letter is \$10 after validating. Or keeping it as is, but then $13 shouldn't be escaped either and should give a3 in this case.

I will report this to C74.

Anyway, for message formatting, especially when dealing with Max-specific symbols like $ , I would prefer using [sprintf] for formatting, and [comment] to display:

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon

that is what happens when you use regex to find strings in your compiled objects. :)

but... is it really unintended?

mind you, it can be legit to have #0 - #9 followed by something else than a space character. it always was possible to write #0_foo or #1mycustomname somewhere (and imho it is a nice feature.)

now why would you disallow the user to write #1001? why (or better: how) should max make the decision here what is meant by the user? he could as well want the #1 to resolve as patcherarg.