Page 1 of 1

Help with simple calender. Please. (Solved)

Posted: Mon Oct 24, 2022 12:01 pm
by scarecorw-76
Following Game Developer Training on youtube and coded a calendar. Changed a few things. So instead of minutes and hours, it goes from morning, afternoon, evening, to night. Everything works well enough. But when it reaches the end of the week, the date doesn't go to Mon the 8th. Instead it goes to Mon the 1st. I cant find a difference between his code and mine. Now, if I keep the click going, the months will change correctly. Its just the date of the day that resets after a week. The minutes and hour variables are in there, but Im not using them.

Code: Select all

label start:
    call variables
    $ GameRunning = True
    while GameRunning:
        $ Output = Months[Month] + ". " + str(Day+1) + ", " + WeekDays[Day] + " " + TimeDays[TimeDay] #+ " " + str(Hours) + ":" + str(Minutes)

        "Click"

        $ TimeDay += 1
        if TimeDay >= 4:
            $ TimeDay = 0
            $ Day += 1
            $ Days += 1
        if Day > 6:
            $ Day = 0
        if Days > MonthDays[Month]:
            $ Month += 1
            $ Days = 0
        if Month > 11:
            $ Month = 0
        #call EventCheck
    return




label variables:

    $ WeekDays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
    $ Months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"]
    $ MonthDays = [30, 28, 30, 30, 30, 29, 30, 30, 29, 30, 29, 30]
    $ TimeDays = ["Morning", "Afternoon", "Evening", "Night"]
    $ Minutes = 0
    $ Hours = 12
    $ Month = 0
    $ Day = 0
    $ Days = 0
    $ TimeDay = 0

    return

Re: Help with simple calender. Please.

Posted: Mon Oct 24, 2022 1:38 pm
by Corynth
You're using Day (of the week) instead of the Days variable that counts days of the month:

Code: Select all

while GameRunning:
        $ Output = Months[Month] + ". " + str(Day+1) + ", " + WeekDays[Day] + " " + TimeDays[TimeDay] #+ " " + str(Hours) + ":" + str(Minutes)
Changing it to str(Days+1) should fix it.

Re: Help with simple calender. Please.

Posted: Mon Oct 24, 2022 4:26 pm
by scarecorw-76
Corynth wrote:
Mon Oct 24, 2022 1:38 pm
You're using Day (of the week) instead of the Days variable that counts days of the month:

Code: Select all

while GameRunning:
        $ Output = Months[Month] + ". " + str(Day+1) + ", " + WeekDays[Day] + " " + TimeDays[TimeDay] #+ " " + str(Hours) + ":" + str(Minutes)
Changing it to str(Days+1) should fix it.
Thank you so much!! I knew I was using one of them wrong somewhere. Thank you again!!! :D