LocalStorage compare key value

Discussion and feedback on Construct 2

Post » Tue May 26, 2015 1:34 pm

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 :)
Website Twitter Indie Developer
B
20
S
6
G
4
Posts: 206
Reputation: 2,954

Post » Tue May 26, 2015 3:29 pm

"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.
Scirra Founder
B
402
S
238
G
89
Posts: 24,644
Reputation: 196,095

Post » Tue May 26, 2015 9:26 pm

Then how am I supposed to compare the value of one key with another? Feels like it wouldn't really work? :S
Website Twitter Indie Developer
B
20
S
6
G
4
Posts: 206
Reputation: 2,954

Post » Wed May 27, 2015 9:42 am

The same as you would with WebStorage: fetch each value, then compare them.
Scirra Founder
B
402
S
238
G
89
Posts: 24,644
Reputation: 196,095

Post » Thu Sep 03, 2015 11:58 pm

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.

Image

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
B
59
S
9
G
1
Posts: 970
Reputation: 6,611


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests