0 Favourites

Facebook - Highscore List

  • I've been trying to implement the Facebook object, and its mostly gone smoothly and I'm happy with the way it works, but I've come up against a bit of a wall when it comes to making the highscores list work. At the end of my game, you can submit your score, and it automatically posts a message to your wall saying "I scored X points!" and it works fine.

    The bit I can't work out is how to display a list of scores - say, the top 10, for example.

    When the 'submit' button is pushed, it also "Requests Highscore board" - but what do I do with this? I'm guessing I need to link this to a text field and display the scores in that, but I can't figure it out.

    Has anyone done this successfully yet, and if so, could offer some tips?

    Thanks a bunch

  • 'Request hi-score board' just requests the hi-scores - they arrive a moment later. When they arrive, the Facebook object's 'On hi-score' trigger runs once for each hi-score. In this trigger the HiscoreName, HiscoreRank and Score expressions in the Facebook object are set so you can get the current hi-score e.g. "#1 - Tom Gullen - 1337". A simple way to list scores is to append that to a string object in the 'On hi-score' event, so when it triggers for each hi-score you end up with a full list of scores.

    Note that if the user is submitting a hi-score, it won't appear in the hi-score board until the 'On score submitted' trigger runs. So you might want something like "On score submitted: request hi-score board" to guarantee the score the user is submitting will appear in the hi-scores.

  • could you upload a example Ashly.. I tried to implement facebook to, did no go so good.

  • Thanks for the response Ashley, that helped a lot. I've now successfully got the text field to load up the current user's score, but I can't get it to load up the other users. (to test this, I've got several friends to play and submit scores as well, so there's definitely a few scores being submitted).

    I would totally appreciate an example file if you have one too...

  • FatRat - you have to use 'append text' and a text object big enough. If you use 'set text' only the last score will be shown, or the size of the text box will cut them off. E.g. a big text object with

    + On hi score

    -> Append text Facebook.HiscoreRank & ": " & Facebook.HiscoreName & " - " & Facebook.Score & newline

    Does that work? If not I'll see about making an example.

  • Aha! Yes, thanks a lot. Using 'Append Text' works. I now have a list of highscores, but they are all showing up as '0' score and in the wrong order, but I think that's something I can fix.

  • FatRat. Is there any way you could upload your capx, or a example one? This facebook thing is confusing me.. :S

  • Have you gone through the entire Facebook game tutorial on this site first?

    scirra.com/tutorials/58/how-to-make-a-facebook-game/page-1

    Unless you have the game hosted on a secure domain (https://) the Facebook API has very limited functionality. That was the first headache I had when starting on this...

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Yeah i tried to upload my game onto facebook. I have a server. But as far as a know its not https, how do you get this?

  • I got a certificate from godaddy for about a tenner, but I got a friend to configure it as I don't really know how to set them up. If you have a hosting package, you'll have to look into setting it up on that.

  • FatRat, What did you do to get the facebook scores working, I have a facebook game(Working) But the scores are returning 0 still..

  • I didn't actually do anything, it just suddenly stopped giving me 0's and started posting the actual score. I believe the Facebook API was being updated, or was down for maintenance or something at the time I was initially testing.

    I found a few little bugs like that which seemed to fix themselves - I think Facebook are always making changes to their API and it just causes little niggles. Nothing we can do about it really!

  • I had the same problem making the Facebook plugin itself - it's very frustrating, sometimes it doesn't work but if you come back a few hours later it just works again. Facebook are notorious for being annoying like that with their API, just something we have to put up with unfortunately.

  • Ashley, Are you planning on making a twitter plugin?

    I know its not as useful as facebook, But Twitter and facebook are the two main social networking sites that HAVE to be incorporated in modern games.

  • smitchell not yet, but maybe in future - still, it's an ideal one for a third party plugin dev to take on!

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