question

yannka avatar image
yannka asked

Call CloudScript on Segment entered event

Hey everyone,

I configured a segment with a CloudScript action to call whenever a player enter this segment.



However, I made a test yesterday (28/11/18). A player entered this segment at 9 PM (server time), but nothing seemed to have happened at all. I don't see any log, I didn't receive any email pointing any kind of problem, and I don't see anything in the Event History, even though I ticked the "Publish results as PlayStream Event". I analyzed all the events from 8PM to 6AM the next day, but no trace of any action.

Maybe I misunderstood something but I expected the CloudScript function "invitToPlay" to be called at approximately 9PM, when the player entered the segment, and to see the logs and results of this function in the Event History tab on the dashboard.

Did I do anything wrong?

Thanks,

Yannick

CloudScript
image.png (80.8 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

So, one thing to understand is the difference between an "active" profile element, and a "passive" one. When the player last logged in, what their regenerating VC balance is - those are things that are checked when required. They're not updated every second, for every player across all of PlayFab, as that would have an almost unlimited cost.

You cannot trigger a Rule based on a passive profile element, as there's no event triggering the Rule - there's no "player_has_not_signed_in" event. Rather, you would use a segment defined with that window of time for something like a Scheduled Task, run against the segment in question. When the Task runs, it automatically re-evaluates the segment, which updates the players and triggers your logic.

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.

yannka avatar image yannka commented ·

Thank you Brendan!
I have created a Scheduled Task that runs every hour on the players in this segment and now it is working like a charm :)

0 Likes 0 ·
brendan avatar image brendan yannka commented ·

Great! Did you also change the segment to only target a 60 minute span of time (so, players who haven't played for more than 1440 minutes, but less than 1500)? That way, you'll only be messaging each player once, and you'll be targeting the time of day they last played.

0 Likes 0 ·
yannka avatar image yannka brendan commented ·

Yes I did, thanks again :)

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.