Can you write and read a text file?

  • Is there a way I can get Construct 2 to write to text file (such as .txt) as well as read from it?

  • You can use the AJAX behavior, but It only works on files stored on the same HTTP the game is hosted on, it won't be able to call from other domains :)

  • If you made a server side script, there's no reason you couldn't also POST new data to the server with the AJAX object.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I don't think my question was clear that time.

    Is there a way I can get Construct 2 to write a text file on my computer? Then after the file is written, is there a way I can place that file into the project, so it can read it later?

    Edit: Never mind! I figured it out! :P

    Thank you for pointing me to the AJAX object!

  • I am trying to do this to, but I can't seem to figure it out. I see how you can use AJAX to write to a PHP file on a server, but is there a way to write directly to a local or network drive?

  • Hey Ferguson, i'm trying to figure this out as well... Any luck?

    Zero6 would be great if you could share your solution?

  • Well I did discover something. It seems you can read or write directly to a txt file from Construct 2, the limitation seems to be that it needs to be exported as a Node-Webkit. You need to add the Node-Webkit actions first and use the "Write file" or the "ReadFile" options.

    It seems you can also Move, Copy or Delete files as well.

    The other caveat is you need to export the file and run it from the exported folder for these features to work. They don't seem to function in the Preview Browser.

    I hope that helps.

  • Thanks Ferguson, I'm purchasing a full business licence this week which should allow me to play with the Node Webkit stuff...

    I'll let you know how I get on.

    Many thanks for your reply,

    Matt.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)