I need block to read a text file into one string? another for text replacements?

What's problem you are encountering?
i can't paste the contents of a text file into one string - i got NS_ERROR_FAILURE (maybe it was caught in the text processing later). i also need to replace eg. newlines to spaces. ?'s and !'s to .'s, etc.

What have you tried that didn't work?
for text replacements, i had to do this: split by letter, map with a single character change, "unmap" back

That's a virtualbox error and not related to Snap!?

i was trying to build a markov chain on the fly (really a huge associated array) and it was just a 12,288-byte file input (a file of about 100+ lines)

then i go this:

i'm guessing NS means no space

update - i fixed the NS_ERROR message i had renamed the broadcast names but in this block.
i stilll need the read-text block and the replace-text block, though.

Do you have a link to your project? It appears that NS_ERROR_FAILURE can happen for many reasons in Firefox.

i take it back. i still get the error - it's due to my split box being too long.

i forgot how to share - i went to the dir list in the cloud, right click,share and publish - i dont know where it is! it's called horoskov

i found it under Explore! duh

To share a project, click open/save as, then find your project (you can also search for it), click on it, then click share. The url in the url bar will change. You can copy that url, and paste it in the forum so that we can access it.

here's the project

ok, so since you were trying to import a file, I've decided to clean up a file import library. You can import any file and read it as text, image, sound or binary (raw). It does require javascript. Here's the project Snap! Build Your Own Blocks (it's much better than pasting a bunch of text into an ask box, oh, and it's also wayyy less laggy)

Thanks! i'm gonna try it later.
EDIT - it worked like a charm! thanks!

i have a "working" Horoskov program (horoscopes using markov chains). thanks to @ego-lay_atman-bay for sharing his read-file blocks.

here's a few of the horoscopes generated:

here's a link to the project:

note: the horoscopes have been preloaded. do not attempt to load a new horoscope file unless you have such a file.

the file used to load the current horoscopes can be found in this dropbox link.

The original library was made by @pumpkinhead File import library I just fixed a few things.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.