Page 1 of 1

[ASK] [Problem] Web Storage Coin Error

PostPosted: Tue Feb 17, 2015 7:11 am
by yusriltakeuchi
[ASK][Problem]
Excuse me, i want to ask something with my problem.
This is about Web Storage.
I want to set my Coin Variable to Web Storage. Function that coin stored forever
I'm add Web storage Set Local key "SCoin" to Variable Coin When the player has collision with coin.
Image

And also add Set value Coin to WebStorage.LocalValue("SCoin") when layout has starting.
Image

But the results are bad, when I play my game, variable coin into the error that becomes NaN
Image

Where is my problem? and how to fix that?
Thanks ^^. :D
And sorry if my english is very bad, because i'm not really can speaking english
I hope you will reply to this problem quickly

Re: [ASK] [Problem] Web Storage Coin Error

PostPosted: Tue Feb 17, 2015 9:12 am
by odiusfly
Try this:
Image

You don't need to put it under of "On start of layout", maybe work maybe not under "On start of layout".. Just make your tests!
Check also if your global variable "scoin" the type is number or text. Change this to number.. : -)

Re: [ASK] [Problem] Web Storage Coin Error

PostPosted: Tue Feb 17, 2015 9:18 am
by volkiller730
if the above doesnt work try

int(WebStorage.LocalValue("SCoin"))

Re: [ASK] [Problem] Web Storage Coin Error

PostPosted: Tue Feb 17, 2015 2:42 pm
by yusriltakeuchi
odiusfly wrote:Try this:
Image

You don't need to put it under of "On start of layout", maybe work maybe not under "On start of layout".. Just make your tests!
Check also if your global variable "scoin" the type is number or text. Change this to number.. : -)



Can you help me to fix my problem?
I've tried various ways but until now has not succeededI am very grateful if you want to help me :)

Re: [ASK] [Problem] Web Storage Coin Error

PostPosted: Tue Feb 17, 2015 2:43 pm
by yusriltakeuchi
volkiller730 wrote:if the above doesnt work try

int(WebStorage.LocalValue("SCoin"))


Still not working on here ._.

Re: [ASK] [Problem] Web Storage Coin Error

PostPosted: Tue Feb 17, 2015 9:55 pm
by odiusfly
I think the best way is to share the project file.. or if you have full project.. just make a demo version only the important code.. to fix it! : -) Share here or if you want pm me!
Cheers..

Re: [ASK] [Problem] Web Storage Coin Error

PostPosted: Wed Feb 18, 2015 12:34 pm
by yusriltakeuchi
odiusfly wrote:I think the best way is to share the project file.. or if you have full project.. just make a demo version only the important code.. to fix it! : -) Share here or if you want pm me!
Cheers..


Yeah, this is my project file: dropbox.com/s/yt6cm8763ve1n8g/Alien%20Escape.capx?dl=0 I hope you can help me. Thanks :D

Re: [ASK] [Problem] Web Storage Coin Error

PostPosted: Wed Feb 18, 2015 3:30 pm
by odiusfly
Hey i check your file.. the high score is working... and the coin section is 0.. No "Nan". So, what is the problem? You want to save the latest coin as high score does?

Re: [ASK] [Problem] Web Storage Coin Error

PostPosted: Wed Feb 18, 2015 3:40 pm
by yusriltakeuchi
odiusfly wrote:Hey i check your file.. the high score is working... and the coin section is 0.. No "Nan". So, what is the problem? You want to save the latest coin as high score does?


Ah sorry, this problem has fixed, and thank you for you help ^^

Re: [ASK] [Problem] Web Storage Coin Error

PostPosted: Wed Feb 18, 2015 3:50 pm
by odiusfly
: -)