How do I reset global variable when current day changed?

0 favourites
  • 4 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Right now I have a problem relating to global variables and current day (date and/or time).

    The problem is simple but I can't find any solutions with the code to make it happen after searching in the scirra forum and another forum.

    I just need to reset certain global variables when the current day changed.

    I provide a link to get a capx from me:

    Please anyone, I need any suggestion right now.

  • Hi,

    You are totally free to set any of your GLOBAL variables to anything at any time.

    For something like a day change I would create a GLOBAL variable DAY_FINISHED = 0

    Then when whatever you decide to be the end of the day you can add a SYSTEM set DAY_FINISHED = 1

    Then when DAY_FINISHED = 1

    SYSTEM action SET whatever GLOBAL variable you want to zero or anything you want.


    SYSTEM start a new day by setting DAY_FINISHED = 0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • DolyGamesCosmos thank you for your response but I think your answer is not what I'm looking for.

    I already understand what you're saying but I'm looking for how to reset certain global variable when the current time (current time here means the real-time or your device real-time where you live at and of course it's gonna be different for each person if they live in different time zone in the world) changed.

    I've set it this way in the capx.

    'on start of layout' event, i've set to check if the 'Current_Date' variable is not equal to Browser.ExecJS("Date()"), then in the action, it will set 'Reward_Earned' variable to 0 (zero).

    in the event 'see_video' button is clicked, it will check again if the 'Reward_Earned' variable is less than 5, then the action will count it and if it reach 5/5 or max, the 'see_video' button will become unclickable.

    this is why I need to set if the day has change, the 'Reward_Earned' variable will set to 0 (zero).

    The bold point above is what I want to be happened by doing the red point above but the red point above is where something went wrong.

    this point is what I don't know at all.

    does something wrong in my code or i'm not doing it the right way?

    Any suggestions?

  • Does nobody have any solution?

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