0

I'm trying to use Jquery (or just javascript) to create a 'save game file'. I'm aware that u can use html's local files in the browser, but i was hoping to find a way for the user to click my 'save' button and choose a location to [download] their generated game info. I also want to have a way to load. I was hoping for a .txt file, but JSON or JS (those are javascript files right?) would be fine too.

I'm specificly hoping to use this in Twine to create interactive stories/ video games like DND. Is this possible?

Jexadox
  • 23
  • 6
  • https://stackoverflow.com/questions/28464449/how-to-save-json-data-locally-on-the-machine – Koborl Sep 26 '17 at 03:03
  • 1
    Welcome to Stack Overflow. What have you already tried yourself to do this? Please review [How much research effort is expected?](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users). Stack Overflow is not a coding service. You are expected to research your issue and make a good attempt to write the code yourself before posting. If you get stuck on something specific, come back and include a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and a summary of what you tried, so we can help. – S4NDM4N Sep 26 '17 at 04:21
  • i've been trying to solve this question for anywhere from a few days to a few weeks. its part of the reason i turned to javascript so i will be pretty sad if i can't figure it out at all. i haven't responded per say because i am still very much trying to figure out javascript and jquery specificly. It takes me days to implement the same codes i've read in the book AND seen on several tutorials. I understand this isn't a coding service. i can find plenty of those thru google and im not interested. perhaps i asked this question too early in my experience, but i'm still looking to solve. – Jexadox Oct 09 '17 at 03:46
  • i completely reworded the question to make it clearer. – Jexadox Oct 09 '17 at 03:51

1 Answers1

0

Check out JSON.stringify: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

This should get you close to where you want to be.

user101289
  • 9,888
  • 15
  • 81
  • 148
  • my only issue, is that is local storage only right? i would really like to have the user pick their file location. I might just settle for this for now though. The more you do, the more you learn... thanks for the link tho, this was definately more information i need to know to save anything in a json... it needs to be a string... – Jexadox Sep 26 '17 at 03:05