Sign In Register

How can we help you today?

Start a new topic

Setting match data when matchfoundmessage is sent?

o/


I must really be off because my code doesnt even seem to run, but I dont see how not



I went to the cloud code > user messages, and in MatchFoundMessage


I put  

var deckSize = Spark.getData().deckSize;
var numbers = new List();
for(i=0; i < deckSize; i++)
{numbers[i] = Math.floor(Math.random() * (deckSize - 0 + 1));}

Spark.getLog().info({type: numbers});


  
  // Create a Mongo collection in which to store the data
  var raceData = Spark.runtimeCollection('newcardlist');

  // Store the Event data along with the playerId
  var playerId = Spark.getPlayer().getPlayerId();
 raceData.update(
 {"match":match},
 {$set: {"cardsLeft":cardsLeft, "match":match}},
 true,
 false
 
 );
 Spark.setScriptData(Spark.getData().matchData, 4)

 


image


1 Comment

Hey Adam,

Can you show an example of what the MatchMakingRequest looks like, and what the MatchFoundMessage looks like in the test-harness?

Thanks,
Sean

 

Login to post a comment