Thank you Kivik and Xavimat. I implemented your suggestions and the code is working correctly. For anyone curious for the solution:
Code: Select all
def which_day(day=0):
global days
day_num = (days % 7)
day_name = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', ' Fri', 'Sat')
day = day_name[day_num]
return day
and then on the screen it calls the function.
Code: Select all
screen ui_text:
zorder 101
text which_day() size 36 color "#ffffff" font "IndieFlower-Regular.ttf" xpos 31 ypos 27
text hour() size 32 color "#ffffff" font "IndieFlower-Regular.ttf" xpos 110 ypos 32
I am now having issues with the logic for keeping track of days. I have a 24 hour time system in place. Whenever it's passed midnight, I want the days to +1. I have two buttons that allows the players to pass time, either at 30m increment or 12 hours. My first draft of the code added a day whenever the clock struck midnight.
Code: Select all
if float(minn%1440) == 0:
days = days + 1
return days
However, if the player uses the +12 hours button, they can skip midnight all together and the day will not advance. Any ideas of how I can implement days to advance after a full 24h cycle?
Thank you again!