How do I use this new local storage?

  • Hi everyone,

    So I've worked with the previous web storage a good amount.. and one of the big things i remember from before is that you had to check if a key existed.. and using an invert condition "if key does not exist"... create the key..

    in this new system I see I can do something like this:

    on start of layout:

    check item "keyname" exists.. but then what? does it automatically create the keystore?

    then i want to do things like compare, but this too isn't feeling familiar.. just feels like while I get it's not completely different, it's different in how I understood web storage to work with C2. I haven't seen any

    even the C2 manual seems to still talk about the old plugin, not the new one so that wasn't informative. I saw some other questions out there, but none of them cover this..

    I just want to create a couple of local storage values so I can save thing like high score and volume on / off so far.. so when you turn off sound and quit.. next time you come in the volume will still be off.

    Thanks!

    Caleb

  • A good example is in this thread:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • awesome thanks! I couldn't find anything concrete in my searching although it did leave me confused a little..

    In his example i see that he does check "does it exist" and has a condition of "if it exists.. cool do this" if it doesn't exist.. cool do that.." but i don't see in here where they actually do "Create" the keystore so it exists next time. or maybe it's created at some point along the way without saying "Create this key".

  • There is a set item action.

  • ah the .set item value? ok good to know!

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