Sign In Register

How can we help you today?

Start a new topic

How to edit the value of a score field in Leaderboard NoSQL?

I am trying to edit a score field in a leaderboard in a collection in live. The edit pencil icon should allow me to do this but does not appear. I can edit the running totals score field but this has no affect on the leaderboard score field. How do I edit the value of a score field?


1 person has this question

 Hi Nester,


This is not a supported action. The only way scores can be changed in a leaderboard is by a user submitting a score to it via a LogEventRequest. Is there a reason why you are trying to edit them in this fashion ?


Regards,

Liam

Hey Liam, thanks for getting back to us.


We have a score that is suspiciously high. We tracked down the problem to a bug in the game [not a GameSparks issue] and want to adjust the score. Is there a way we can do this without affecting the rest of the leaderboard?

Remove the player entry from the leaderboard with deleteEntriesForCustomId()

 

Spark.getLeaderboards().getLeaderboard(shortCode).deleteEntriesForCustomId(identifier, deleteRunningTotals, customIdFilter)

 And then add the entry back in with your post script.

You can leave customIdFilter empty {} to delete the whole entry from the player, not only the score.
I'm new  but I think that's it.


Hi Nester,


Flavio is correct here. You can use that call to remove an entry for the given player. You can read more about it here in our Sparkleaderboard documentation. There is also a SparkPlayer call which can be used to hide players on leaderboards. You can read about it here. With this you can keep suspicious players off the leaderboards if required. Let us know if you have any further questions.


Regards,

Liam 

Hey Flávio Correia, thank you for the reply [thanks to support as well :-)] So just to clarify, to change or amend a leaderboard entry we access the leaderboard database using unique id [generated when the player set the leaderboard entry] through our game engine [in this case Unreal 4]

 

We are currently using blueprints, we will take a look at setting up a c++ project that will allow us to use the call you have mentioned in previous posts.


Oh, is there a way to do this via blueprints? Have had a look but cannot find a blueprint node that will allow this.


Hey,


We have setup our game as an Unreal c++ project and we can now connect to our GameSpark server [followed the Unreal cpp quickstart guide]


We have tried using deletEntriesForCustomId but the notation Spark. errors on compile as error C2065: 'Spark': undeclared identifier


The Cloud Code API documentation says 'The Spark object that is available to all scripts is the entry point into the GameSparks API.'


Is there a #include in the header or .cpp we need for this to work?


Do we need to call the method through GameSparks::Api eg. (GameSparks::Api::Requests::deleteEntriesForCustomId);


Is there some documentation that explains how this should be setup?


We have been working away at this for a while now and have not really made any progress, any help would be greatly appreciated :-)

The easiest way I would do it right know to remove that entry quick would be to create an EVENT and run Spark.getLeaderboards().getLeaderboard(shortCode).deleteEntriesForCustomId(identifier, deleteRunningTotals, customIdFilter) As CloudCode in GameSparks platform and call it through the TestHarness LogEvent. Be sure to send an authentication request first.

(Wait Support  to clarify if it Works on Live tough)


You can then edit that event if you want , and pass some variables as shortcode , identifier and so on as "used in script".. and do a GameSparks.Api.Requests.LogEventRequest().SetEventKey("Your_event").SetEventAttribute("Your_attributes", value). In Unreal, check documentation exemples to see proper implementation 
(In the case you want do an admin cliente or something like that)


1 person likes this

Ah, I see, so I have setup a script in cloud code on the existing leaderboard event. I have authenticated using Authentication AuthenticationRequest. I am in live with debug credential set. When running the event with the cloud code I receive an error

 

!stack: [] !statements: 0 #line: "@event/EVENT_LEADERBOARD_SCORE.js:1"

 

I have pasted the cloud code below... maybe I have incorrect syntax?

 

Spark.getLeaderboards().getLeaderboard("EVENT_LEADERBOARD_SCORE").deleteEntriesForCustomId("593de235fca583etc.etc.", false, "SCORE");


The short codes are correct. The data type for the event is Number.


Not sure why this is not working?

Wait for support, meanwhile, try to go into your noSQL Leaderboards, open the leaderboard and find the key.

in my case is LeaderboardsGlobal and my key is division.1

so i would run getLeaderboard("LeaderboardsGlobal.division.1") instead of getLeaderboard("LeaderboardsGlobal")

I think your calling the event you just created instead of the leaderboard in getLeaderboard()

The error u'r getting is because it can't find the leaderboard (check the leaderboard name) , it should find it after you set the key (and it must be in leaderboards panel, for some reason i cant delete entries for leaderboards i've deleted from my panel). Also.. last parameter of deleteEntriesForCustomId can't be a string. You can just set it to { } , it will delete the entry for that playerId from the leaderboard. Tell me if you had sucess :)

To resume , in test harness, run the event you created. but that event should look like:

Spark.getLeaderboards().getLeaderboard("YouLeaderboardName.Key").deleteEntriesForCustomId("593de235fca583etc.etc.", false, {});


Hi Nester,


Apologies for the delayed response. The following should work for you if the supplied player has a score on the given leaderboard.

 

Spark.getLeaderboards().getLeaderboard("EVENT_LEADERBOARD_SCORE").deleteAllEntries("593de235fca583etc.etc.", true);

 

Try that and let me know if it works for you.


Regards,

Liam

Hey, thanks for getting back to me. Tried all of the suggestions but none seem to work. Not getting an error now though, just no change to score. Also tried Spark.getPlayer("593de235fca583etc.etc.").hideOnLeaderboards("LEADERBOARD_HIGH_SCORE"); score still on leaderboard. Not sure where going wrong with this?

Hi Nester

If you want to hide a player on all leaderboards use

Spark.getPlayer(playerId).hideOnLeaderboards();

hideOnLeaderboards is used to hide a player on all leaderboards not just one, so it doesn't take a shortcode.


Regards

Katie

Hey there Katie, can't get that to work either. Leaderboard entry still on live server.


Have added Spark.getPlayer("593c26dafca5830etc.").hideOnLeaderboards();


to the leaderboard event. Authenticated in live on debug. Run the event through test harness. This should set the player leaderboard score as invisible...does not though. No errors either.


Do you know why using these commands have no effect on the leaderboard?

Login to post a comment