How do I reset global variable when current day changed?

Get help using Construct 2

Post » Sat Jun 17, 2017 5:52 pm

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:
https://drive.google.com/file/d/0B7foHI31iFhQczBxRUE2cjlfWEk/view?usp=sharing

Please anyone, I need any suggestion right now.
Last edited by Darknessed on Sun Jun 18, 2017 5:04 pm, edited 1 time in total.
Great person aren't made by praise and laugh but insult and tear
B
13
S
3
Posts: 31
Reputation: 847

Post » Sat Jun 17, 2017 8:51 pm

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.
AND
SYSTEM start a new day by setting DAY_FINISHED = 0
Thank you to Construct 2 for giving me the ability to create games without programming knowledge.

My games & gaming portal = DolyGames

If anyone wants to cooperate to help each other Win-Win please email me - I am always happy to discover new opportunities.

Cheers,

COSMOS
B
20
S
9
G
1
Posts: 75
Reputation: 2,152

Post » Sun Jun 18, 2017 4:56 pm

@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?
Great person aren't made by praise and laugh but insult and tear
B
13
S
3
Posts: 31
Reputation: 847

Post » Mon Jun 19, 2017 2:31 pm

Does nobody have any solution?
Great person aren't made by praise and laugh but insult and tear
B
13
S
3
Posts: 31
Reputation: 847


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest