Hi list,
please have a look at the patch I have attached.
I am trying to build a patch that reads from a txt file then outputs the text into Gem. I have done this. But I have a few questions that would help me take it further.
At the moment I am getting a lot of errors, its probably something simple but I have not found what it is yet?
One of the things I would like to do is get a piece of ascii art into Gem via a txt file, how do I get Gem to leave the spaces in? at present it just ignores more than one space.
I have the text moving up the screen, how would i get it to read each line of the txt file in order one at a time and display them without killing the previous line (think titles at start of starwars, ish).
Any other comments and advice greatly appreciated.
thanks
dominic
samuraiskillz@blueyonder.co.uk wrote:
Hi list,
please have a look at the patch I have attached.
I am trying to build a patch that reads from a txt file then outputs the text into Gem. I have done this. But I have a few questions that would help me take it further.
At the moment I am getting a lot of errors, its probably something simple but I have not found what it is yet?
As I removed the connection between [textfile] and [text3d] I didn't get any errors - your patch seems to work properly. To ensure showing all words of a line add "list" to the begin of every line in your text file.
One of the things I would like to do is get a piece of ascii art into Gem via a txt file, how do I get Gem to leave the spaces in? at present it just ignores more than one space.
AFAIK [text3d] displays elements of a list and I don't know a way to generate an element of list with a blank. You'd want to use an escape character to code blanks in lists - AFAIK pd doesn't support such a thing (does it?).
I have the text moving up the screen, how would i get it to read each line of the txt file in order one at a time and display them without killing the previous line (think titles at start of starwars, ish).
What about one [text3d] for every line, moving up? It'll be a little bit sofisticated to synchronize all the [text3d] with one [textfile] - maybe you could try one [textfile] for every [text3d]?
br, piotr
Hallo!
I have the text moving up the screen, how would i get it to read each line of the txt file in order one at a time and display them without killing the previous line (think titles at start of starwars, ish).
What about one [text3d] for every line, moving up? It'll be a little bit sofisticated to synchronize all the [text3d] with one [textfile] - maybe you could try one [textfile] for every [text3d]?
all the text objects of the current gem cvs support multiple lines now - so you can load them in one object ... but you have to compile the gem version from cvs your self of course ...
LG Georg
br, piotr
Piotr Majdak wrote:
AFAIK [text3d] displays elements of a list and I don't know a way to generate an element of list with a blank. You'd want to use an escape
if you want words, just use separate list atoms: a 3-atom list "1 2 3" will result in a text "1 2 3" (with blanks!) if you really want symbols with blanks, use [makefilename] and or [list2symbol], but there should be no need for it here.
character to code blanks in lists - AFAIK pd doesn't support such a thing (does it?).
I have the text moving up the screen, how would i get it to read each line of the txt file in order one at a time and display them without killing the previous line (think titles at start of starwars, ish).
What about one [text3d] for every line, moving up? It'll be a little bit sofisticated to synchronize all the [text3d] with one [textfile] - maybe you could try one [textfile] for every [text3d]?
yes, i'd also suggest using something like multiple [text3d]s. in the current CVS of Gem, the text-objects support multilined text (but you are on your own to generate a linebreak within a list!). it really depends on the text you want to do, whether this fits or not (e.g. if you have 1000 lines of text but you only want to display 5 lines at a time, you might be better off using 5 [text3d] objects instead of going through the hazzle with linebreaks)
mfg.asdr. iOhannes
Thanks for the advice everyone.
Yes the error was obvious, sorry.
The blanks is causing a problem as in some ascii art there can be just one character placed at any point on a line. But I need to keep the formatting of the line.
I'll have a play around with multiple text3d's
Cheers
dominic
Piotr Majdak wrote:
AFAIK [text3d] displays elements of a list and I don't know a way to generate an element of list with a blank. You'd want to use an escape
if you want words, just use separate list atoms: a 3-atom list "1 2 3" will result in a text "1 2 3" (with blanks!) if you really want symbols with blanks, use [makefilename] and or [list2symbol], but there should be no need for it here.
character to code blanks in lists - AFAIK pd doesn't support such a thing (does it?).
I have the text moving up the screen, how would i get it to read each line of the txt file in order one at a time and display them without killing the previous line (think titles at start of starwars, ish).
What about one [text3d] for every line, moving up? It'll be a little bit sofisticated to synchronize all the [text3d] with one [textfile] - maybe you could try one [textfile] for every [text3d]?
yes, i'd also suggest using something like multiple [text3d]s. in the current CVS of Gem, the text-objects support multilined text (but you are on your own to generate a linebreak within a list!). it really depends on the text you want to do, whether this fits or not (e.g. if you have 1000 lines of text but you only want to display 5 lines at a time, you might be better off using 5 [text3d] objects instead of going through the hazzle with linebreaks)
mfg.asdr. iOhannes
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
samuraiskillz@blueyonder.co.uk wrote:
Thanks for the advice everyone.
Yes the error was obvious, sorry.
The blanks is causing a problem as in some ascii art there can be just one character placed at any point on a line. But I need to keep the formatting of the line.
sorry i didn't fully understand your problem. hopefully i now do: you need to preserve multiple blanks in a row. actually this is a problem with the parser of [textfile]/[msgfile], which automatically strips duplicate whitespaces.
however, multiple whitespaces are per se not a problem when it somes to [text3d]: using a tricky combination of whitespace symbols (made with [makefilename]) and concatenating them with [l2s] can produce any number of blanks within a symbol.
another possibility is, that the CVS-version of the text-objects can also be fed by ascii-code instead of symbols, compatible with moocow's pd-string library.
see attached file for examples for both ideas.
most probably it would be the simplest way, to just write an ascii-art reading object that outputs the ascii-encoded image. (using symbols for strings is sub-optimal)
mfg.asdr. IOhannes
#N canvas 0 0 1007 315 10; #X obj 745 129 gemhead; #X obj 745 237 text3d; #X obj 69 104 gemwin; #X msg 69 72 create , 1; #X obj 314 80 gemhead; #X obj 314 258 text3d; #X msg 327 236 text $1; #X obj 327 215 list2symbol; #X msg 327 192 list @ $1 @; #X obj 327 159 makefilename %c; #X msg 327 134 32; #X msg 758 210 string 64 32 32 32 64; #X obj 42 205 gemhead; #X obj 42 248 text3d @__@; #X obj 314 102 translateXYZ 0 2 0; #X obj 745 151 translateXYZ 0 -2 0; #X text 311 41 needs zexy; #X text 436 157 generate a symbol " "; #X text 422 194 a list containing a space-symbol; #X text 412 217 concatenate the list with spaces; #X text 400 238 this should be "@___@" (_=space); #X text 738 47 needs Gem-CVS; #X text 756 191 give characters in ASCII; #X text 806 237 this is "@___@"; #X connect 0 0 15 0; #X connect 3 0 2 0; #X connect 4 0 14 0; #X connect 6 0 5 0; #X connect 7 0 6 0; #X connect 8 0 7 0; #X connect 9 0 8 0; #X connect 10 0 9 0; #X connect 11 0 1 0; #X connect 12 0 13 0; #X connect 14 0 5 0; #X connect 15 0 1 0;
Hi!
IOhannes m zmoelnig wrote:
if you want words, just use separate list atoms: a 3-atom list "1 2 3" will result in a text "1 2 3" (with blanks!)
Maybe it's a silly newbie question, but: I couldn't generate a list with multiple blanks in it. I tried following versions:
a string quota
I even tried some weird things like:
Blanks you suggested are just atom separators, so it's a special case of blanks in a string. Dominic wrote about ascii art with multiple blanks. How to encode a text file with multiple blanks which will be correctly read by [textfile]?
br and lG aus Wien, Piotr
Hallo!
How to encode a text file with multiple blanks which will be correctly read by [textfile]?
also can't imagine how to do it with textfile ... anyway, there is a nother problem with textfile: if you have "," in a text you won't see the rest in text3d, because it is handled as a new message ... because of this I read the textfiles in python (py/pyext), where it should be also possible to generate symbols with more blanks ... (not tested)
LG Georg
Georg Holzmann wrote:
Hallo!
How to encode a text file with multiple blanks which will be correctly read by [textfile]?
also can't imagine how to do it with textfile ...
actually it is fairly simple (piotr's attempts to escape characters made me think...) using "\ " instead of just " " is fairly trivial in your favourite editor (as long as it is not Pd...)
attached is an example how to load ascii-art into Gem.
anyway, there is a nother problem with textfile: if you have "," in a text you won't see the rest in text3d, because it is handled as a new message ...
like the spaces, it is just a matter of escaping: use "comma,comma" instead of "comma,comma" in your textfile (tested!)
mfg.asd.r IOhannes
list PPPP\ \ \ \ d P\ \ \ P\ \ \ d PPPP\ dddd P\ \ \ d\ \ \ d P\ \ \ \ dd,d;