Sign In Register

How can we help you today?

Start a new topic

Leagues and Divisions, null Response

I've been trying to replicate this tutorial :

https://docs.gamesparks.com/tutorials/social-features/league-and-division-leaderboards.html


I don't know if this matters, I've named my
Global Leaderboard to ldr_Global (since tutorial doesn't give us a name) and
Divison Leaderboard to division.

Thing is, in my TestHarness I can register or authenticate players properly and get an Auth Token.
But when I run the event EndGame in Harness (with score properly set), I get a null response :

{"@class": ".LogEventResponse" }

It should at least go to event_placement and setScriptData("placementScore", score)
But no such data is created.



I don't create segments : league in RegistrationRequest(), like this on Player Connect

 
var playerID = Spark.getPlayer().getPlayerId(); 
var displayName = Spark.getPlayer().getDisplayName(); 
if(Spark.getPlayer().getScriptData("Registered")=== null) 
{ 
Spark.getPlayer().setSegmentValue("league", "placement");

Spark.runtimeCollection("playerList").insert(
{
                                                                                                 // I've made a mirror for my runtime here
"playerID" : playerID,
"displayName" : displayName,
"userName" : Spark.getPlayer().getUserName()                           //lazzy code...,
"segments": Spark.getPlayer().getSegmentValue("league")          //same
   })

   Spark.getPlayer().setScriptData("Registered", true); } 

if(Spark.getPlayer().getScriptData("Registered"=== true))
{ //Do returning user stuff }

 


PS: I can see in my system.players collection that segments is properly set to league : "placement" 


1 Comment

2Hours to realize I can't cal an event inside another event in cloud code. I need to parse score from Unity to event_EndGame with GameSparks.Api and then parse the same variable into event_Placement . Is this right? And if so, why do I need this code in cloud scripting?

 

var request = new SparkRequests.LogEventRequest();

    request.eventKey = "event_Placement";
    request.score = score;

    request.Send();
 

 I just don't understand what's the point :/ I don't trust the client to handle score, so i have to tweek the code and do some game logic in a module (since events doesnt run on events) is this right?


Login to post a comment