Sign In Register

How can we help you today?

Start a new topic

Check if new highscore directly when sending score


We are using Leaderboards and would like to do something specific. We know GameSparks uses a Message system to notify in case of new high score and this kind of stuff. However, we would like to know immediately (i.e not wait for the Message to arrive) when sending a score if it was a new highscore.

We have a very standard event SendScore that is used by our Leaderboard. So the event in CloudCode is empty (we followed the GS documentation for that). Is it possible to add code to this event, in CloudCode, to know if it was a new highscore or not ? Or is there no other way but to wait for the Message sent by GS separately ?



What exactly is the use case here ? The only way I can imagine this working is by pulling the current users leaderboard score back in the "LogEventRequest" Cloud Code script. You could then check it against the score being passed in by the user and pass it back to the response using scriptData if it's higher. Does that sound like it would work for you ? 



The idea is that we are sending the score, then waiting for GS's aknowledgement to fetch the leaderboards themselves and display them (with, obviously, the updated score of our user).

We want to make our user's entry blink if he reached a new highscore, so we would like to have this information as we build our view for the entries, rather than have to store specifically the player's entry somewhere then updating it when we get the message from GS about it being a new highscore.

What you're suggesting sounds like it would work. So, if I understand correctly, any code we type in the Event that sends the score will be executed before the leaderboards are automatically updated, right ? If it's the case, then yes we can fetch the user's score, compare it to the one we're going to register and deduce if it's a new highscore.


Login to post a comment