gamecircle.Leaderboard.GetLocalPlayerScore

Type function
Library gamecircle.*
Return value None
Revision Release 2024.3703
Keywords leaderboard, scores, get

Overview

Use this function to fetch the local players score and rank on a given leaderboard and filter constant.

Syntax

gamecircle.Leaderboard.GetLocalPlayerScore( id, LF_constant, callback )
id (required)

String. The GameCircle ID of the leaderboard.

LF_constant (required)

String. This is the Leaderboard Filter constants and is use to related to the GameCircle SDK's inteneral enumerator. It has four valid values: "GLOBAL_ALL_TIME", "GLOBAL_WEEK", "GLOBAL_DAY", & "FRIENDS_ALL_TIME". If a string is put into this parameter that doesn't match one of these four strings, then the function will default to using "GLOBAL_ALL_TIME".

callback (required)

Function. The callback function for when the achievement's information has been fetched. The callback will recieve a single parameter of type LocalPlayerScoreReturn

Examples

local leaderboardId = "myFirstLeaderboard"  
local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, true, false)  
function LeaderboardCallback(returnValue)  
    if returnValue.isError == true then  
        print("Get Scores request returned with error message: " .. returnValue.errorMessage)  
    else  
        print("Score information recieved for Leaderboard!")  
        print("The local player is rank " .. returnValue.rank .. " with a score of " .. returnValue.score .. ".")  
    end  
end  
gamecircle.Leaderboard.GetLocalPlayerScore(leaderboardId, "GLOBAL_WEEK", LeaderboardCallback)