[Plugin] System date and time

From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Please advise which plugin to use for the countdown timer? If possible with CAPX.

  • Max38 It has more than a few uses. Would be best to provide a capx and what you're trying to do. I ended up writing my own solution as it was a security issue that I could more granularly address

  • for example: the user has received a bonus and began the countdown to the next bonus. And as there is a problem with the transition to the next level. Once perehodish to the next level and vice versa, then you notice that the countdown has begun anew.

  • Can you share the capx of what you're referring to? Would be easier to address the actual problem.

  • luvleggs. At start, the countdown timer starts, and when you switch to another page, the timer stops. How do I get the timer continues counting regardless of the transition between pages. CAPX:https://onedrive.live.com/?cid=ED129B0497B548A9&id=ED129B0497B548A9%21105&parId=root&o=OneUp

  • Max38 It says the capx is not there. What I normally do is set a global number variable of Timer

    1. Global number > Timer = 0

    2. Set a Group called Timer

    Then inside that an Event

    System > Every 1 seconds

    With Action of System > Add 1 to Timer

    3. Create or add to Event of On start of layout

    system > Set group "Timer" enabled

    This will work through all your scenes. You can set an action to have it change scenes after "x" number of seconds or if for example they have a score of 15 you move to the next section. To stop the timer for example a race game just set Timer group to deactivated. You can also start it out with the group deactivated until you hit start and then set its action on click to activated. on additional scenes add an event of System > Every 1 seconds with action of System > Add 1 to timer at the top just under global variables

    Hope this helps

  • luvleggs I checked several times. Exist CAPX.

    Sorry, maybe I did not correctly formulate the question. This timer does not work with animation.

    Everything you advised, I did. This works when you are on the same stage. Once you move to another scene, the animation stops. When you return back, the animation continues.

  • Max38 Sorry, I've tried multiple times and it says this item might not exist or has been removed. I believe you are still missing one of the steps but can't tell without the actual capx you can pm me if you want and I can give you access to upload to a directory I share

  • Hi guys, am I correct in my findings?

    Date.Hours(TimeStamp) etc. all return an automatically localized return value?

    My Question in a nutshell is how to localize a timestamp from a given value and not from the local machine

    Here's the scenario:

    I have a server feeding me a UTCTimeStamp and the server's regional settings separately.

    I have to compare that to the terminals current time which i get from Date.UnixTimestamp (also not localized; obviously correct)

    so I localize both and compare... (this is to be able to compare regardless of the local machines regional settings)

    Here's the issue I have:

    I have a localized timestamp that i want to extract Hours from

    put it into Date.Hours and get out an hour that is now (localized + more localized)

    my workaround is that i have to unlocalize the stamps again just to feed it through Date.Hours

    If it is the case i have the following suggestion:

    Date.Hours(Timestamp) returns hours of that timestamp only

    Add:

    Date.Localize(Timestamp,"regional") if regional is not given then it should use that machine's regional settings

    example:

    ServerTime: UTC +2 hours

    ClientTime: UTC -2 hours

    Localized from Server

    var Timestamp = Date.UnixTimestamp();
    var Region = "+0200";
    var LocalizedTS = Date.Localize(Timestamp,Region);
    
    console.log(Date.Hours(LocalizedTS));
    //output: 14
    [/code:y6eavdnu]
    
    [b]Localized from Client[/b]
    [code:y6eavdnu]
    var Timestamp = Date.UnixTimestamp();
    var LocalizedTS = Date.Localize(Timestamp);
    
    console.log(Date.Hours(LocalizedTS));
    //output: 10
    [/code:y6eavdnu]
  • Been trying to get TimeAwayL to work so I can make an idling game for android, but I can't seem to crack it. The example capx no longer exists, so I couldn't look at an example.

    I have it working where if I lock my phone or leave the browser, the timer starts and then pauses when I resume it via the browser object, but I want it so that even if the user closes the app, the timer still counts. It would also be neat if I could push a notification to the user even when the app is off.

    If you can help me, thanks! Here's what I've tried so far:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I was able to download the plugin and the example file a few minutes ago from the links in the first post of the thread. and it works just fine.

    the example doesn't even have the Local Storage plugin in it, so that is not how you use it. The TimeAwayL plugin directly accesses local storage for you. you also don't want to pause the timer while your program is running and then try to start it manually when the program suspends or is closed down. Just use "Get or Start timer" at the start of the layout and just leave it run forever.

    the "timer" is just a time stamp. Nothing actually happens until you check the elapsed time (it just calculates the difference between the initial time stamp and now).

    Construct2 can't do push notifications, but I think there are plugins and 3rd party services that can do that.

  • I was able to download the plugin and the example file a few minutes ago from the links in the first post of the thread. and it works just fine.

    the example doesn't even have the Local Storage plugin in it, so that is not how you use it. The TimeAwayL plugin directly accesses local storage for you. you also don't want to pause the timer while your program is running and then try to start it manually when the program suspends or is closed down. Just use "Get or Start timer" at the start of the layout and just leave it run forever.

    the "timer" is just a time stamp. Nothing actually happens until you check the elapsed time (it just calculates the difference between the initial time stamp and now).

    Construct2 can't do push notifications, but I think there are plugins and 3rd party services that can do that.

    I found a workaround, using the unix timestamp to subtract saved time from current time to get elapsed seconds since app closed. I also downloaded a plugin called PushJS that lets me push notifications, but I want to be able to schedule them for when my timers are finished.

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