Leaderboard Not working

Hi,

I used the following to submit scores to leaderboard leaderboards.submitHighScore( leaderboardID, newScore. But when I used gameNetwork UI to view the scores, The scores were not displayed under leaderboard. I also checked the online dashboard but the scores were not updated. Can you please tell me where the problem is?

Hi,

Can you please share your code here for us to look at.

Thanks

-Mohamed

Below is the code, I’m using gameNetwork UI library. I was trying to implement leaderboards for ghost vs monsters game using corona cloud dashboard. 

[lua]

         leaderboardID = “517da9f12befXXXXXXXXXX”

         leaderboards = cloud.leaderboards

         achievementID=“517c7071XXXXXXXXXXXXX”

         achievements = cloud.achievements

local function achievementsListener( event )

    --handle achievements events here

end

achievements.setListener( achievementsListener )

local function leaderboardsListener( event )

    --handle leaderboard events here

end

leaderboards.setListener( leaderboardsListener )

        – GAME OVER WINDOW

        local gameOverDisplay

        

        if isWin == “yes” then

            gameOverDisplay = display.newImageRect( “images/youwin.png”, 390, 154 )

            – Give score bonus depending on how many ghosts left

            local ghostBonus = gameLives * 20000

            local newScore = gameScore + ghostBonus

            setScore(newScore)

              --your leaderboard ID.  

              print(newScore)

            leaderboards.submitHighScore( leaderboardID, newScore )

            achievements.unlock( achievementID )

            

        else

            gameOverDisplay = display.newImageRect( “images/youlose.png”, 390, 154 )

        end

[/lua]

The unlock achievement worked but not the submit highscore!

Thanks,

Vinod 

        

Hi Vinod,

Out of curiosity, I don’t see any content (code) within your “leaderboardsListener” function. Did you simply omit it from this post?

Regards,

Brent Sorrentino

Hi Brent,

I dont have content in there. I’m a newbie to corona, I was just trying to update the leaderboard after the game is over! Should I include any code in there?

Hi Vinod,

You don’t necessarily need anything in there (at this time), I was just curious.

Is the place where you’re submitting the high score a separate scene? Like a new Director or Storyboard scene? Before you submit the score, can you print the values of “leaderboardID” and “newScore” and confirm that they’re not “nil”?

Brent

P.S. - also, in the future, please surround your code blocks in “lua” tags so it’s easier to read. I’ve done this for you in the above post.

[lua][/lua]  

Hi Brent,

Thanks for the advice. I’m not submitting the code in a different scene. Regarding the print, I did try it for new score, the value wasn’t nil!

Thanks,

Vinod

Hi,

Can you please share your code here for us to look at.

Thanks

-Mohamed

Below is the code, I’m using gameNetwork UI library. I was trying to implement leaderboards for ghost vs monsters game using corona cloud dashboard. 

[lua]

         leaderboardID = “517da9f12befXXXXXXXXXX”

         leaderboards = cloud.leaderboards

         achievementID=“517c7071XXXXXXXXXXXXX”

         achievements = cloud.achievements

local function achievementsListener( event )

    --handle achievements events here

end

achievements.setListener( achievementsListener )

local function leaderboardsListener( event )

    --handle leaderboard events here

end

leaderboards.setListener( leaderboardsListener )

        – GAME OVER WINDOW

        local gameOverDisplay

        

        if isWin == “yes” then

            gameOverDisplay = display.newImageRect( “images/youwin.png”, 390, 154 )

            – Give score bonus depending on how many ghosts left

            local ghostBonus = gameLives * 20000

            local newScore = gameScore + ghostBonus

            setScore(newScore)

              --your leaderboard ID.  

              print(newScore)

            leaderboards.submitHighScore( leaderboardID, newScore )

            achievements.unlock( achievementID )

            

        else

            gameOverDisplay = display.newImageRect( “images/youlose.png”, 390, 154 )

        end

[/lua]

The unlock achievement worked but not the submit highscore!

Thanks,

Vinod 

        

Hi Vinod,

Out of curiosity, I don’t see any content (code) within your “leaderboardsListener” function. Did you simply omit it from this post?

Regards,

Brent Sorrentino

Hi Brent,

I dont have content in there. I’m a newbie to corona, I was just trying to update the leaderboard after the game is over! Should I include any code in there?

Hi Vinod,

You don’t necessarily need anything in there (at this time), I was just curious.

Is the place where you’re submitting the high score a separate scene? Like a new Director or Storyboard scene? Before you submit the score, can you print the values of “leaderboardID” and “newScore” and confirm that they’re not “nil”?

Brent

P.S. - also, in the future, please surround your code blocks in “lua” tags so it’s easier to read. I’ve done this for you in the above post.

[lua][/lua]  

Hi Brent,

Thanks for the advice. I’m not submitting the code in a different scene. Regarding the print, I did try it for new score, the value wasn’t nil!

Thanks,

Vinod