Sign In Register

How can we help you today?

Start a new topic

Schedule don't trigger required message

Hi.

In our game we want to our bot ( ai player ) would take his action after a few moment player  take his action.So when a player do his turn ,we log an event on cloud code to schedule bot player do hist turn after a few seconds using cloud code snippet below:


  

//Schedule AI Action
var takeActionDelay = Math.floor(Math.random()*120)+20;
var theScheduler = Spark.getScheduler();
theScheduler.inSeconds("AI_TakeAction", takeActionDelay, {"challengeId" : "challengeID,  "aiPlayerId" : "aiPlayerID"});

 

Where "AI_TakeAction" is the shortCode of our module that contains some code to make AI action. Everything is good except that after triggering "AI_TakeAction" , The associated messages like ChallengeTurnTaken doesn't trigger.


Do we need something more to triggering messages?


Thanks for your answers


1 person has this question
1 Comment

Another thing I want to add to clarify what we are doing is that We call LogChallengeEventRequest for our challenge event width Short Code 'Take_Action',Inside of challenge event we have cloud code that schedule  a module and inside of that module  'Take_Action' event again called but this time with a different playerID (AI Player ID) like below:


 

var request = new SparkRequests.LogChallengeEventRequest(); request.challengeInstanceId = challengeId; request.eventKey = "Take_Action"; var response = request.SendAs(aiPlayerId);

 I test a lot and noticed that our scheduling module work but it seems that second LogChallengeEvent is not called or throw an exception that we can't trace . So is this supported? I mean Calling a LogChallengeEvent that trigger a module that trigger same LogChallengeEvent again.I know it could create an infinite loop but I have write some code to prevent this . 

Login to post a comment