Need an Idiot's guide to LeaderBoards :)
First off I would like to thank everyone for all the help/code over the last couple of days.
I have been trying to sort out how to get a players score and post it to a Top Ten list, if it is higher then what is already stored. Sadly I'm mainly an artist first, not a coder. I try to stick with Java if at all possible because who has the time to learn yet another programming language.
After some help I was finally able to post some data to my leaderboard but it is in two columns, not one like I expected. :
Rank Name Score Rank Player Score
1 231 9999 1 2 3
I'm happy there is something in there at all but I expected something more like:
Rank Player Score
10 grfxman 150
09 John 100
ETC...
I got the data in there by using the drExamples scene that comes with the Java dimeRocker SDK download Obviously I wasn't totally sure what each of these values represented :
pageUp
pageDown
pageSize
Also I'm not sure how to:
_1 Post a score in Java.
_2 Remove garbage posts to leaderboard.
_3 Get a single column with the proper labels.
_4 how to make sure it only posts if the score is actually higher.
----------------------------------------------------------------------------------------------------
In general it's safe to say I'm fairly confused about how to use leaderboards in general.
Any help would be appreciated
Awesome, glad to hear its all working.
I Ported the Post data example to Java.
Original in C# at:
http://docs.dimerocker.com/files/Post_Score-js.html
Java Version:
/////////////////////////////////
//from Christian www.thesoloprojects.com
///////////////////////////////
function PostPlayerScore( newScore : int )
{
// Usee Your generated LeaderBord ID here
leaderboardId = 103;
var localUser = drClient.profiles.GetLocalUser(); // Get cached local user profile
var userRecord : Hashtable = drClient.leaderboard.GetUserRecord();
var oldScore : int = 0;
// If user has a high score, assign high score to oldScore
if( userRecord != null )
oldScore = int.Parse(userRecord["score"].ToString());
// If the new score higher than the old record, post score
if( newScore > oldScore )
{
yield drClient.leaderboard.PostScore( leaderboardId, localUser.GetId(), newScore, new Array (), 0, 0 );
drClient.leaderboard.FetchUserRecord( leaderboardId, localUser.GetId() );
}
//if player has no score yet make one
if( userRecord == null )
{
yield drClient.leaderboard.PostScore( leaderboardId, localUser.GetId(), newScore, new Array (), 0, 0 );
drClient.leaderboard.FetchUserRecord( leaderboardId, localUser.GetId() );
}
}
Please let me know if there are any errors or if it can be improved/simplified :)
To test check Here:
http://apps.facebook.com/alienarcadeattack/
Hi, I post this question here since it is related to leaderboards. I am dealing with three different leaderboards in the same game. While I was trying to put some defensive code, I realized I could not find a way of determining if the current player has not posted a score to the leaderboard yet.
Lets say I have two leaderboard ids (lb1 and lb2), and the local user has posted a score to l1, but not to l2.
Here is what is happening in my specific case (I am not showing the yields and StartCoroutines for clarity).
1.- I do drClient.Leaderboard.FetchEntry(lb1)
2.- This will set drClient.Leaderboard.userEntry to the drLeaderboardEntry of this user in lb1.
3.- Then I do drClient.Leaderboard.FetchEntry(lb2)
4. If I check drClient.Leaderboard.userEntry, it will have the old drLeaderboardEntry even if I set userEntry to null prior to the 2nd Fetch call.
This means, I cannot determine if the user has a score posted to the leaderboard. In my game, I show the first 10, and then show the players current rank in the bottom.
To correct this, I had to go into FetchEntry code and add line before the code
...
if (www.isSuccess) {
if( www.hashtable != null )
userEntry = new drLeaderboardEntry(www.hashtable);
the code would have to look like this:
...
userEntry = null; // added line
if (www.isSuccess) {
if( www.hashtable != null )
userEntry = new drLeaderboardEntry(www.hashtable);
After this correction, I can check (drClient.Leaderboard.userEntry == null) to determine if the player has posted a score to the specific leaderboard.
My question is: Would this affect something else I am not seeing within the dimeRocker code? If I can't use this correction, would the only option be to look at drWWW.hashtable for the answer (I rather not go to this level of detail in my game's code)?
Well, it's all about something to do with programmer. Only an expert programmer know about coding very well. So you had better keep in touch with expert programmer to do your job done well. Otherwise you are only going to waste your time in vain. If your problem had some thing about Content Solutions, I would give you some ideas on this regard.
I agree with your conclusions and will eagerly look forward to your incoming updates. Just saying thanks will not just be enough, for the phenomenal clarity in your writing.


Nick at pasture pondering walked me thru the leader boards. got it all working now.