question

MoonHeonYoung avatar image
MoonHeonYoung asked

progressive reward question!

Hi!

https://github.com/PlayFab/PlayFab-Samples/tree/master/Recipes/ProgressiveRewards

I am currently studying and writing the above tutorial.

But the above tutorial doesn't work as I want.

1. I want to implement the attendance check function.

I want new attendance to work every day at 12:01 minutes.

(That is, for example, if I checked in at 5 PM today, I want the check-in function to work again at 00:01 the next day. not next day 5pm)

However, the tutorial works at next day same time right after the check-in occurs.

I need proper advice to modify this JavaScript cloudscript.

2. Is there a function to test attendance check function through admin api?

(Every hour at 11:59, for testing)

10 |1200

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

Seth Du avatar image
Seth Du answered

According to your description, the difference between your scenario and sample script is the progressive check condition in Cloud Script function.

Basically the storage solution of timestamp is the same, but when it comes to the cloud script verification part, you need to retrieve the last check-in timestamp from this player and generate the current server time, then compare the current date with last check-in timestamp.

In a word, this verification is not an API or any PlayFab built-in feature, and it is defined by the logic of codes you write.

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.

MoonHeonYoung avatar image MoonHeonYoung commented ·

Thank you for answer.

my check code:

if (new Date (Date.now ()). getDate () == new Date (parseInt (tracker [TRACKER_NEXT_GRANT])). getDate ())

I think this checking will work well, There is no way to test it.

Is there no api to test like the screenshot above?

2. And my studio is set to KST. That is, UTC + 9:00 In this case,

when calling new date () in the cloud script, is the result value for the kst value displayed?

In other words, I want to release it in other countries.

If the script works based on the kst value, it will check in at 9:00 AM instead of check in at 12:00 every day.

Any advice in this case?

0 Likes 0 ·
MoonHeonYoung avatar image MoonHeonYoung commented ·

Please help me

Progressive reward does not work.

I think there is a problem

This is a progressive reward demo script. This is the script on GitHub.

The blue circle line does not seem to recognize the item received from the cloud code.

Please check it again.

0 Likes 0 ·
bug1.png (109.2 KiB)
bug2.png (46.0 KiB)
MoonHeonYoung avatar image MoonHeonYoung commented ·

3rd screenshot

0 Likes 0 ·
bug3.png (88.1 KiB)
MoonHeonYoung avatar image
MoonHeonYoung answered

I think the code in Cloud Code and ProgressiveRewards.cs are both weird.

In the cloud code.

ResetTracker ()

UpdateTrackerData ()

In the above two functions,

they are stored in readonlydata using JSON.stringify function respectively (twice) Is this the correct code?

in other world, player's readonlydata includes reverse slash as following

"{\"LoginStreak\":1,\"NextEligibleGrant\":1587730347297}"

Looking at the demo's ProgressiveRewards.cs code.

In the tutorial,

code will give me a virtual currency (gm),

but If you look at the code, code try to accept the iteminstance type.

is virtual currency iteminstance type??

That's why it seems to cause errors ...

plz After you following the ProgressiveRewards tutorial,

I'd appreciate it if you let me know if there are any errors.

I have been suffering all day for two days on this issue.

2 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.

MoonHeonYoung avatar image MoonHeonYoung commented ·

And in my second answer, I would be grateful if you respond to my UTC related issues and API test related issues.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ commented ·
  • In terms of Time zone, you may need to convert the timestamp according to your requirement since getTime() in JavaScript always uses UTC.
  • The back slash won't have any influence since you still can use JSON.phase to convert the string to an Object in Cloud Script.
  • You receive the VC because the reward is a bundle, where gm (VC) is contained.
  • In terms of the blue line, have you tried to output "result.FunctionResult.ToString()"
0 Likes 0 ·
MoonHeonYoung avatar image
MoonHeonYoung answered

Thank you.

If so, are you saying that additional coding is required for countries with different utc values?

if(new Date(Date.now()).getDate() == new Date(parseInt(tracker[TRACKER_NEXT_GRANT])).getDate())

This comparison works well in my country, I can't test it in other countries, there is a problem.

1 comment
10 |1200

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

Seth Du avatar image Seth Du ♦ commented ·

Because the original sample verifies the check-in time using the span of time, and it doesn't count date. Hence, it will be fine to use UTC all the time.

In your scenario, you may store the time zone of each player somewhere (for example, Player Read-Only Data) and retrieve the time zone of this player before the comparison happens.

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.