How do I do this through LocalStorage?

  • Hi all,

    Firstly, I was so used to "WebStorage" in C2, it was just perfect! Now, shifting to C3, I can no longer use it (can I?), so I'm stuck with this frustrating LocalStorage where I cannot even compare two keys together?

    I have made two keys "name" and "team" as the user writes their name and selects the team. This information is stored correctly in each key.

    Now, I have a button sprite, On Touched, I want to check if "name is not empty" and "team is not empty", before proceeding to the next layout.

    How do I check? In WebStorage, I would have done: Compare two values: "if(Webstorage.Localstorage("name") != "") and (Webstorage.Localstorage("team") != "")

    How can I replicate the same here?

    Note: I want to 'check' both keys together ONLY upon Touch button.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • With Local Storage each key is loaded in a separate thread, so you need to wait for both keys to load before you can compare them. So you can do something like this:

    It's easier to store multiple values in a single dictionary. See this demo:

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