00:00
00:00
Newgrounds Background Image Theme

Someone gifted MetalSlayer69 supporter status!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Edits to post #27153740 by RaIix

Edited

At 12/26/21 01:40 PM, AnderssonKev wrote: I can't see any leaderboard on the page for the game. It's not published yet but in preview at the moment.


Yeah, neither medals nor scoreboards are visible under the game in preview. But they will be there after you publish the project.


If you want to be really sure you got it working, call the getScores component and log the results. Something like:

// See: http://www.newgrounds.io/help/components/#scoreboard-getscores

public void LoadScore(int scoreboardId)
{
    var getScores = new io.newgrounds.components.ScoreBoard.getScores();
    getScores.id = scoreboardId;
    getScores.period = "A"; // all-time
    getScores.social = false;
    getScores.limit = 10; // you need to set this, otherwise it will be "0"
    getScores.callWith(ngioCore, OnScoresLoaded); // assuming 'ngioCore' is your core.cs component
}

void OnScoresLoaded(io.newgrounds.results.ScoreBoard.getScores result)
{
  if (result.success)
  {
    for (int i = 0; i < result.scores.Count; i++)
    {
      var score = (io.newgrounds.objects.score) result.scores[i];
      Debug.Log($"{score.user.name}:  {score.value}");
    }
  }
}


I didn't test it, but if I'm not mistaken, it should pull the last ten scores from your scoreboard. If your scoreboard is set up correctly and you posted scores to the scoreboard before, you should see them logged in the console.


Also if you enable output_network_data in the core, it will log the server response when you post a score. If it returns "success": true, everything went well.

Server Response:
{"success":true,"app_id":"00000:7AmKXjdJ","result":[{"component":"ScoreBoard.postScore","data":{"success":true,"scoreboard":{"id":10978,"name":"Score"},"score":{"formatted_value":"100","value":100,"tag":null}}}]}

At 12/26/21 01:40 PM, AnderssonKev wrote: I can't see any leaderboard on the page for the game. It's not published yet but in preview at the moment.


Yeah, neither medals nor scoreboards are visible under the game in preview. But they will be there after you publish the project.


If you want to be really sure you got it working, call the getScores component and log the results. Something like:

// See: http://www.newgrounds.io/help/components/#scoreboard-getscores

public void LoadScore(int scoreboardId)
{
    var getScores = new io.newgrounds.components.ScoreBoard.getScores();
    getScores.id = scoreboardId;
    getScores.period = "A"; // all-time
    getScores.social = false;
    getScores.limit = 10; // you need to set this, otherwise it will be "0"
    getScores.callWith(ngioCore, OnScoresLoaded); // assuming 'ngioCore' is your core.cs component
}

void OnScoresLoaded(io.newgrounds.results.ScoreBoard.getScores result)
{
  if (result.success)
  {
    for (int i = 0; i < result.scores.Count; i++)
    {
      var score = (io.newgrounds.objects.score) result.scores[i];
      Debug.Log($"{score.user.name}:  {score.value}");
    }
  }
}


I didn't test it, but if I'm not mistaken, it should pull the last ten scores from your scoreboard. If your scoreboard is set up correctly and you posted scores to the scoreboard before, you should see them logged in the console.


Also if you enable output_network_data in the core, it will log the server response when you post a score. If it returns "success": true, everything went well.

Server Response:
{"success":true,"app_id":"00000:7AmKXjdJ","result":[{"component":"ScoreBoard.postScore",
"data":{"success":true,"scoreboard":{"id":10978,"name":"Score"},
"score":{"formatted_value":"100","value":100,"tag":null}}}]}

Edited

At 12/26/21 01:40 PM, AnderssonKev wrote: I can't see any leaderboard on the page for the game. It's not published yet but in preview at the moment.


Yeah, neither medals nor scoreboards are visible under the game in preview. But they will be there after you publish the project.


If you want to be really sure you got it working, call the getScores component and log the results. Something like:

// See: http://www.newgrounds.io/help/components/#scoreboard-getscores

public void LoadScore(int scoreboardId)
{
    var getScores = new io.newgrounds.components.ScoreBoard.getScores();
    getScores.id = scoreboardId;
    getScores.period = "A"; // all-time
    getScores.social = false;
    getScores.limit = 10; // you need to set this, otherwise it will be "0"
    getScores.callWith(ngioCore, OnScoresLoaded); // assuming 'ngioCore' is your core.cs component
}

void OnScoresLoaded(io.newgrounds.results.ScoreBoard.getScores result)
{
  if (result.success)
  {
    for (int i = 0; i < result.scores.Count; i++)
    {
      var score = (io.newgrounds.objects.score) result.scores[i];
      Debug.Log($"{score.user.name}:  {score.value}");
    }
  }
}


I didn't test it, but if I'm not mistaken, it should pull the last ten scores from your scoreboard. If your scoreboard is set up correctly and you posted scores to the scoreboard before, you should see them logged in the console.


At 12/26/21 01:40 PM, AnderssonKev wrote: I can't see any leaderboard on the page for the game. It's not published yet but in preview at the moment.


Yeah, neither medals nor scoreboards are visible under the game in preview. But they will be there after you publish the project.


If you want to be really sure you got it working, call the getScores component and log the results. Something like:

// See: http://www.newgrounds.io/help/components/#scoreboard-getscores

public void LoadScore(int scoreboardId)
{
    var getScores = new io.newgrounds.components.ScoreBoard.getScores();
    getScores.id = scoreboardId;
    getScores.period = "A"; // all-time
    getScores.social = false;
    getScores.limit = 10; // you need to set this, otherwise it will be "0"
    getScores.callWith(ngioCore, OnScoresLoaded); // assuming 'ngioCore' is your core.cs component
}

void OnScoresLoaded(io.newgrounds.results.ScoreBoard.getScores result)
{
  if (result.success)
  {
    for (int i = 0; i < result.scores.Count; i++)
    {
      var score = (io.newgrounds.objects.score) result.scores[i];
      Debug.Log($"{score.user.name}:  {score.value}");
    }
  }
}


I didn't test it, but if I'm not mistaken, it should pull the last ten scores from your scoreboard. If your scoreboard is set up correctly and you posted scores to the scoreboard before, you should see them logged in the console.


Also if you enable output_network_data in the core, it will log the server response when you post a score. If it returns "success": true, everything went well.

Server Response:
{"success":true,"app_id":"00000:7AmKXjdJ","result":[{"component":"ScoreBoard.postScore","data":{"success":true,"scoreboard":{"id":10978,"name":"Score"},"score":{"formatted_value":"100","value":100,"tag":null}}}]}