How do I know how much time the player was offline? ANDROID

Get help using Construct 2

Post » Tue Feb 21, 2017 10:52 pm

I need to know how much time the player went offline. there is any plugin that can help me with that? i need know the time in SECONDS, with the time in seconds i can multiply by a variable (Coins Per Second) and give the Result to COINS variable. There is any tutorial for this plugin too?
B
13
S
1
Posts: 58
Reputation: 701

Post » Tue Feb 21, 2017 11:05 pm

1. Record the time the player's online
2. 24 hours - time online = Time Offline
Image Image Image
B
29
S
11
G
27
Posts: 729
Reputation: 16,995

Post » Tue Feb 21, 2017 11:39 pm

MPPlantOfficial wrote:1. Record the time the player's online
2. 24 hours - time online = Time Offline


How do i do that?
B
13
S
1
Posts: 58
Reputation: 701

Post » Thu Feb 23, 2017 9:35 pm

MPPlantOfficial wrote:1. Record the time the player's online
2. 24 hours - time online = Time Offline


But if the player stay offline more than 1 day
B
13
S
1
Posts: 58
Reputation: 701

Post » Fri Feb 24, 2017 5:59 am

roxinhojp wrote:
MPPlantOfficial wrote:1. Record the time the player's online
2. 24 hours - time online = Time Offline


But if the player stay offline more than 1 day


Good point. I don't know how to do that. I'm guessing you need a day multiplier somewhere else outside of C2. A cloud maybe.
Image Image Image
B
29
S
11
G
27
Posts: 729
Reputation: 16,995

Post » Fri Feb 24, 2017 7:49 am

You probably need to reach system time through additional plugin like this:

http://c2rexplugins.weebly.com/rex_date.html
B
8
S
3
G
1
Posts: 15
Reputation: 705

Post » Fri Feb 24, 2017 7:47 pm

https://rexrainbow.github.io/C2RexDoc/c ... awayl.html
plugin-system-date-and-time_t63492

With that plugin you can write 'current time' to the local storage, on the right moment.
And retrieve it as 'away time' the next time the game starts.

In the topic about the plugin you also find a plugin to translate the stored 'numbers' to readable dates, hours and second.

It always comes down to that principle. Store current time somewhere, retrieve & calculate.
You can do this with out a 3th party plugin, use local storage and some way to get the current time.
Like : https://www.scirra.com/tutorials/940/ho ... -a-project

Now, If you dont trust the user, they can set their clock as they wish, then you need to get the current time from another source than users device.
You can use php to communicate with a time server, but i did not learn that yet myself.
And, you need to store that time outside the users device, another thing that i did not yet do myself.
B
33
S
18
G
28
Posts: 2,470
Reputation: 20,904

Post » Mon Mar 27, 2017 6:58 pm

99Instances2Go wrote:https://rexrainbow.github.io/C2RexDoc/c2rexplugins.weebly.com/rex_time_awayl.html
plugin-system-date-and-time_t63492

With that plugin you can write 'current time' to the local storage, on the right moment.
And retrieve it as 'away time' the next time the game starts.

In the topic about the plugin you also find a plugin to translate the stored 'numbers' to readable dates, hours and second.

It always comes down to that principle. Store current time somewhere, retrieve & calculate.
You can do this with out a 3th party plugin, use local storage and some way to get the current time.
Like : https://www.scirra.com/tutorials/940/ho ... -a-project

Now, If you dont trust the user, they can set their clock as they wish, then you need to get the current time from another source than users device.
You can use php to communicate with a time server, but i did not learn that yet myself.
And, you need to store that time outside the users device, another thing that i did not yet do myself.


do you have any example capx?
B
13
S
1
Posts: 58
Reputation: 701


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests