Why do i get Nan ?

Get help using Construct 2

Post » Fri Oct 14, 2016 11:07 am

hi, if i get an item for example named (highscore)
and on function for example (gameover ) i get the item value (hightimer), after i set a variable Localstorage.itemvalue it writes me (Nan), Not a number.
Why ?
Thank you,

P,S, I want to save the highscore before i reset all the variables to inital states, thanks
B
11
S
3
Posts: 277
Reputation: 1,395

Post » Fri Oct 14, 2016 11:13 am

Maybe there is an undefined calculation like 0/0

Can you upload a capx?
B
23
S
11
G
1
Posts: 127
Reputation: 2,737

Post » Sun Oct 16, 2016 11:18 am

B
11
S
3
Posts: 277
Reputation: 1,395

Post » Sun Oct 16, 2016 11:19 am

@takamoto
For like one week I try to solve this, i can't :(
B
11
S
3
Posts: 277
Reputation: 1,395

Post » Sun Oct 16, 2016 11:43 am

Try adding int() to your return
Image ImageImage
B
168
S
50
G
164
Posts: 8,227
Reputation: 105,573

Post » Mon Oct 17, 2016 12:41 am

Sometime if you are not watching you might be using a text of a number so Int in this case would just give you the text as a number.

Texts and number are two different thing even if they show the same thing.
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Mon Oct 17, 2016 2:25 am

try to put on item missing set the h.s to 0
B
79
S
31
G
7
Posts: 148
Reputation: 9,179

Post » Mon Oct 17, 2016 4:30 pm

@newt
That worked, woah, i didn't think about it ! :))
Thank you guys
@clarkkentnicdao @Gearworkdragon @takamoto
B
11
S
3
Posts: 277
Reputation: 1,395


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 7 guests