How do I trace the date and time in construct 2 ?

Get help using Construct 2

Post » Sun Jul 31, 2016 6:25 pm

How do I trace the date and time in construct 2 ?
for example I need to hide the ads in the game for 24 hours or 3 days
how to trace this period inside construct 2 , thanks :))
B
16
S
6
G
2
Posts: 31
Reputation: 2,196

Post » Sun Jul 31, 2016 10:27 pm

You can either AJAX to a server or you can use something like @rexrainbow 's Date/Time plugin.

This URL: http://www.stormforgedproductions.com/d ... ne?getTime to our server is a public API right now that returns the UNIX timestamp for the UTC time zone.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,418
Reputation: 4,830

Post » Sun Jul 31, 2016 10:42 pm

Mind if I refer to your server in a tutorial? This seems like a fairly common question, and useful as well.
Mistakes were made.
B
52
S
26
G
108
Posts: 1,606
Reputation: 61,133

Post » Mon Aug 01, 2016 1:41 am

Newgrounds.io api v3 also provides a server timestamp.
B
108
S
26
G
271
Posts: 4,471
Reputation: 151,777

Post » Mon Aug 01, 2016 7:03 pm

oosyrag wrote:Mind if I refer to your server in a tutorial? This seems like a fairly common question, and useful as well.


You can. I'll have to make sure I exclude that API function when we lock the API down behind the authentication wall. You can also use the URL above in rex's post.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,418
Reputation: 4,830

Post » Mon Aug 01, 2016 8:22 pm

Both the date/time and the newgrounds plugins are great, but have a few prerequisites. I will write about it as well, but my goal is to keep things as basic as possible, hopefully working "out of the box" in terms of plugins. I want to go over each available method and the advantages/disadvantages of each. Here's what I have so far.

ExecJS("Date()")
- Simplest solution without plugin
- Works on system time, gameable
- Need to convert to UNIX Time, complicated

EDIT - Found out ExecJS("Date.now()") gives the timestamp without needing to convert.

Rex_Date plugin
- Simplest solution with plugin
- System time
- Needs plugin

Geocache timestamp
- System time
- Requires location services - intrusive to user

Multiplayer Plugin
- Need to set up own server to request server's timestamp
- Advanced/complicated

AJAX request to third party website
- Simplest online/server solution
- Relies on availability of third party website
- May cause unwelcome stress to server
- Possibly requires authentication/plugin

NG.io
- Requires plugin, NG.io account/project
Mistakes were made.
B
52
S
26
G
108
Posts: 1,606
Reputation: 61,133

Post » Thu Aug 04, 2016 2:43 pm

Ah, yea, see they already locked their timeAPI down behind an authentication wall. I'll leave ours open to the public.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,418
Reputation: 4,830


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, ST314, tarek2 and 32 guests