LOCALSTORAGE UGH!!!!

Get help using Construct 2

Post » Mon Jun 08, 2015 5:46 pm

I tried implementing a simple highscore system for over 7 hours straight using the new local storage feature the only problem is IDK HOW TO USE IT without getting a NAN

https://www.facebook.com/TheSSGames/photos/a.435833813261408.1073741828.434494416728681/435833826594740/?type=3&theater
B
8
S
2
G
1
Posts: 10
Reputation: 620

Post » Mon Jun 08, 2015 6:22 pm

The answer is in the manual:

Note WebStorage only stores strings. If you set a key to a number like 100, when you retrieve it back it will be a string. To convert it back, use the system expression int, e.g. int(WebStorage.LocalValue("score")).
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jun 08, 2015 6:43 pm

I can't incorporate that into my code without errors. I'm using Localstorage but I named it webstorage
B
8
S
2
G
1
Posts: 10
Reputation: 620

Post » Mon Jun 08, 2015 7:06 pm

Update: I added int("scorehi") on row 4 on the 3rd section. It got rid of the NAN but now it's just 0
B
8
S
2
G
1
Posts: 10
Reputation: 620

Post » Mon Jun 08, 2015 7:24 pm

on start of layout....

Image
Image
B
64
S
23
G
7
Posts: 1,481
Reputation: 10,823

Post » Mon Jun 08, 2015 8:43 pm

@korbaach THANK YOU!!!
B
8
S
2
G
1
Posts: 10
Reputation: 620


Return to How do I....?

Who is online

Users browsing this forum: KTML5 and 6 guests