Sign In Register

How can we help you today?

Start a new topic
Answered

How to I alter the challenge list in ListChallengeResponse?

I'd like to intercept the list of challenges that ListChallengeResponse sends to the client using Cloud Code, and then add the name of the next player to each challenge before it gets sent back to the client.


I understand how to add Cloud Script to ListChallengeResponse, but I don't know the classes to use to inspect/alter the response values already created.


Best Answer

I understand I can add more data in the separate ScriptData element, but I was hoping I could directly add to a property in the challenge object being returned.


But I did discover that the "Challenged" array already holds the information I was looking for (opponents usernames etc), so that solves my immediate problem anyway.


 Hey Rich,


You could send extra script-data back in the ListChallengeResponse cloud code, just as you would in any other event...


Spark.setScriptData("extra", playerName);


Does this work?


Sean

Answer

I understand I can add more data in the separate ScriptData element, but I was hoping I could directly add to a property in the challenge object being returned.


But I did discover that the "Challenged" array already holds the information I was looking for (opponents usernames etc), so that solves my immediate problem anyway.

Login to post a comment