NaN problem, but only on Scirra Arcade

Get help using Construct 2

Post » Thu May 21, 2015 2:16 pm

Hello everyone!

I recently made a game in 48 hours...

when I uploaded it to the scirra arcade the high score (using the new local storage) showed as NaN...

so I went back and checked in my game again and its fully working in construct 2...
Using C2 version r205.2 and I did not minify (if I do, the screen is all blank white when I upload it...)
Any ideas?
Thanks
Justin

PS: Link to the game https://www.scirra.com/arcade/fighting- ... on=updated
Eat ALL THE BACON!
B
45
S
17
G
3
Posts: 290
Reputation: 4,993

Post » Thu May 21, 2015 2:37 pm

If it is anything like the webstorage and AJAX options for storing data it has to do with the fact it gets an error when retrieving the highscore. NaN means Not a Number. So it expects a number but gets text pretty much.. Usually this is an error message of some sort. Perhaps local storage cannot be reached from the arcade? Maybe due to a relative path situation?
Last edited by UberDark on Thu May 21, 2015 4:48 pm, edited 1 time in total.
B
54
S
7
G
8
Posts: 150
Reputation: 5,817

Post » Thu May 21, 2015 4:04 pm

Thanks UberDark... I do know it means NaN... but never heard of it working in C2 and not in the arcade...

anyone else have this problem using the arcade and new local storage?
Justin
Eat ALL THE BACON!
B
45
S
17
G
3
Posts: 290
Reputation: 4,993


Post » Fri May 22, 2015 12:23 am

Thanks @Lordshiva1948 - Very helpful!
B
13
S
5
G
4
Posts: 139
Reputation: 2,586

Post » Wed May 27, 2015 12:02 am

@Lordshiva1948 thanks for making a capx... but the whole point was that it was working, just not in the arcade...
Eat ALL THE BACON!
B
45
S
17
G
3
Posts: 290
Reputation: 4,993

Post » Wed May 27, 2015 8:30 am

crypticblonde I am glad I could help you
B
245
S
39
G
15
Posts: 1,946
Reputation: 40,266

Post » Wed May 27, 2015 11:21 am

antares330: It sounds like you "forgot" to give a default value to the highscore (I must assume that since you're not providing the capx of your project).

So when going to the highscore layout, you are looking for a key in the local storage. Thing is the first time a player executes your game, they don't have keys saved.
So you should somewhere have a "On item "Highscore" is missing - Set key "Highscore" value "0" and give this default value to your highscore variable as well.

Also don't forget that local storage is asynchronous.
If you only display text in your start of layout event, it's likely you don't have the read results yet in it.

Again, it all depends on your capx and would be easier to point out exactly what's going wrong in it.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,319
Reputation: 87,487

Post » Thu May 28, 2015 11:14 pm

Kyatric, could very well be... also I'll attach my capx

https://www.mediafire.com/folder/gu4j713mu8y1q/Photos
Eat ALL THE BACON!
B
45
S
17
G
3
Posts: 290
Reputation: 4,993

Post » Thu May 28, 2015 11:44 pm

I only see adidawawi1.capx in your link....
I don't think this is the capx you wanted to share for it hasn't any events concerning local storage..
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


Return to How do I....?

Who is online

Users browsing this forum: lolsuperscratch, RobertMKD, tarek2 and 10 guests