How do I use the LocalStorage Plugin?

Get help using Construct 2

Post » Sat Jan 16, 2016 4:56 am

I figured it out. The problem was with the line you mentioned but not for the reason you mentioned. I had it so it only set a highscore when the highscore was already less than 0. since I already had a highscore in my debugger local storage it worked fine, but when I transferred over to a new environment the highscore was set to zero so it wouldn't set a new one. when I ran your capx it set my local highscore to a positive number and my games highscore stopped working in the debugger. Thanks for the help!
B
3
Posts: 4
Reputation: 189

Post » Sat Jan 16, 2016 9:12 am

setey1 wrote:I figured it out. The problem was with the line you mentioned but not for the reason you mentioned. I had it so it only set a highscore when the highscore was already less than 0. since I already had a highscore in my debugger local storage it worked fine, but when I transferred over to a new environment the highscore was set to zero so it wouldn't set a new one. when I ran your capx it set my local highscore to a positive number and my games highscore stopped working in the debugger. Thanks for the help!


Great news :) You're welcome!

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
98
S
33
G
30
Posts: 1,117
Reputation: 27,791

Post » Sun Mar 06, 2016 1:35 pm

Hello!!!
Sorry, guys, but can you help me?) I have an array - "Levels". How can i save it with localstorage and then load it?
B
3
Posts: 1
Reputation: 177

Post » Sun Mar 06, 2016 2:19 pm

LeninistWho wrote:Hello!!!
Sorry, guys, but can you help me?) I have an array - "Levels". How can i save it with localstorage and then load it?


Just save it with "local storage" - set key array.AsJSON

to load it "On key ... exists" - Load array LocalStorage.ItemValue

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
98
S
33
G
30
Posts: 1,117
Reputation: 27,791

Post » Sun Mar 13, 2016 11:17 pm

Because the last post was on the 6th and it's relatively new and I'm having a problem, I thought I'd ask here.

My game on mobile saves the high score as long as I don't close the app. If I open the app again, the high score is reset to 0.

I have the system setting the localHighScore variable to the score and setting the item to a str(localHighScore) when the game ends. When the game starts, I have a preloader set the localHighScore to int(LocalStorage.ItemValue).

Does that make sense? If I need to show a screen grab or something I can try to do that.
B
25
S
12
G
11
Posts: 260
Reputation: 7,923

Post » Mon Mar 14, 2016 10:41 am

Bleenx wrote:Because the last post was on the 6th and it's relatively new and I'm having a problem, I thought I'd ask here.

My game on mobile saves the high score as long as I don't close the app. If I open the app again, the high score is reset to 0.

I have the system setting the localHighScore variable to the score and setting the item to a str(localHighScore) when the game ends. When the game starts, I have a preloader set the localHighScore to int(LocalStorage.ItemValue).

Does that make sense? If I need to show a screen grab or something I can try to do that.


Hi,

It would be easier to help you if you provided a screen shot of your code, or better a capx example.
Another questions, why did you save it as String to convert it later back to int? Just save & fetch it as int ;)

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
98
S
33
G
30
Posts: 1,117
Reputation: 27,791

Post » Mon Mar 14, 2016 11:55 am

AndreasR wrote:Another questions, why did you save it as String to convert it later back to int? Just save & fetch it as int ;)

Regards
Andy


Because I'm not the smartest person haha, and I was following a tutorial that did it that way. I've since deleted the code and am looking at tutorials on the site to help me with it. If I have more problems, I'll post again later. Thanks for the tip!
B
25
S
12
G
11
Posts: 260
Reputation: 7,923

Post » Wed Mar 16, 2016 11:12 am

Bleenx wrote:
AndreasR wrote:Another questions, why did you save it as String to convert it later back to int? Just save & fetch it as int ;)

Regards
Andy


Because I'm not the smartest person haha, and I was following a tutorial that did it that way. I've since deleted the code and am looking at tutorials on the site to help me with it. If I have more problems, I'll post again later. Thanks for the tip!


Sure, you're welcome ;)

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
98
S
33
G
30
Posts: 1,117
Reputation: 27,791

Post » Mon Apr 25, 2016 8:45 pm

Is there any way to access the data stored by the LocalStorage plugin with Javascript like using the localStorage for the WebStorage plugin?
B
3
Posts: 1
Reputation: 177

Post » Wed Jul 20, 2016 12:10 am

hola quisiera que mi Ranking se guardara localmente, tengo un juego para pc y quiero que mi Ranking se guarde en un documento de texto, localmente como lo hago..?
B
5
S
2
Posts: 3
Reputation: 522

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests