What am i doing wrong?

  • I am trying to save the highscore using webstorage I have done this in the past but for some reason the same method is not working I am doing the following:

    -On start of layout

    Subevent:

    - Webstorage- if local key exists - System - High > WebStorage.LocalValue("Score")

    -Else - System - Set High to 0

    Then:

    on population = 0

    SubEvent-

    - System - Kills >High - Webstorage - Set local key "Score" to Kills

    Then on the Highscore event screen I have this:

    On start of layout- Set Text to "score"

    What am I doing wrong all I get is the word text showing..

    Any help appreciated!

  • Here you go. It's not a bug. I have it working in all my game. Here is a example project File.

  • Thank your for your reply I will check it out now

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Np

  • Im still getting the problem, even though Nlaakald's capx helped a bit the problem is still there I only see Text as the result.

  • maybe you can post your capx

  • Im still getting the problem, even though Nlaakald's capx helped a bit the problem is still there I only see Text as the result.

    You're probably having a NaN loaded into number variable.

    Anything you store in webstorage is going to be a string, when you load it back, if the localkey supposed to be numerical, you have to convert it using int(webstorage.localvalue("XXX")).

  • it was (my capx) is a timer that counts and saves. Number to string and back. He's going to have to post his so we can see whats going on.

  • I am trying what duckface ninja suggested im not sure but think this may be the problem.

  • On start of layout- Set Text to "score"

    Are you using quotation marks in that event ? take that off if so

    Also try Every tick - set text to score (Variable)

  • Still cant get it to work heres my Capx guys hopefully you can see what im doing wrong!

    "edit" when I try to upload the capx its 65mb and it fails any ideas?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)