Hello!

I'm trying to implement a calendar into my game and want to have a little placeholder Label (not in the screenshot but I've got it placed in my Main Farm scene) that displays the date. I'd like it to say "Monday 1, year 1" for the first day of the game but can't find a way to select the next day in my array of day_names.

As you can see in the Output the day is ticking over like how I want it to, but it's seemingly not updating the 'day' in my 'current_day' var.

I'm very new to programming so any help would be massively appreciated, thank you!

  • Try putting another "current_day = day_names[day]" (no "var" needed) after line 18, so current_day updates when day does. However, that will cause problems since there are more days in a month then you have day names in your array.

    Ideally, you should add another variable just to reference the day name, start it at zero, and reset it to zero every seventh time you update day. Then set "current_day = day_names[day_name_ref]" after line 18.

    day += 1
    day_name_ref += 1
    if day_name_ref > 6:
    	day_name_ref = 0
    current_day = day_names[day_name_ref]

Try putting another "current_day = day_names[day]" (no "var" needed) after line 18, so current_day updates when day does. However, that will cause problems since there are more days in a month then you have day names in your array.

Ideally, you should add another variable just to reference the day name, start it at zero, and reset it to zero every seventh time you update day. Then set "current_day = day_names[day_name_ref]" after line 18.

day += 1
day_name_ref += 1
if day_name_ref > 6:
	day_name_ref = 0
current_day = day_names[day_name_ref]