How do i take best score from clay.io and post on screen

0 favourites
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • How do i take best score from clay.io leader board and post on specific area. like i have made text area for that.

  • Nobody knows that or nobody wants to help?

  • If they don't know why would they answer? Do you really want a bunch of replies saying "I don't know"? Isn't that very counter intuitive? If someone who knows sees this, maybe they will respond.

  • BluePhaze True my friend. But how come nobody has implemented this so far?

  • ashar, it's quite easy to do once you know how. I'll have a look on my PC later and let you know if no one else chimes in first. Have a look at the load leaderboard function in the plugin and the documentation on the clay website - I don't recall of it was explicitly described there but you might be able to figure it out before I get access to my last game that used it. LD29 has taken over my life hence the slow reply...

  • Plenty of people may have implemented it, but you have to hope out of the percentage that have used it, a percentage of those hopefully see this discussion thread.

  • OK, first of all there are a couple of excellent tutorials that you should read before trying this (if you haven't done so already):

    integrating leaderboards... by austin

    how to make custom leaderboard by CanGame

    It is also worth bookmarking the clay.io manual page for construct 2 here. Austin has done an outstanding job at not only creating the plugin but also documenting how to use it.

    Now for the direct answer that you are after:

    After posting the high score to clay.io, create an event to retrieve the leaderboard object, which will then be remembered by the plugin. You could easily show the top 10 scores this way as shown in the custom leaderboard tutorial above. The top score is contained at index 0 of the leaderboard - your event should look like this:

    You also have the option to specify downloading the Personal leaderboard for the player, so you could choose to give them some banter as to why they haven't beaten their previous high score...

  • Colludium Thank you so much. I tried it. But problem is with plugin i guess. When i select "PERSONAL" from clay.io plugin drop down menu in "Fetch Leaderboard Object" then it shows NaN. When i chose "ALL" or other options then it shows

  • ashar - that's a pity. I haven't tried it in a game myself so it could be the plugin is at fault. Just to be sure, could you share screen shots of the dialog boxes / capx to see if it's a code error?

  • Colludium Yes please help me out. Its a zip file.

  • Here is the screen shots.

  • OK, there are a few things going on here, none of which I can explain...!

    I get a javascript error when the game loads in Chrome; closing the dialog allows me to continue but I'm not sure that the plugin is working correctly (the plugin works fine on my games but something in your game is causing an exception - and I don't know why). Are your game API key and leaderboard id correct? They are the only things I can think of that might cause errors like these...

    Then, when my bird crashes I get this error:

    Also, lines 8 to 11 in "Game events" post to the leaderboard without you first checking to see if the plugin has connected; there are a couple of facebook commands in the start event sheet that could also cause a problem. It could fail there if there is no connection to the clay server when you make these calls.

  • Gah! Ninja'd by your second post!

  • Colludium You are also unable to fix this problem ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • ashar - I just added the clay plugin to my current game to see if it works and I didn't get an error. I set up a popup notice for the game being in clay and it seemed to load ok. Not sure if the problem before was in fact the plugin or maybe a server side issue with clay. Are you still having trouble with yours?

    Edit: The game above was not registered with clay so some of the server hand-shaking will not have taken place. However, I did get my LD29 game to work in clay without any problem just over a week ago, now I come to think of it! So I suspect that the problem was with the clay server - unless you're still seeing it?

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)