Be a Supporter!

Newgrounds Wiki: ScoreBoard

Description Handles loading and posting of high scores and scoreboards.

ScoreBoard.getBoards

Return to Top ^Returns a list of available scoreboards.

Returns:

scoreboards - array<scoreboard>
An array of scoreboard objects.

ScoreBoard.getScores

Return to Top ^Loads a list of score objects from a scoreboard. Use 'skip' and 'limit' for getting different pages.

Parameters:

id - int
The numeric ID of the scoreboard.

limit - int
An integer indicating the number of scores to include in the list. Default = 10. (optional)

period - string
The time-frame to pull scores from (see notes for acceptable values). (optional)

skip - int
An integer indicating the number of scores to skip before starting the list. Default = 0. (optional)

social - boolean
If set to true, only social scores will be loaded (scores by the user and their friends). This param will be ignored if there is no valid session id and the 'user' param is absent. (optional)

tag - string
A tag to filter results by. (optional)

user - mixed
A user's ID or name. If 'social' is true, this user and their friends will be included. Otherwise, only scores for this user will be loaded. If this param is missing and there is a valid session id, that user will be used by default. (optional)

Returns:

limit - int
The query skip that was used.

period - string
The time-frame the scores belong to. See notes for acceptable values.

scoreboard - scoreboard
The scoreboard being queried.

scores - array<score>
An array of score objects.

social - boolean
Will return true if scores were loaded in social context ('social' set to true and a session or 'user' were provided).

user - user
The user the score list is associated with (either as defined in the 'user' param, or extracted from the current session when 'social' is set to true)

Notes:

Acceptable 'period' values:
"D" = current day (default)
"W" = current week
"M" = current month
"Y" = current year
"A" = all-time

If 'social' is true, but no 'user' is provided,

ScoreBoard.postScore

Return to Top ^Posts a score to the specified scoreboard.

Parameters:

id - int
The numeric ID of the scoreboard.

tag - string
An optional tag that can be used to filter scores via ScoreBoard.getScores (optional)

value - int
The int value of the score.

Returns:

score - score
The score that was posted to the board.

scoreboard - scoreboard
The scoreboard that was posted to.

Notes:

If this board uses incremental scores, the new total score value will be returned.
This method can use [wiki:wiki/creator-resources/newgrounds-apis/newgrounds-io/encryption encryption].