Webstorage: How to compare local webstorage var

  • Hi guys

    I�m starting to use webstorage to save game options locally and things like that.

    I�ve been searching on the forum, and on the programm, but I think it�s not possible to do what I want, and that�s why I�m asking here.

    Is there any way of comparing directly (as a condition) the value of a webstorage.local variable against something else?

    I�ve only found the option of checkins if it exists or not, so, I think the way is to store to a global variable if it exists, and after, compare it against what I want, but I don�t know if there is a faster way of doing that.

    Thanks for all your help men (and women, and animals :)).

  • Compare two values:

    • WebStorage.LocalValue("key")
    • 10

    Will check that the the localstorage value "key" equals 10.

  • That�s what I�m trying and my first idea, but I can�t find that option.

    These are the options I have if I try to create a webstorage based conditional:

    <img src="http://dl.dropbox.com/u/7026907/webstorage.jpg" border="0" />

    No option for comparing, only for checking. That�s why my first question.

    I thinks I�m missing something. Um.

  • Look under system rather than webstorage :)

  • Oh, jajajajajaja, I realised it now! I�m so stupid xD!

    I thought about that, but I focused to the system option "compare variable" and ignored the "compare two values" ones.

    This has been a stupid question, but I was mired, sorry, and thanks man, very helpfull :).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Haha :D Pleased you got it working.

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