[Kongregate API] High Scores page 4 (locked)

Subscribe to [Kongregate API] High Scores 194 posts, 102 voices

Sign in to reply


 
avatar for Mediakitchen Mediakitchen 2 posts
Flag Post

Thanks Jabor. Can you point me in the direction of the info about the statistics API please.

 
avatar for arcaneCoder arcaneCoder 1326 posts
Flag Post

You can find the link in the API sticky.

Statistics/Challenges API

Kongregate API Sticky

 
avatar for spaceplant spaceplant 46 posts
Flag Post

I have a game where the score is a distance from a target, that has to be as low as possible. Is there a way to setup the kongregate highscore so the lowest score is the best? Otherwise I have to make the highscore, by subtracting the distance from a high number, wich would work fine, but just would make as much sense.

 
avatar for spaceplant spaceplant 46 posts
Flag Post

Well now that I posted the question, I see the answers to just that question just above, so never mind. :)

 
avatar for 7luas 7luas 3 posts
Flag Post

Hey, Is It possible to CLEAR the highscore? (or, If Im the owner of the game, delete single entries?)

 
avatar for arcaneCoder arcaneCoder 1326 posts
Flag Post

I believe only admins can delete individual scores. You can clear all of them though by deleting the stat and recreating it.

 
avatar for 7luas 7luas 3 posts
Flag Post

Got It! Thanks man!

Though I gave up on clearing It – I thought there was a glicth In my code because 1 min after I uploaded the game there was more than 20 people on the high-score. Turns out they all did play the game :)

 
avatar for shadab shadab 1 post
Flag Post

Hi

1) By following ur steps in submitting score, is it possible to know whether the user is signIn or not……? If not, i can pop error message saying ‘PLEASE SIGN-IN TO SUBMIT

2) Also after connecting ‘_root.kongregateServices.connect()’, can i get ‘USER NAME’ who is currently playing my game.

Thanks :)

 
avatar for Lysis Lysis 341 posts
Flag Post

You can read the variable level0.kongregateusername – If you’re not logged in it is “Guest” (I checked on a game of mine which pre-fills the name for an external high-score table). And if the game isn’t on Kongregate it’ll be undefined.

…Of course, someone might be able to register the name “Guest” I suppose. But then they’d get what they deserved.

 
avatar for icedavis icedavis 1 post
Flag Post

I just keep getting this error message:

Error Symbol=sprite 93, layer=Layer 1, frame=1:Line 1: Statement must appear within on handler
_root.kongregateScores.submit(score);

does anyone knows what does it mean?

 
avatar for arcaneCoder arcaneCoder 1326 posts
Flag Post

@icedavis: It seems like you’re tyring to put the code onto a MovieClip symbol, when you should be putting it on a frame or in a class. You can put it on a MovieClip if you absolutely need to, but it needs to be inside an “on handler” onClipEvent(*){}) to be used that way.

 
avatar for Acidlava Acidlava 161 posts
Flag Post

now, in the example, we would replace the 1000 with a variable, right? like this:

_root.kongregateScores.submit(score);

score being the score they got?

 
avatar for arcaneCoder arcaneCoder 1326 posts
Flag Post

Generally, yes.

 
avatar for Ragnarok Ragnarok 12 posts
Flag Post

In the following code I attempted to store an array of the user scores from Kongregate into an array ‘userscores,’ but it doesn’t appear to be working properly. How do I change my code such that ‘userscores’ will contain the correct information?

//Connect to Kong server and submit initial score

_root.kongregateServices.connect();

_root.kongregateScores.submit(1000);

//Function called on completed load: returns array of userscores

var scoresCallback:Function = function (result:Object) {

userscores = new Array(result.list.length);

for (i=0; i<result.list.length; i++) {

userscores[i] = result.list[i].username;

}

return userscores;

};

//Request data from Kong server

_root.kongregateScores.requestList(scoresCallback, this);

//Set ‘userscores’ to the object pointed to by this. Hopefully the return value from
//scoresCallback

userscores = this;

 
avatar for arcaneCoder arcaneCoder 1326 posts
Flag Post

Why are you using userscores = this?

 
avatar for Ragnarok Ragnarok 12 posts
Flag Post

Because I don’t know how to access the score data, what should I use?

 
avatar for arcaneCoder arcaneCoder 1326 posts
Flag Post

Remove userscores = this. Then customize the scoresCallback function to use the data how you like. You access it through the result parameter its sending back, like you are trying to do; but you need a purpose. What are you trying to do with the data? For instance, if you want to put in a text field, you could just do something like

my_text.text += result.list[i].username = “\n”;

Really, it all depends on how you plan to use the information.

 
avatar for The_Dodo The_Dodo 286 posts
Flag Post

What version of AS is this script for?

 
avatar for minusdriver minusdriver 122 posts
Flag Post

I entered the following code and I’m having issues. When people play the all get a score of 50. I did have the setting at 20 and changed it to 50 since that was the max top score possible

I entered the code like this

var scoresCallback:Function = function( result:Object ){
    trace("High score result, success=" + result.success );

    for( var i:Number = 0; i < result.list.length; i++ ){
        var position:Number = i + 1;
        trace( position + ". " + result.list[i].username + " - " + result.list[i].score );
    }
}
_root.kongregateScores.requestList( scoresCallback, this );


_root.kongregateServices.connect();
_root.kongregateScores.setMode("Normal");
_root.kongregateScores.submit(50); // Will submit a score of 50 for normal mode
 
avatar for arcaneCoder arcaneCoder 1326 posts
Flag Post

The_Dodo: AS2

minusdriver: I’m not sure what you are stating is exactly the issue.

 
avatar for minusdriver minusdriver 122 posts
Flag Post

Hi ArcaneCoder thanks for quick reply.

Basically I entered that code and its in my game. It seems to be working… well kind of because it is recording the score. But some people aren’t even playing the game and records them with a high score of 50.

I know my game isn’t all that great but its my first one and I’m basically learning and trying to make it much better.

http://www.kongregate.com/games/minusdriver/exploding-bugs

Maybe with a link you can understand what I mean.

 
avatar for arcaneCoder arcaneCoder 1326 posts
Flag Post

But some people aren’t even playing the game and records them with a high score of 50.

Define “playing the game”. Do you mean they haven’t clicked ‘start’ yet?

If you use the submit command to send a value of 50, its going to record them on the score board with that score as soon as you send it.

 
avatar for Cloud_9ine Cloud_9ine 2242 posts
Flag Post

yea, change the 50 to the score variable.

 
avatar for SirKoolAid SirKoolAid 559 posts
Flag Post

Does API work with AS1?

 
avatar for CamposBaptista CamposBaptista 8 posts
Flag Post

My scores API is working just fine and the scores are being submitted, the problem is that you can’t submit a score more than once unless you reload the game again. How can I correct this bug.

The Code………………………………………….

btSubmit.onRelease = function() { 
_root.kongregateServices.connect(); 
_root.kongregateScores.submit(_parent.nScore); 
};

var scoresCallback:Function = function (result:Object) {

trace("High score result, success="+result.success);

for (var i:Number = 0; i<result.list.length; i++) {

var position:Number = i+1;

trace(position+". "result.list[i].username" - "+result.list[i].score);

}

};

_root.kongregateScores.requestList(scoresCallback,this);

_parent.gotoAndStop("MainMenu");

Sign in to reply


Click Here