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

0 favourites
  • 7 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • 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 )

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

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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Newgrounds.io api v3 also provides a server timestamp.

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

  • 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
  • Ah, yea, see they already locked their timeAPI down behind an authentication wall. I'll leave ours open to the public.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)