question

Michal Töpfer avatar image
Michal Töpfer asked

PlayStream Action seems to not run

I have a PlayStream Action that should run CloudScript when a Statistic is changed. I don't know where is the problem, but the action is not running. Same CloudScript function can be executed through server API call and runs as expected.

When I change the Stat, it appears in the debugger, but the Action doesn't run.

The Cloud Script function:

handlers.UpdateLevelStat = function (args, context)
{
	var currentStats = server.GetPlayerStatistics({
        PlayFabId: currentPlayerId,
        StatisticNames: [
            "LastLevel1",
            "LastLevel2",
            "LastLevel3"
        ]
    });
  
  	var sum = 0;
  	for (var i = 0; i < currentStats.Statistics.length; i++)
    {
    	if(currentStats.Statistics[i].StatisticName == "LastLevel1" && currentStats.Statistics[i].Value > 0)
          sum += currentStats.Statistics[i].Value;
      	else if(currentStats.Statistics[i].StatisticName == "LastLevel2" && currentStats.Statistics[i].Value > 0)
          sum += currentStats.Statistics[i].Value - 26;
      	else if(currentStats.Statistics[i].StatisticName == "LastLevel3" && currentStats.Statistics[i].Value > 0)
          sum += currentStats.Statistics[i].Value - 51;
    }
  
  	server.UpdatePlayerStatistics({
        PlayFabId: currentPlayerId,
        Statistics: [ 
            {
                StatisticName: "level",
                Value: sum
            }
        ]
    });
}
CloudScriptPlayStream
action.png (59.0 KiB)
debugger.png (30.2 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

What Title ID is this, and do you mind if we create a user account in it and do some testing?

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Michal Töpfer avatar image Michal Töpfer commented ·

It's 22D6. And you can experiment with it as you need, the game is still in development.

0 Likes 0 ·
brendan avatar image brendan Michal Töpfer commented ·

Thanks - actually, as soon as we had a chance to look at this, we were able to confirm that the "OR" logic in the Action setup wasn't working as expected. We've updated the service to account for this, so your Actions should now be working fine.

0 Likes 0 ·
Michal Töpfer avatar image Michal Töpfer brendan commented ·

Thank you, it seems to be fine now.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.