On 05/20/2018 02:12 PM, Derek Kwan wrote: > As a side note, I don't really particular about this situation right now > and don't have a use case as of yet, but it looks like both the $$ > approach and the tosymbol approach don't work with trying to insert > literal "$0, $1, $2" and so on in [text]s the "patching" sort of way via > [text insert]? You can enter those literals just fine via the popup Pd > text window and those will save just fine, but both the $$ and tosymbol > methods via [text insert] yield input that looks to be their escaped > \$0, \$1 versions within the popup Pd text window and then when you try > to save the contents of that window they get resolved (so $0 goes to 0 > and $1 yields \\$1: argument number out of range warnings).
Yes, the escape mechanism seems to be a bit quirky at times. For example, in the attached patch create-arrays5.pd, the array names are being created the way described above in the thread and put into a [text] object, where they occur escaped. The contents of the [text] can be saved with the patch. If you create the arrays from the [text] after writing to it, the arrays are created fine. But if you reload the patch, $0 is escaped in the array objects, although the contents of [text] look exactly the same. Maybe a bug, maybe some quirk. Anyhow, there is a solution for writing $0 into [text] and easily generate objects from there that is robust against saving the [text] contents with the patch, using [text fromlist], which is demonstrated in the attached patch create-arrays7.pd. :) best wishes, ingo
#N canvas 367 109 403 667 12; #X msg 37 103 5; #X obj 37 149 until; #X obj 37 172 f; #X obj 67 172 + 1; #X obj 37 287 text set \$0-arraynames 1e+06; #X obj 97 172 mod; #X obj 37 126 t f f b; #X msg 139 149 clear; #N canvas 772 427 231 201 \$0-arrays 1; #X restore 37 34 pd \$0-arrays; #X msg 131 425 clear; #X obj 131 448 s pd-\$0-arrays; #X obj 37 379 text size \$0-arraynames; #X obj 37 425 until; #X obj 37 448 f; #X obj 67 448 + 1; #X obj 97 448 mod; #X obj 90 494 text get \$0-arraynames; #X obj 37 359 bng 15 250 50 0 empty empty create_arrays 17 7 0 10 -262144 -1 -1; #X obj 37 402 t f f b; #X obj 37 609 s pd-\$0-arrays; #X obj 37 517 + 30; #X obj 37 494 * 23; #X obj 37 83 bng 15 250 50 0 empty empty write_to_text 17 7 0 10 -262144 -1 -1; #X obj 139 172 text define -k \$0-arraynames; #A set \\\$0-snd0 \; \\\$0-snd1 \; \\\$0-snd2 \; \\\$0-snd3 \; \\\$0-snd4 \;; #X obj 131 402 loadbang; #X obj 37 471 t f f; #X msg 37 195 symbol snd\$1; #X obj 37 218 list fromsymbol; #X obj 37 264 list tosymbol; #X obj 37 241 list prepend 36 48 45; #X msg 37 586 obj 30 \$1 array define \$2; #X obj 37 563 list; #X connect 0 0 6 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 2 0 26 0; #X connect 3 0 5 0; #X connect 5 0 2 1; #X connect 6 0 1 0; #X connect 6 1 5 1; #X connect 6 2 7 0; #X connect 7 0 23 0; #X connect 9 0 10 0; #X connect 11 0 18 0; #X connect 12 0 13 0; #X connect 13 0 14 0; #X connect 13 0 25 0; #X connect 14 0 15 0; #X connect 15 0 13 1; #X connect 16 0 31 1; #X connect 17 0 11 0; #X connect 18 0 12 0; #X connect 18 1 15 1; #X connect 18 2 9 0; #X connect 20 0 31 0; #X connect 21 0 20 0; #X connect 22 0 0 0; #X connect 24 0 9 0; #X connect 25 0 21 0; #X connect 25 1 16 0; #X connect 26 0 27 0; #X connect 27 0 29 0; #X connect 28 0 4 0; #X connect 29 0 28 0; #X connect 30 0 19 0; #X connect 31 0 30 0;
#N canvas 342 88 426 699 12; #X obj 57 149 until; #X obj 57 172 f; #X obj 87 172 + 1; #X obj 117 172 mod; #X msg 159 149 clear; #N canvas 772 481 231 201 \$0-arrays 1; #X restore 37 34 pd \$0-arrays; #X msg 131 471 clear; #X obj 131 494 s pd-\$0-arrays; #X obj 37 425 text size \$0-arraynames; #X obj 37 471 until; #X obj 37 494 f; #X obj 67 494 + 1; #X obj 97 494 mod; #X obj 75 540 text get \$0-arraynames; #X obj 37 405 bng 15 250 50 0 empty empty create_arrays 17 7 0 10 -262144 -1 -1; #X obj 37 448 t f f b; #X obj 37 632 s pd-\$0-arrays; #X obj 37 563 + 30; #X obj 37 540 * 23; #X obj 159 172 text define -k \$0-arraynames; #A set \$0-snd0 \; \$0-snd1 \; \$0-snd2 \; \$0-snd3 \; \$0-snd4 \; ; #X obj 131 448 loadbang; #X obj 37 517 t f f; #X msg 57 195 symbol snd\$1; #X obj 57 218 list fromsymbol; #X obj 57 264 list tosymbol; #X obj 57 241 list prepend 36 48 45; #X msg 37 609 obj 30 \$1 array define \$2; #X obj 37 586 list; #X obj 37 333 text fromlist \$0-arraynames; #X msg 37 103 5; #X obj 37 83 bng 15 250 50 0 empty empty write_to_text 17 7 0 10 -262144 -1 -1; #X obj 37 126 t b f f b; #X obj 37 310 list store; #X msg 57 287 append \$1 \\\;; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 1 0 22 0; #X connect 2 0 3 0; #X connect 3 0 1 1; #X connect 4 0 19 0; #X connect 6 0 7 0; #X connect 8 0 15 0; #X connect 9 0 10 0; #X connect 10 0 11 0; #X connect 10 0 21 0; #X connect 11 0 12 0; #X connect 12 0 10 1; #X connect 13 0 27 1; #X connect 14 0 8 0; #X connect 15 0 9 0; #X connect 15 1 12 1; #X connect 15 2 6 0; #X connect 17 0 27 0; #X connect 18 0 17 0; #X connect 20 0 6 0; #X connect 21 0 18 0; #X connect 21 1 13 0; #X connect 22 0 23 0; #X connect 23 0 25 0; #X connect 24 0 33 0; #X connect 25 0 24 0; #X connect 26 0 16 0; #X connect 27 0 26 0; #X connect 29 0 31 0; #X connect 30 0 29 0; #X connect 31 0 32 0; #X connect 31 1 0 0; #X connect 31 2 3 1; #X connect 31 3 4 0; #X connect 31 3 32 1; #X connect 32 0 28 0; #X connect 33 0 32 0;
signature.asc
Description: OpenPGP digital signature
_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
