Write/Read from text file in Squiffy?

Is there a way to read/write from/to a text file in the local game's directory?


The Squiffy editor deletes <script> tags and their contents when it compiles. So you have to use the command line version, or figure out where exactly in the squiffy.js to put <script>. I don't know how to use the command line version. So the only reason I know this, is that other friendly Squiffy users have always told me where and how to change the squiffy.js file. I'm sorry I can't be more help. I hope somebody answers your question, because I'd also very much like to know.

In the meantime, it's easy to frequently embed the same html or text in different places by making your beginning tag and content into an attribute with @set attribute_name = ???. It's almost as easy to frequently embed the same js snippet by:

  1. putting it into it's own [[section]].
  2. Looping into and out of that section.
    a. Use @set next_section_for_my_reader_to_see = ??? in the section before you wish to loop.
    b. Use [[Link text]](section_with_my_js_snippet) to let the reader loop in and trigger your js snippet.
    c. End your js snippet with squiffy.story.go(next_section_for_my_reader_to_see).

Actually I'm doing a bad job. Bluevoss discovered this ability and explains it here.


I don't think there's a way to write to a file. Reading might be possible, as it should be the same as the way images/media work.

For more detailed guidance, I think it would depend on what kind of file it is, and what you want to do to it.


It would be possible to add a number of "stock" files in place, allowing you to pick which one to read. In essence, you'd not be reading a file but possibly a section (or a case segment from JS). As for writing, it would be simply saving current values.

I guess what I'm clumsily saying it that, since you can really only play squiffy through in one session, you'll have to think of different "out of the box" ways for doing this. And yes, you cannot read or write to local directories.

There was a thread a while ago about using JS to save your current variables. Mrangel, I thought you helped me with this. I ended up ditching the project, but you could have squiffy generate a unique code to save all your variables/conditions and then reload them (using a coded key) to restart.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums