Save Dictionary in Webstorage?

Get help using Construct 2

Post » Mon Feb 16, 2015 12:31 pm

Hello!
Before starting, I already want to sorry for my english :)

I'm making a mobile game that uses two dictionaries to store data, but i simply can't understand why my events won't work.

So, the two dictionaries are "Dictionary" and "Unlockables", the functions are "SaveGamestats" and "LoadGameStats" and the way to trigger them is by holding and double tapping for testing, and, in other layouts, by pressing certain buttons .

When i play the game it correctly stores data in the dictionaries as expected, but when I restart, i find the values reset to the default values.

I followed this little tutorial (https://www.scirra.com/forum/saving-dictionary-in-webstorage_t75489) but hey, what's wrong with mine? D: (I tried many solutions, from downloading dictionary as Json to loading it directly).

*I've also tried to use the great save game feature in construct2 but now and then the game lags with it.
Cattura di schermata (14).png
You do not have the required permissions to view the files attached to this post.
B
11
S
3
G
1
Posts: 91
Reputation: 997

Post » Mon Feb 16, 2015 7:05 pm

here a simple example hope it helps

https://www.dropbox.com/s/ufxgnlu62xexs ... .capx?dl=0

you need beta 196.2 to open it
Image
B
28
S
11
G
2
Posts: 139
Reputation: 3,299

Post » Mon Feb 16, 2015 10:29 pm

Tomorrow I'll be home ready for testing it! I hope it will make my day :)
B
11
S
3
G
1
Posts: 91
Reputation: 997

Post » Tue Feb 17, 2015 1:50 pm

THANK YOU!
I thought that it was possible to save Dictionary's instance variables too but i was wrong, your .capx made me understand that dictionary can save Keys but not instance variables so i got around it, adapted it to my game and now it WORKS! :) You'll be included in the credits :P
B
11
S
3
G
1
Posts: 91
Reputation: 997


Return to How do I....?

Who is online

Users browsing this forum: SERG 04 and 2 guests