API Highscores

14 posts

Flag Post

In my game I put this code for highscores and dont have nothing in the leadboarders. Please help my.

kongregate.stats.submit(“Score”,398);

 
Flag Post

Did you connect to Kongregate? If so you’re going to have to have around 50 submissions for it to show on the leaderboards, so maybe wait a day or two?

 
Flag Post

thanks you

 
Flag Post

I have this problem too. My game is html5-javascript. I can only submit an IFrame.

So i don’t understand the js sample. Do i need to integrate the following into my game iframe?

<!-- Load the Kongregate Javascript API --> API is finished loading function onLoadCompleted(){ // Get a global reference to the kongregate API. This way, pages included in the // iframe can access it by using “parent.kongregate” kongregate = kongregateAPI.getAPI(); // Embed the game into the “contentdiv” div, which is defined below. You can also // manually create your own iframe, this function is just for convenience. // This example also passes along the kongregate user_id and game_auth_token so // that the page can use them for authentication.

// var params = “kongregate_user_id=” + kongregate.services.getUserId() +
// “&kongregate_game_auth_token=” + kongregate.services.getGameAuthToken();
kongregateAPI.embedFrame(“game.html?” + params);
}

// Begin the process of loading the Kongregate API: kongregateAPI.loadAPI(onLoadCompleted);
 
Flag Post

Yep, I do believe you’ll need to host your game through an iframe. That code goes inside the html page you will then link to the game upon upload.

 
Flag Post

I did that. I always get an javascript error when calling

kongregate.stats.submit(“Score”,score);

Is there a way i can test that feature?

 
Flag Post

Which error did you get?

 
Flag Post

kongregate not found.

 
Flag Post

Likely you are trying to access the api when the variable was never loaded. Throw some alert() s in there to see when the API has actually finished loading. And see if you are trying to access it prior to that.

(or you are accessing it in the wrong scope possibly)

 
Flag Post

I will try it. Thanks much!

 
Flag Post

Heyo, I just uploaded my first game and I’ve set up the stats and such, everything seems to be all geezy.

I’ve seen a few people suggest waiting a couple of days before high scores kick in, is this normal?

Just wondering if I’ve done something wrong, or if I should wait a couple of days first.

 
Flag Post

Yep, you might get a delay. I think the highscores require 50 (could be a bit higher) submissions to work, but I could be wrong. You can find the info somewhere in the dev center. If you’ve added your highscores in and they work locally, I think you are fine.

 
Flag Post

Oh yep my highscores are up and running!
Cheers for the response :D

 
Flag Post

So, this is f***ing lag – took 3 days to respawn ?:)