How do I work with webstorage

Get help using Construct 2

Post » Sun Jan 08, 2017 2:17 pm

Hello guys i worked on a game for about 2 years and i used in that moment the webstorage in order to save and retrieve variables.

The thing is today i instaled the app of the game in the phone and is not working, looks like all the info with webstorage is missing.

So..

1. why is not working?

2. Could it work in some way without changing the code?

3. which are the options?

Thanks and regards for your help.
B
32
S
13
G
6
Posts: 363
Reputation: 5,101

Post » Sun Jan 08, 2017 2:28 pm

You may have to go back and change webstorge to localstorage.

Read This
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Wed Jan 11, 2017 8:52 pm

Thanks a lot jeffige, the only way is to use localstorage.

Im trying to convert all to localstorage but i have two issues.

First one is localstorage only triggers when is called so if i check the item if exist on start of layout it only check on the start and when i go to other layout and come back is not going to check again right? so i need to add the everytick function?

Secondly when the variables are loaded it takes like a second to upload and in webstorage that doesn't happened, know why and how to fix it?

Thanks a lot.
B
32
S
13
G
6
Posts: 363
Reputation: 5,101

Post » Wed Jan 11, 2017 10:09 pm

Start of layout > localstorage check item

Localstorage on item exists > get item (get is not needed anymore, but I haven't figured out how to get item, so i left it)

Localstorage on item get > system set item to localstorage.itemvalue

Once and done.

I have ALL my localstorage on splash screen, about 25 of them. No worries. Cause you should be setting item to globalvariable after get. And GV's are...well...Global.

What do you mean by loaded and uploaded?

Do you mean fetched the loaded into tge game?

Takes mine about 0.5 secs.
B
38
S
18
G
19
Posts: 664
Reputation: 14,112

Post » Wed Jan 11, 2017 10:27 pm

Example using array & local storage: https://dl.dropboxusercontent.com/u/659 ... eMenu.capx
ImageImage
B
115
S
51
G
24
Posts: 790
Reputation: 23,505


Return to How do I....?

Who is online

Users browsing this forum: draiza and 22 guests