using new localstorage plugin

Get help using Construct 2

Post » Mon Jun 29, 2015 12:23 am

in my previous projects i used webstorage plugin and it worked great.
but now in version r206 its been depracated
and i cant even get localstorage to work,when i debug, i see it working correctly but it never writes to the browser,when i monitor in developer mode in chrome i cant find the key i set in localstorage,
when i load an old .capx file that used webstorage the plugin is still there and working, but not in my new projects.
whats the trick to get it working?
B
9
S
2
Posts: 76
Reputation: 709

Post » Mon Jun 29, 2015 6:36 am

B
17
S
7
Posts: 277
Reputation: 2,514

Post » Mon Jun 29, 2015 6:51 am

You are probably mixing the order up. The difference between webstorage and localstorage is you have to wait for responses using events. It can't be thought of like you do an Array etc., it's asynchronous. It's a bit like talking to someone over a very bad phone line.

If you look here http://myconstruct2dev.blogspot.co.uk/2 ... roids.html and the github link on the page there is a game where it definitely does work ;-) and it's a very simple implementation
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Thu Jul 09, 2015 8:12 am

i have a project created with older version of c2 that used webstorage, this works with latest release if i leave code untouched but if i try to copy code to new project it wont work, so it seems i have to ditch that code for localstorage plugin,kinda sucks webstorage was easy to use, required less code and more apropriate since i only want to store session parameters.
how do you store session parameters with localstorage?
keep deleting them on every launch?
B
9
S
2
Posts: 76
Reputation: 709

Post » Thu Jul 09, 2015 9:14 am

If you copy code of the webstorage directly over to another project, it won't work indeed because you are missing the webstorage plugin itself in the project.
You could add it by right-clicking the "Add plugin" dialog and selecting "Show deprecated plugins".
WARNING: Someday webstorage support will surely disappear from browsers themselves, and that day, your project/game simply won't work anymore.

The local storage don't have session storing, but at the same time, session storing can be achieved simply by using global variables.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,319
Reputation: 87,487


Return to How do I....?

Who is online

Users browsing this forum: dahu, Syazanie Amirin, Yahoo [Bot] and 10 guests