Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: firesidegames on April 26, 2017, 01:27:17 AM

Title: How to setup an event based on system time
Post by: firesidegames on April 26, 2017, 01:27:17 AM
Hi there,
I'm trying to create a feature where I can offer a free reward every 8h similar to what many other major mobile games have.

The only action I could find that somewhat helps in creating this feature is the 'get system date time' but this saves the value out as a string.. I need something where I can save the time value and check against it when the app is re-opened to see how much time has lapsed since the reward was received.

Can anyone please advice me on the best way to go about this with playmaker.

Otherwise it's looking like i'll have to do some complicated weird conversion stuff to make it work with this action. 

Title: Re: How to setup an event based on system time
Post by: djaydino on April 26, 2017, 11:09:33 PM
Hi,
There is an action called 'Get timespan between dates' on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)
Maybe that one can help you :)
Title: Re: How to setup an event based on system time
Post by: firesidegames on May 04, 2017, 06:38:20 AM
thanks for the suggestion :)

I looked into this action. It seems to have an odd setup..

It reads the start date ok, but I don't have a to have it read a date that is at a calculated future time. For example, when I get the initial start date, I don't have a way to get and store a date exactly 8h in the future of that initial date.

Also the action is saving the result into a float, which gives a bit of a weird number. I'm not actually sure what it's trying to show as a result of the difference between the dates. For example, I manually have it get the difference between two dates/times that were 1m apart, the resulting float was 0.01666667..
See attached screenshot.

A supporting action for the Daily Rewards asset would be amazing, but i suppose that would be a request to the asset developer. https://www.assetstore.unity3d.com/en/#!/content/28666
Title: Re: How to setup an event based on system time
Post by: djaydino on May 04, 2017, 10:45:44 AM
Hi,
You have 'Get Span Info' set on "hours" and 1m = 0.01666667 hours
Try setting it to "total minutes" then you will get 1 as result.

If you add :ss to the format you can get secconds,
Then you can use total secconds or seccond and the result wil be 60 :)
Title: Re: How to setup an event based on system time
Post by: djaydino on May 04, 2017, 11:57:00 AM
Hi,
I can make actions for it, but i do not own that asset :(