A local Leaderboard with unlimited playerslots.

Hello! My first topic! sweet.

I am constructing a gyro-based game for a digital printing company in Gothenburg, Sweden,
And in that game they want a local “highscore”-list for an conference. The idea is that people will walk by, be curious, try the game on a device connected to a screen, get a time-score (its a one-level time-based game) and enter their name to be added on the leaderboard.

So what I need to learn is how to make a input text with the native.keyboard and connect that name to the previously played gamescore, add that string to the correct position in a table full of scores.

Does anybody know a good tutorial, sample app, that has any of these functions for me to take a look at?
Does this make any sense?
[import]uid: 181568 topic_id: 32974 reply_id: 332974[/import]

You will need to now about the native.newTextField() API call to read in the player’s name. You will need a score variable that you reset to 0 at the start. On game over, collect their name and the score variable will be holding their current score.

Then you will need to know about the table functions. The easiest thing is to do something like:

highscores[#highscores+1] = {} -- create a new entry at the end of the table  
highscores[#highscores].name = nameTextField.text  
highscores[#highscores].socre = score  
-- I didn't need the +1 on the last two since in the first one we created a record at the end of the table  
-- in the next two I just want to reference that record which is now the end of the table.  

Then you will need to learn how to do a table.sort() to put the scores in order.

Conversely, you could run a simple for loop over the existing scores, find out where that score belongs and do a table.insert() at the right index.

It is one of those 6 of one, half-dozen of another things.
[import]uid: 19626 topic_id: 32974 reply_id: 130944[/import]

You will need to now about the native.newTextField() API call to read in the player’s name. You will need a score variable that you reset to 0 at the start. On game over, collect their name and the score variable will be holding their current score.

Then you will need to know about the table functions. The easiest thing is to do something like:

highscores[#highscores+1] = {} -- create a new entry at the end of the table  
highscores[#highscores].name = nameTextField.text  
highscores[#highscores].socre = score  
-- I didn't need the +1 on the last two since in the first one we created a record at the end of the table  
-- in the next two I just want to reference that record which is now the end of the table.  

Then you will need to learn how to do a table.sort() to put the scores in order.

Conversely, you could run a simple for loop over the existing scores, find out where that score belongs and do a table.insert() at the right index.

It is one of those 6 of one, half-dozen of another things.
[import]uid: 19626 topic_id: 32974 reply_id: 130944[/import]

Thank you Miracle-Rob, you have been most helpful.

I will dedicate my whole day tomorrow to the native.textfield(). For I have procrastinated it for too long in favor of more joyous code snippets.

Good day to you sir! [import]uid: 181568 topic_id: 32974 reply_id: 131074[/import]

You may want to look into our GGScore lib in the code-exchange for the actual storing of the scores. [import]uid: 119420 topic_id: 32974 reply_id: 131082[/import]

Thank you Miracle-Rob, you have been most helpful.

I will dedicate my whole day tomorrow to the native.textfield(). For I have procrastinated it for too long in favor of more joyous code snippets.

Good day to you sir! [import]uid: 181568 topic_id: 32974 reply_id: 131074[/import]

You may want to look into our GGScore lib in the code-exchange for the actual storing of the scores. [import]uid: 119420 topic_id: 32974 reply_id: 131082[/import]

Hey Glitch Games!

I have looked into your GGscore and I like the promise, but I cant get it to work. As soon as I require GGScore in my Main.lua file, nothing happens. Black startup without an error message. Tried in two different working applications and both of them had the same outcome.

Anything I have missed perhaps? [import]uid: 181568 topic_id: 32974 reply_id: 131231[/import]

There was a syntax error in the current version that I have now fixe,d could you get the latest and try again? [import]uid: 119420 topic_id: 32974 reply_id: 131236[/import]

Sure Can! Gimme 10 minutes,
[import]uid: 181568 topic_id: 32974 reply_id: 131237[/import]

Okay, its now in place and I am able to require the code. Cheers.
Do you want me to post on the code exchange page instead if I have further questions?

Thanks again! [import]uid: 181568 topic_id: 32974 reply_id: 131239[/import]

Hey Glitch Games!

I have looked into your GGscore and I like the promise, but I cant get it to work. As soon as I require GGScore in my Main.lua file, nothing happens. Black startup without an error message. Tried in two different working applications and both of them had the same outcome.

Anything I have missed perhaps? [import]uid: 181568 topic_id: 32974 reply_id: 131231[/import]

There was a syntax error in the current version that I have now fixe,d could you get the latest and try again? [import]uid: 119420 topic_id: 32974 reply_id: 131236[/import]

Sure Can! Gimme 10 minutes,
[import]uid: 181568 topic_id: 32974 reply_id: 131237[/import]

Okay, its now in place and I am able to require the code. Cheers.
Do you want me to post on the code exchange page instead if I have further questions?

Thanks again! [import]uid: 181568 topic_id: 32974 reply_id: 131239[/import]

Awesome glad that fixed it! It’s probably best to post on the GGScore post that way other users can get the same answers/fixes etc [import]uid: 119420 topic_id: 32974 reply_id: 131377[/import]

Awesome glad that fixed it! It’s probably best to post on the GGScore post that way other users can get the same answers/fixes etc [import]uid: 119420 topic_id: 32974 reply_id: 131377[/import]