1 Scores
Max edited this page 2015-02-06 15:00:51 +03:00

General

Game Jolt supports multiple online high score tables per game. With this you are able to, for example, have a score board for each level in your game. Gamers battle to achieve the highest scores for your game. With multiple formatting and sorting options, the system is quite flexible.

You are able to include extra data with each score that you submit to Game Jolt. If there is other data associated with the score such as time played, coins collected, etc, you should definitely include it. It will be helpful in a case where you believe a gamer has illegitimately achieved a high score.

Adding a new score

Adds a score for a user or guest.

You can add a score using GJ.addScore(score, desc, tableID, guestName, extraData).

  • score - This is a numerical sorting value associated with the score. All sorting will work off of this number. Example: 234.
  • desc - This is a string value associated with the score. Example: "234 Jumps".
  • tableID - The id of the high score table that you want to submit to. If left blank the score will be submitted to the primary high score table.
  • guestName - The guest's name. Leave blank (or put nil) if you're storing for a user.
  • extraData - Note that this is only retrievable through the API. It never shows on the actual site.
local success = GJ.addScore(250, "kills")

Fetching scores

Returns a list of scores either for a user or globally for a game.

  • limit - The number of scores you'd like to return. The default value is 10 scores. The maximum amount of scores you can retrieve is 100.
  • table_id - The id of the high score table that you want to get high scores for. If left blank the scores from the primary high score table will be returned.
local list = GJ.fetchScores(5)

The result is array of tables that look like this:

  • score - The score string.
  • sort - The score's numerical sort value.
  • extra_data - Any extra data associated with the score.
  • user - If this is a user score, this is the display name for the user.
  • user_id - If this is a user score, this is the user's ID.
  • guest - If this is a guest score, this is the guest's submitted name.
  • stored - Returns when the score was logged by the user.

Fetching highscore tables

Returns a list of high score tables for a game.

local list = GJ.fetchTables()

The result is array of tables with following fields:

  • id - The high score table identifier.
  • name - The developer-defined high score table name.
  • description - The developer-defined high score table description.
  • primary - Whether or not this is the default high score table. High scores are submitted to the primary table by default.