Saving and Loading multiple Text files

Get help using Construct 2

Post » Sat Jul 13, 2013 8:47 pm

Hi folks!

After crawling through forums posts and multiple searches without success, I've finally decided to simply ask the community for help instead.

As the thread subject states, I'm trying to save and load multiple text files (not all at the same time, however) but it's a task I've not been able to conquer ... yet.

Why do I need to save a load multiple text files? I intend to create a program for language practice that will use text files exported from other programs such as Pleco and Anki or the user's own custom dictionary.

I think what I need to achieve this is the Node-Webkit but after trying it out, I can't even get it to save a text file.

I tried creating a text file named, "Test1.txt" containing the text, "test" but a hard drive search for the file returns 0 results.

      System - On start of layout
      NodeWebkit - Write "test" to file NodeWebkit.UserFolder&"Test1.txt"

Thanks for taking the time to read this!
B
4
S
1
G
2
Posts: 27
Reputation: 1,004

Post » Sun Jul 14, 2013 3:34 pm

Sorry for the double post but I figured it would be better double post than start a new thread since this was pushed back to the third page.

After further experimentation, I've managed to load a text file with the AJAX plugin. This, however, requires the text file to be imported into the project files and doesn't allow for the creation of additional text files.
B
4
S
1
G
2
Posts: 27
Reputation: 1,004

Post » Fri Aug 09, 2013 12:56 pm

I'm making a very simple level editor for a tile based puzzle game which can save & load text files to & from an array. The same thing would work with the Dictionary object too.

To save, I use this action on the array:

Download as JSON data with filename TextBox.Text & ".txt"
(TextBox is the object I use to type in the filename for saving)

Loading uses the FileReader plugin, which might not be ideal for your program since it uses an uncustomizable web button & can't be called with actions - you have to click on the button then browse to your text file. This is fine for a scrappy level editor though.

So, the loading process is:

FileReader > on file loaded > Array > load from JSON string FileReader.fileContent
B
27
S
12
G
1
Posts: 157
Reputation: 3,359


Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot], Nicolas951 and 30 guests