How do I work with webstorage

  • 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.

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

    Read This

  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Example using array & local storage: https://dl.dropboxusercontent.com/u/659 ... eMenu.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)