Saving instance variables into text file that can be loaded.

Get help using Construct 2

Post » Mon Apr 28, 2014 5:06 pm

Hello!
I am trying to create a achievement system that is made up of descriptions, icons that can be unlocked, and information that can be typed in and saved for each achievement. Right now I am using the Webstorage plugin to save the state of the whole project and loading the state on a button press through Webstorage when the program is opened.

My problem is that when I have updated and changed my project I want to be able to use the run time input from older versions of my program (so that I don't have to unlock all achievements again manually and keep track of progress etc.). My projects are exported as Node-webkit applications.

So I suppose saving all instance variable states and content , such as which icons are unlocked, unique descriptions texts, notes written manually at run time, into a separate text file or XML file that then can be loaded into a updated version of my project would be ideal.

But I have no idea where to begin, as I have about 100 achievements with about 4 instance variables I want to save each, and will create more as time progresses. How would I save them in a way that the variables can get loaded to their proper positions when loading the information from a external file? And how would I save the information in a good way in the first place? Some combination of ajax, xml, arrays and webstorage events and actions?

Need some design guidance and overall understanding of plugins, events and actions that could be used in combination as I have not come up with a way myself (I am a pure beginner).

Any good workflow ideas for such a system, or code hints would mean the world to me at this stage :) Hope my question is not to abstract and that my English is readable to some degree. Drawn a small image below to show to kind of info that would be saveable.

Fantastic community btw!

Image
B
4
Posts: 4
Reputation: 243

Post » Mon Apr 28, 2014 7:52 pm

You can use the node-webkit. Here is an example of how you can save and load data.

EDIT: Sorry that was a really bad example, should probably have tested it first, it was not even near at being able to work :lol:

Anyway here is a working version.
Image
You do not have the required permissions to view the files attached to this post.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Mon Apr 28, 2014 10:15 pm

Thank you so much!
Definitively gives me a better idea of how to get thing working, will test it out this week.
B
4
Posts: 4
Reputation: 243


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests