Sign In Register

How can we help you today?

Start a new topic
Answered

Can i use Spark.sendRequest for Custom LogEvents?

 Hello


According to following link it is not possible to request custom events using Cloud Code. Is this still true?


https://support.gamesparks.net/support/discussions/topics/1000049749


Thanks


Best Answer

Hi Rizwan,


You can send LogEventRequests in cloud code using SparkRequests. The syntax looks like this:


var request = new SparkRequests.LogEventRequest;

request.eventKey = "myEvent";

request.myCustomAttribute1 = myValue;

var result = request.Execute();


or, to send it as a player other than the one currently logged in you would use


var result = request.ExecuteAs(playerId);


Regards,

Vinnie


Answer

Hi Rizwan,


You can send LogEventRequests in cloud code using SparkRequests. The syntax looks like this:


var request = new SparkRequests.LogEventRequest;

request.eventKey = "myEvent";

request.myCustomAttribute1 = myValue;

var result = request.Execute();


or, to send it as a player other than the one currently logged in you would use


var result = request.ExecuteAs(playerId);


Regards,

Vinnie

 Hi, this is not working for me at all or i am not quiet clever as i should be for this.

I have an event called PROGRESS_QUERRY what takes a PATH as input..

{
  "@class": ".LogEventRequest",
  "eventKey": "PROGRESS_QUERRY",
  "PATH": ""
}

i want to let this event run when a player registered a new account and i try to do that from the RegistrationRequest in cloud code.


my code there looks like this

 

var request = new SparkRequests.LogEventRequest();
request.eventKey = "PROGRESS_QUERRY";
request.PATH = "Characters.Slot_1";

var result = request.Execute();

 and it happens nothing.

The script (PROGRESS_QUARRY) works when i execute it for myself but not called / executed from cloud code "RegistrationRequest"

Hi Micahel,


It's not going to run in the RegistrationRequest as the player hasn't been authenticated at that point. Place it in the RegistrationResponse and you should see it run as expected.


Regards,

Liam

Login to post a comment