How do I make my game to read device's time?

Not favoritedFavorited Favorited 0 favourites
  • 5 posts
From the Asset Store
A futuristic device, can be used as radarscreen, optionscreen, infodisplay, research device, ...
  • I'm making a game, where being away is the crucial part of "gameplay", but I don't know what to use.

    The Time Away L plugin works well with tracking time being away pretty well, but when it comes to moving saves to cloud, I doubt if it's any useful for anything in my game. I don't want to use any third party websites to fetch time from, because I don't know how you do that, and obviously can only be accessed online.

    Is there an addon, that reads the device's time directly like Scratch does or do I have to learn Javascript myself to create this particular addon and upload it for free for anyone to download?

    Thanks in advance ;)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, but I'm not switching to C3 as my main engine. At least some Javascript code would be nice, too.

    thx

  • Oh, I didn't notice that this question was in the Construct2 thread.

    I think I used something like that back then. I assigned a variable to an expression where the browser returns the time and immediately converted it to seconds. It looked something like this.

    int(Browser.ExecJS("var d = new Date(); d.getTime();")/1000)
    or
    Browser.ExecJS("var d = new Date(); d.getTime();")
    

    I don't have C2 right now to check this.

    Here's what I put in C3, but it should be the same in C2.

  • That was very helpful! thx <3

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