Sign In Register

How can we help you today?

Start a new topic

SetScriptData within Event called by ChallengeIssuedMessage

Hello,

when i submit a challenge request and specify UsersToChallenge, the user who receives the Challenge automatically accept it.


In the ChallengeIssuedMessage i am also trying to call an event (STATUS_UPDATE) and pass some data to it, but so far this does not work.


Can't see what i am doing wrong, any help would be appreciated!


Here is the code:

CHALLENGE ISSUED MESSAGE


- Automatically accept challenge

//Easy access to data

var chalData = Spark.getData();

//New request to join the challenge automatically

var request = new SparkRequests.AcceptChallengeRequest();


//Retrieve the challenge ID to use it in the AcceptChallenge request

request.challengeInstanceId = chalData.challenge.challengeId;

request.message = "Joining";

request.Send();


- Change status to "busy" and value to 0 once challenge is accepted:


var request = new SparkRequests.LogEventRequest();

request.eventKey = "UPDATE_STATUS";

request.SetScriptData(status,"busy");

request.SetScriptData(value,0);

var response = request.Send();

var scriptData = response.scriptData; 


This is the UPDATE_STATUS event code instead:


Spark.getPlayer().setScriptData("status",Spark.getData().status);


The event work if called from TestHarness> LogEvent.

Login to post a comment