High score on local?

0 favourites
  • 9 posts
From the Asset Store
High Low is a casino game using luck and points accumulation.
  • Hi,

    I want to create a Highscore of top 10 on local. When I search the entire forum all I found is an online high score tutorial/plugin. Is there a way to make this table an put it in a webstorage to access it locally?

    Thanks in advance <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Sure, just save the top 10 in a "list" (take a look at the Token At section), seperated by a delimiter and store this string thru WebStorage

  • i'm not really a programmer.

    i dont really understand how token at works. can u explain it a bit?

  • Did you take a look at the two tutorials I linked?

    The Random Animation Tut explains the "list" with TokenAt.....

  • Hi there!

    I'm trying to get a local highscore working as well, and I looked at the 2 tutorials.

    This is my capx:


    and this is the event code excerpt:

    <img src="http://ramenchan.files.wordpress.com/2012/09/webstorage.jpg" border="0">

    The "WebStorage: Set local key..." doesn't seem to work (or I'm using it in the wrong way).

    The variable "highscores" is my global variable that contains all the highscores, concatenated so that I can draw single pieces out using "tokenat".

    "savedHighscores" is supposed to be the key for the cookie storage.

    As you can see, I have a "debugText" textbox where I print some things for debugging. When I debug-print my own global value "highscores", the correct concatenation is being displayed (this line is set to "toggle disabled" in the screenshot).

    But when I put the key "savedHighscores" into the debug text, then nothing shows, it's empty.

    What am I doing wrong?

  • Aeris85: You're trying to display a key named "savedHighscores" when you actually have saved in a key named "savedHighscore" (without the ending "s").

    It's simply not the same key.

  • Darn, typo, I just realized it as well xD !

    Okay, so here my next problem:

    For displaying my highscores, I use the following formatting (global variable version):

    "1. " & tokenat(highscores, 0, ":") & "     " & tokenat(highscores, 1, ":")

    This works!!

    The "tokenat" function extracts the correct parts of my loooooong "highscores" string.

    So now, when I want to replace that with the "webStorage" saved string, I had to do this, right (WebStorage version)?

    "1. " & tokenat(WebStorage.LocalValue("savedHighscore"), 0, ":") & "     " & tokenat(WebStorage.LocalValue("savedHighscore"), 1, ":")

    Namely replacing the "highscores" with "WebStorage.LocalValue("savedHighscore")".

    But this does not work. When I enter one highscore, close the game and reopen it, the old highscore isn't there anymore.

  • Aeris85: You should start a new topic rather than hi-jacking old ones and provide updated capx (uploaded on dropbox preferably) with/for each new question.

    The problem here is that you set the key to a new value before displaying it.

    You're missing some point in your project that first loads the values from the webstorage into the global variable "highscores".

    It's just a matter of logic of the actions here.

    I talk more about this in the "Webstorage" section of my tutorial "Asteroid in less than 100 events".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm, imho it's better to use an existing topic that is _just about_ my questions (=tokenat and WebStorage for a highscore list) rather than creating a new one, asking the same thing and appending some little stuff.

    Thank you for your advice, I think I'll get it done from this point on!

    I just looked into your tutorial: seams like a hell lot of work, and I'll read it to learn more stuff.

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