Looking for example code of the leaderboard
Hi. I'm looking for an example of the use of the dimeRocker API for creating a leaderboard.
I cant get the sample code in the docs to work. Multiple errors.
Can you post what you are trying to do? Then we should be able to figure it out.
I'm just trying to get this tut to work:
http://docs.dimerocker.com/files/Leaderboard-js.html
The following code throws up multiple errors:
void LeaderboardWindow( int i )
{
int colWidth = 100;
GUIStyle nStyle = new GUIStyle();
GUILayout.BeginHorizontal();
GUILayout.Label("Rank", GUILayout.Width(colWidth));
GUILayout.Label("Player", GUILayout.Width(colWidth * 2));
GUILayout.Label("Wins", GUILayout.Width(colWidth));
GUILayout.EndHorizontal();
ArrayList leaderboard = drClient.leaderboard.GetCachedLeaderboard( 6 );
if( leaderboard != null )
{
if( leaderboard.Count > 1 )
{
ArrayList entries = (ArrayList)leaderboard[1];
if( entries.Count != 0 )
{
foreach( Hashtable entry in entries )
{
GUILayout.BeginHorizontal();
GUILayout.Label( entry["rank"].ToString(), GUILayout.Width(colWidth));
GUILayout.Label( entry["username"].ToString(), GUILayout.Width(colWidth * 2));
GUILayout.Label( entry["score"].ToString(), GUILayout.Width(colWidth));
GUILayout.EndHorizontal();
}
}
}
}
}
I put this code in the drClient.js script.
I think it's how its declared. There is no function parameter and i get the following errors :
Assets/Standard Assets/dimeRocker/Scripts/drClient.js(435,5): UCE0001: ';' expected. Insert a semicolon at the end.
Assets/Standard Assets/dimeRocker/Scripts/drClient.js(435,29): BCE0044: expecting ), found 'i'.
Assets/Standard Assets/dimeRocker/Scripts/drClient.js(435,31): BCE0043: Unexpected token: ).
Assets/Standard Assets/dimeRocker/Scripts/drClient.js(437,9): BCE0044: expecting :, found 'colWidth'.
I would love a scene file I could actually download with the code from this tut.
Also not to cross post but as a noob I'm unclear how to access dimeRocker Prefab in a game with multiple scenes in Unity. Do I need to add Prefab to every scene in my game.
And can I test things like leaderboards locally on unity or do I have to make a new Version and upload to test?
java sample scene doesn't work properly either as far as I can tell. when you hit play in the unity editor the interface comes up but as soon as you try to enter several values you get these errors:
Errors:
FormatException: Input string was not in the correct format
System.Int32.Parse (System.String s)
System.Convert.ToInt32 (System.String value)
drLeaderboardExample.LeaderboardWindow (Int32 id) (at Assets\dimeRocker\Examples\Scripts\drLeaderboardExample.js:93)
UnityEngine.GUI+_Window.Do ()
UnityEngine.GUI.BeginWindows (UnityEngine.Event e, Int32 skinMode, UnityEngine.IDList idlist, Int32 editorWindowInstanceID)
I have to admit to a bit of frustration at this point. I got my game up on dimerocker in less then an hour. But getting this leaderboard to work has been an 18 hour straight endeavor with No successful results.
I put this code in the drClient.js script.
That will cause a handful of errors. The example code is written in C#, and that drClient is JavaScript.
Do I need to add Prefab to every scene in my game.
No. Add it to your first scene, and make sure that's not a scene you ever go back too. Make sure it's a "Loading" scene, not a "Menu" scene. Otherwise you'll have multiple dR prefabs in your game.
The dR prefab is not destroyed when switching scenes.
java sample scene doesn't work properly either as far as I can tell
Make sure you fill in the required information for the example. Enter the LeaderboardId and pageSize and click Fetch Scores.
Make sure you have a leaderboard set up through Stack (http://stack.dimerocker.com) and the page size is the number of records you're trying to request.
leaderboards locally on unity
Yes, you can test leaderboards locally. When you run it in Unity, it returns their dR account information, not Facebook information (because you're not on Facebook).
The example will need some fixing, and a C# and Javascript version should be provided in a sample scene. I'll see if I can get that out today.
That explains a bit , I was wondering if it was c# or pseudo code. It was confusing because the URL for the sample in docs actually says Leaderboard-js.html . Which I mistook as this is the Java code sample.
( Too many triple shifts :) )
Also I had the prefab in a menu scene so its good to know that needs to be changed.
I try to avoid C# so I agree that Java versions in the Docs is a good move.
The URL says that because the docs are generated from NaturalDocs, and the original file that the example is written from is a .js file. I can understand how that bit is confusing.
The leaderboard example in now updated (make sure to refresh browser/empty cache to make sure you get it) along with a Unity example project with C# AND JavaScript scripts in it.
I like your Blog post and A full line-up of all printers for all your printing and multifunction needs; suitable for home printing and home office use Network Printer
HP All IN One Printer
Wireless Printer
Windows Printer Drivers
Printer Offline
Reinstall HP Printer
Printer to Network
Printer Setup
WiFi Printer
Bluetooth Printer
Printer Support
Brother Printers
Canon Printers
HP Printers
Kodak Printers
Lexmark Printers
Epson Printers
Laser Printer
I didn't even know that there was a docs page on dimerocker.com I'm excited to browse through all of your online storage of documents. This will surely help me become more efficient as a Unity developer. I'm hoping it will make me a more knowledgeable programmer! Thanks for the link!
Many Multi Function Printer types, regardless of the category they fall in to, also come in a "printer only" variety, which is the same model without the MFC Printer scanner unit included ,offering a wireless connection to your network. Multifunction Printers can satisfy several of your most important office needs with one single device. Get all of your printing, scanning, copying and faxing accomplished with Multifunction Printers from Super Warehouse.


Hey,
Check out this section of our docs, they've just been updated.
http://docs.dimerocker.com/files/Leaderboard-js.html