Highscore either stays at 0 or says NaN

Get help using Construct 2

Post » Sun Apr 28, 2013 8:15 pm

Howdy!

So, Im pretty much done with my first (android)game ever, the only thing missing is highscore.
I started on that part back on friday, but couldnt make it work, so I left it for saturday and after another failed attempt, I told myself that I'd fix it today but Im still stuck after some hours of messing around trying to fix it :(

The problem is that the highscore either stays at 0 or says NaN, and I cant figure out why. Ive been searching for tutorials, but pretty much none of them are based on how to store highscore locally on the device. I found a video (https://www.scirra.com/tutorials/448/arcade-style-high-score) though and Ive done the steps over and over but it simply does not work and its driving me nuts!



Any idea of where Ive done wrong? If the screenshot is not enough, I can provide .capx file too..
Thanks in advance.
B
4
Posts: 15
Reputation: 580

Post » Sun Apr 28, 2013 8:26 pm

Did you check that WebStorage Works on the tested device? (and did it works in the computer?)

EDIT: I ask that because, as far as I see, It should workAphrodite2013-04-28 20:33:19
https://www.scirra.com/forum/viewtopic.php?t=152506

And that is why you shall respect the bug reports guidelines, not only giving a capx is making the bug reproductible in one click in a situation they can work with (less time wasted trying to reproduce vague instructions) but also it helps filtering false positives.

Game design is all about decomposing the core of your game so it becomes simple instructions.
B
42
S
17
G
16
Posts: 2,094
Reputation: 15,355

Post » Sun Apr 28, 2013 8:33 pm

Thanks for replying! Does not work on either computer or device (Samsung Galaxy S3) after export with CocoonJS.


B
4
Posts: 15
Reputation: 580

Post » Sun Apr 28, 2013 8:37 pm

I See, The Webstorage keys are strings!

WebStorage.LocalValue("highscore"), don't forget the " "
https://www.scirra.com/forum/viewtopic.php?t=152506

And that is why you shall respect the bug reports guidelines, not only giving a capx is making the bug reproductible in one click in a situation they can work with (less time wasted trying to reproduce vague instructions) but also it helps filtering false positives.

Game design is all about decomposing the core of your game so it becomes simple instructions.
B
42
S
17
G
16
Posts: 2,094
Reputation: 15,355

Post » Sun Apr 28, 2013 8:41 pm

I've added the " ", but the highscore still remains at 0 :(

I can give ya the .capx if you want to try it yourself?
B
4
Posts: 15
Reputation: 580

Post » Sun Apr 28, 2013 8:42 pm

If you don't mind, yes, I could give it a try ^^Aphrodite2013-04-28 20:44:57
https://www.scirra.com/forum/viewtopic.php?t=152506

And that is why you shall respect the bug reports guidelines, not only giving a capx is making the bug reproductible in one click in a situation they can work with (less time wasted trying to reproduce vague instructions) but also it helps filtering false positives.

Game design is all about decomposing the core of your game so it becomes simple instructions.
B
42
S
17
G
16
Posts: 2,094
Reputation: 15,355

Post » Sun Apr 28, 2013 8:48 pm

Ive PM'd you with the .capx file. Please oh please find the problem :/
B
4
Posts: 15
Reputation: 580

Post » Sun Apr 28, 2013 9:10 pm

The problem is your "set local key"
you just have to enter the name of the key, here "highscore" (with the " " ), not the WebStorage.LocalValue("highscore")
https://www.scirra.com/forum/viewtopic.php?t=152506

And that is why you shall respect the bug reports guidelines, not only giving a capx is making the bug reproductible in one click in a situation they can work with (less time wasted trying to reproduce vague instructions) but also it helps filtering false positives.

Game design is all about decomposing the core of your game so it becomes simple instructions.
B
42
S
17
G
16
Posts: 2,094
Reputation: 15,355

Post » Sun Apr 28, 2013 9:16 pm

[QUOTE=Aphrodite] The problem is your "set local key"
you just have to enter the name of the key, here "highscore" (with the " " ), not the WebStorage.LocalValue("highscore")[/QUOTE]

Uh, sorry if I seem stupid now, but I dont get what you mean :P

Do you mean event 13? WebStorage.LocalValue("highscore") ?

B
4
Posts: 15
Reputation: 580

Post » Sun Apr 28, 2013 9:28 pm

[QUOTE=DV7] [QUOTE=Aphrodite] The problem is your "set local key"
you just have to enter the name of the key, here "highscore" (with the " " ), not the WebStorage.LocalValue("highscore")[/QUOTE]

Uh, sorry if I seem stupid now, but I dont get what you mean :P

Do you mean event 13? WebStorage.LocalValue("highscore") ?

[/QUOTE]

Yes, also, you could do that during the game over
https://www.scirra.com/forum/viewtopic.php?t=152506

And that is why you shall respect the bug reports guidelines, not only giving a capx is making the bug reproductible in one click in a situation they can work with (less time wasted trying to reproduce vague instructions) but also it helps filtering false positives.

Game design is all about decomposing the core of your game so it becomes simple instructions.
B
42
S
17
G
16
Posts: 2,094
Reputation: 15,355

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Colorfish, GSquadron, zenox98 and 19 guests