LocalStorage compare key value

0 favourites
  • 5 posts
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • Not sure if anyone's made a post about this already, but I played around with the 'new' LocalStorage plugin and I noticed that it doesn't have a "Compare Key Value" condition like webstorage did, only compare value and compare key. I might be dumb but they don't have the same meaning, do they?

    If not, you should add this to LocalStorage

  • "Compare value" is the same thing as "Compare key value" IIRC. "Compare key value" is a confusing name because it mentions both the key and the value, but it really only compares the value.

  • Then how am I supposed to compare the value of one key with another? Feels like it wouldn't really work? :S

  • The same as you would with WebStorage: fetch each value, then compare them.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is a late response to this thread but it seems relevant.. so with web storage you could do a "compare two values" system event. in web storage you could do this:

    WebStorage.LocalValue("highscoreeasykey") which was nice because it grabbed the specific value by identifying the key..

    However if I try to do the same thing with LocalStorage, I can't reference a specific key. I can only do something like

    LocalStorage.ItemValue

    I've used localstorage successfully in other projects, but I never had to do a comparison. This this case I'm trying to compare the stored high score value and if it's great than the existing value, overwrite the other.

    Maybe it's expected that I have some local variable instead? I could see that potentially working, but it feels like it would just be adding more steps to the process (I believe and hope) unnecessarily.

    here is a picture of them side by side.. i need to understand how to be able to do a value compare in localstorage which is missing the stuff I used when doing webstorage.

    Thanks,

    Caleb

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