Webstorage: How to compare local webstorage var

Get help using Construct 2

Post » Fri Jan 11, 2013 11:15 am

Hi guys
Im starting to use webstorage to save game options locally and things like that.
Ive been searching on the forum, and on the programm, but I think its not possible to do what I want, and thats why Im asking here.

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

Ive 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 dont know if there is a faster way of doing that.

Thanks for all your help men (and women, and animals :)).
B
14
S
4
G
3
Posts: 106
Reputation: 4,792

Post » Fri Jan 11, 2013 11:24 am

Compare two values:
- WebStorage.LocalValue("key")
- 10

Will check that the the localstorage value "key" equals 10.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Fri Jan 11, 2013 12:26 pm

Thats what Im trying and my first idea, but I cant find that option.
These are the options I have if I try to create a webstorage based conditional:



No option for comparing, only for checking. Thats why my first question.
I thinks Im missing something. Um.
B
14
S
4
G
3
Posts: 106
Reputation: 4,792

Post » Fri Jan 11, 2013 12:34 pm

Look under system rather than webstorage :)
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Fri Jan 11, 2013 12:55 pm

Oh, jajajajajaja, I realised it now! Im 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 :).
B
14
S
4
G
3
Posts: 106
Reputation: 4,792

Post » Fri Jan 11, 2013 1:55 pm

Haha :D Pleased you got it working.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783


Return to How do I....?

Who is online

Users browsing this forum: Paradox and 2 guests