Sign In Register

How can we help you today?

Start a new topic
Answered

Entering placeholder data

Hi everyone,


I'm intending to take our db live any day now & need to populate a couple of placeholder names with scores across 150 levels within 1 already working, partitioned by level, leader board.  SQL is not a strong point of mine although its on the list!


I have 3 place holder names with scores to populate across each levels leader board.

Rookie - 300

Challenger - 600

Pro - 1100


Question: How do I populate these across each of the boards without needing to manually log each individual score for each of the names?  (I just know it's going to be in the console somewhere!!)


[End goal: Level 1-150 having each of these names/scores]


Thanks for taking the time to contemplate / answer :)

Jez


Best Answer

Hi Jeremy,


Just to confirm, you have 3 GameSparks players created and you want to post placeholder scores to 150 leaderboards ? As you know the playerIDs of these 3 test players you can use a SparkRequest in a test Cloud Code script to to this.

   

//change this to the event that you are using to post scores yourself
var request = new SparkRequests.LogEventRequest();
request.eventKey = "yourScoreEvent";
request.score = scoreValue;
var response = request.SendAs(playerID)

//note
//SendAs() will send your request as the given player
//ExecuteAs() will send this as the given player AND execute any Cloud Code attached to the event.

    

The important thing to note here is the final line, here you can specify the playerId of the player you want to send the request as. So you just need to write a script that will loop through the playerIds of you test players and post these scores on behalf of the players to the required. Does that make sense ? If you can let us know your gameId we can look at you configuration and give you a few pointers.


Thanks,

Liam

1 Comment

Answer

Hi Jeremy,


Just to confirm, you have 3 GameSparks players created and you want to post placeholder scores to 150 leaderboards ? As you know the playerIDs of these 3 test players you can use a SparkRequest in a test Cloud Code script to to this.

   

//change this to the event that you are using to post scores yourself
var request = new SparkRequests.LogEventRequest();
request.eventKey = "yourScoreEvent";
request.score = scoreValue;
var response = request.SendAs(playerID)

//note
//SendAs() will send your request as the given player
//ExecuteAs() will send this as the given player AND execute any Cloud Code attached to the event.

    

The important thing to note here is the final line, here you can specify the playerId of the player you want to send the request as. So you just need to write a script that will loop through the playerIds of you test players and post these scores on behalf of the players to the required. Does that make sense ? If you can let us know your gameId we can look at you configuration and give you a few pointers.


Thanks,

Liam

Login to post a comment