Hello.
I've looked up different day cycle codes already, but didn't really see any codes that were like mine, so here I am.
* WHAT I WANT TO ACHIEVE:
1) Showing which day it is (like day 1, day 67 etc). each new day start after completeing an "action" at 23:00
2) 24 hour clock, and each action that you do increases the time by 1 hour. for example, it's 16:00, and you "do the dishes", and it sets to 17:00.
3) showing what weekday it is (monday-friday).
How do I get all of this working together?
Thanks!
Having problems with making a "Day cycle" code
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Re: Having problems with making a "Day cycle" code
You could try ( hour +1 ) MODULO 24. In case someone runs into this not knowing the modulo operator, 24 MOD 24 == 0; 25 MOD 24 == 1; essentially A MOD B divides A by B and gives you the remainder. The operator symbol may be written as %.
Pseudocode:
Function act(action, currentHour, currentDay):
# do action here
currentHour = (currentHour +1) % 24
if currentHour == 0:
currentDay = currentDay +1
Then display currentHour and currentDay however you like.
Pseudocode:
Function act(action, currentHour, currentDay):
# do action here
currentHour = (currentHour +1) % 24
if currentHour == 0:
currentDay = currentDay +1
Then display currentHour and currentDay however you like.
-
- Veteran
- Posts: 339
- Joined: Wed Sep 24, 2014 5:03 pm
- Organization: Wild Rose Interactive
- Contact:
Re: Having problems with making a "Day cycle" code
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Try searching the Cookbook. Someone else has already made a solution for this.
Try searching the Cookbook. Someone else has already made a solution for this.
Who is online
Users browsing this forum: No registered users