Forums > MaxMSP

Help – change text line reading depending on int input (counter)

September 21, 2013 | 12:57 am

Hi! I have a text file with multiple lines that I wish for max to read. The idea is that when a bang is received, the number of bangs is counted with a counter (obviously), and that number specifies de line which [Text] should read. For example, if the counter outputs 5, then (line $5), if counter outputs 11, then (line $11). I’ve tried with append but doesn’t work since it leaves a space between $ and the counter output. Please help me! Thanks


September 21, 2013 | 10:07 am

Using sprintf I’ve managed to create a message that allows me to change line with a counter, but when the counter reaches 11, the message starts sending a backslash before de $ (Example: line \$11) and this happens with every number bigger than 10 that cannot be divided by 10. This means that it outputs line \$value for every number except 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, …
I have no idea why this happens, tried to do the same with combine but I get the same output and the same problem

Here is attached the max file so you can see what I’m trying to do, and what happens:

<code>

– Pasted Max Patch, click to expand. –

</code>


September 21, 2013 | 10:13 am

I can’t believe I didn’t realize how easy this is, thought that line $1 meant that text object should read only line 1, and line $2 was line 2… Checked the text reference and saw the int input above the line $1 message and felt like an idiot. Please ignore this post, as it is nonsense. Thanks


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