How do I save variables to file

Get help using Construct 2

Post » Sat Jan 03, 2015 12:55 am

its possible to save to text file some variables/scores to hdd?
Last edited by delgado on Sat Jan 03, 2015 4:21 am, edited 1 time in total.
B
110
S
27
G
47
Posts: 1,887
Reputation: 35,799

Post » Sat Jan 03, 2015 2:28 am

I'm not an expert, as I've just started using this software, but I've figured out how to save data using the webstorage object.

Right click on your layout and select "Insert new object." Under "Data & Storage" select the webstorage object.

Add a new "System > On start of layout "event to your event sheet.

On the System event, right click to the left of the word System. Select "Add sub-event."

Select "Webstorage > Local key exists." Click next then type any name you want to reference the stored object. (Use "test" for example.)

Click on add action, select Webstorage > Set local value.

For the key name, use the name you used above ("test")

Enter the variable value.

Once this is done, right click "local key "test" exists and select invert.

Now copy this event and paste the copy under the original. Remove the "invert" on the second event.

There may be an easier or better way to do this, but this is how I got it to work.
B
5
Posts: 10
Reputation: 245

Post » Sun Jan 04, 2015 10:45 pm

@jmiguy yu describe a way how save variable to local memory right?
B
110
S
27
G
47
Posts: 1,887
Reputation: 35,799

Post » Mon Jan 05, 2015 3:35 am

Yes, it saves the data to a local temp directory.
B
5
Posts: 10
Reputation: 245

Post » Mon Jan 05, 2015 12:18 pm

@jimiguy with what file extension?
B
110
S
27
G
47
Posts: 1,887
Reputation: 35,799


Return to How do I....?

Who is online

Users browsing this forum: ametueraspirant, dand, mickclarke and 29 guests