How do I make higscore with local storage ?

Get help using Construct 2

Post » Sun Apr 26, 2015 4:33 pm

Hi guys, I have a problem. The old webstorage now is replaced by local storage. I have this capx that I like to use with the new local storage. But it seems a bit different than webstorage. I tried all day long with no result. Can somebody be so kind and replace the coding with the new local storage so that it works ? Would be awesome if u can help me. I attach the file. thanks a lot :)
link to the file https://www.facebook.com/download/16103 ... 0help.capx
if U can attach the new file here I think it would be a help to all users here :)


thanks
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Sun Apr 26, 2015 5:38 pm

this is the LocalStorage equivalent of your code:
Image
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Sun Apr 26, 2015 6:40 pm

so so helpful ...thank U so much :) Why don't U post a capx with this image in the tutorial section ? People would be so thankful :)

thanks so much :)
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Sun Apr 26, 2015 6:57 pm

I am so so sorry and embarassed. since I am beginner it did not work ( my fault of course)...who knows what I did wrongly. If you can post the capx I could use that. so sorry... would be such a important thing for me.

thanks again...
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Sun Apr 26, 2015 7:52 pm

The only thing you need to understand about LocalStorage contrary to WebStorage is, that data is fetched asynchronously, meaning on one tick you may get or set data, but it will not be immediately available in that tick, like it would with the webstorage.

When getting or setting the data is finished, localstorage will trigger the "on item 'x' get" / "on item 'x' set" etc. events, so you use those events to do the followup actions (like setting the highscore variable to the highscore data from the storage)
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Sun Apr 26, 2015 8:27 pm

... sorry I am beginner...can U post that capx that you did ?...this would save my project...sorry to stress you....
B
37
S
16
G
2
Posts: 447
Reputation: 4,860

Post » Tue May 12, 2015 6:46 pm

so looking at this example.. i'm still a little confused.. in the past you had to check if a key existed.. and if it didn't you created it.. in the example above I don't see where you can create it.. or is it created in some other step?
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Sun May 17, 2015 2:28 am

@part12studios was just about to bump the thread with the same issue, then i found it. Add a new event and not a sub-event!
B
32
S
6
G
2
Posts: 317
Reputation: 2,801

Post » Sun May 17, 2015 4:32 am

Awesome! Thanks a lot for clearing that up
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Sun May 17, 2015 2:39 pm

If you want learn about the general function of the LocalStorage plugin feel free to check out my tutorial here.
https://www.scirra.com/tutorials/1461/how-to-use-the-localstorage-plugin
If you want I'll extend it by a HighScore function.

Regards
Andreas
Image Image iTunes: Match3 | Google Play: Match3
B
94
S
33
G
30
Posts: 1,098
Reputation: 27,643

Next

Return to How do I....?

Who is online

Users browsing this forum: khelaghor, R0J0hound and 6 guests