Page 1 of 1

I have no idea...

Posted: Sat Nov 09, 2019 7:09 am
by Aniknk
...what I've done wrong here:

Code: Select all

    label DayProceed:
        jump DayProceed2
        $ GameRunning = True
        while GameRunning:
            "Skip hour"
            $ Calendar.AddTime(1)

        return

    label DayProceed2:
        $ Calendar = Calendar(0, 0, 0, 0, ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], 0, ["Monday", "Tuesday", "Wensday", "Thursday", "Friday", "Saturday", "Sunday"], [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])

        return
Or here:

Code: Select all

    init python:
        class Calendar(object):
            def __init__(self, Hours, Hour, Days, Day, Months, Month, WeekDays, MonthDays):
                self.Hours = Hours
                self.Hour = Hour
                self.Days = Days
                self.Day = Day
                self.Months = Months
                self.Month = Month
                self.WeekDays = WeekDays
                self.MonthDays = MonthDays

            @property
            def Output(self):
                return self.WeekDays[self.Day] + " " + self.Months[self.Month] + " " + str(self.Days+1) + " " + str(self.Hours).zfill(2) + ":00"

            def AddTime(self, Hours):
                self.Hours += Hours
                if self.Hours > 23:
                    self.Hours -= 24
                    self.Day += 1
                    self.Days += 1
                if self.Day > 6:
                    self.Day = 0
                if self.Days > self.MonthDays [self.Month]:
                    self.Month += 1
                    self.Day = 0
                if self.Months > 11:
                    self.Month = 0
I swear it was working an hour ago.

Re: I have no idea...

Posted: Sat Nov 09, 2019 8:01 am
by deltadidirac
Aniknk wrote: Sat Nov 09, 2019 7:09 am ...what I've done wrong here:

Code: Select all

    label DayProceed:
        jump DayProceed2
        $ GameRunning = True
        while GameRunning:
            "Skip hour"
            $ Calendar.AddTime(1)

        return

    label DayProceed2:
        $ Calendar = Calendar(0, 0, 0, 0, ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], 0, ["Monday", "Tuesday", "Wensday", "Thursday", "Friday", "Saturday", "Sunday"], [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])

        return
Or here:

Code: Select all

    init python:
        class Calendar(object):
            def __init__(self, Hours, Hour, Days, Day, Months, Month, WeekDays, MonthDays):
                self.Hours = Hours
                self.Hour = Hour
                self.Days = Days
                self.Day = Day
                self.Months = Months
                self.Month = Month
                self.WeekDays = WeekDays
                self.MonthDays = MonthDays

            @property
            def Output(self):
                return self.WeekDays[self.Day] + " " + self.Months[self.Month] + " " + str(self.Days+1) + " " + str(self.Hours).zfill(2) + ":00"

            def AddTime(self, Hours):
                self.Hours += Hours
                if self.Hours > 23:
                    self.Hours -= 24
                    self.Day += 1
                    self.Days += 1
                if self.Day > 6:
                    self.Day = 0
                if self.Days > self.MonthDays [self.Month]:
                    self.Month += 1
                    self.Day = 0
                if self.Months > 11:
                    self.Month = 0
I swear it was working an hour ago.
Hi,
I'm not good, and I can't give you a suggest for the second part (the init definition), but I think that for sure something is wrong with the first labels part...

Code: Select all

    label DayProceed:
        jump DayProceed2                                   ###############   here I think it's the wrong place to write jump (this would be the final command)
        $ GameRunning = True
        while GameRunning:
            "Skip hour"
            $ Calendar.AddTime(1)

        return                                                   ##############     here or you jump, or you return.....

    label DayProceed2:
        $ Calendar = Calendar(0, 0, 0, 0, ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], 0, ["Monday", "Tuesday", "Wensday", "Thursday", "Friday", "Saturday", "Sunday"], [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])

        return
I hope this could help you

Re: I have no idea...

Posted: Sat Nov 09, 2019 8:39 am
by Aniknk
Thanks, but it's not this. I have to think about easier way to add time skip. Any sugestions?

Re: I have no idea...

Posted: Sat Nov 09, 2019 8:57 am
by Aniknk
I've repaired it. It should be call not jump. And on top after all.

Re: I have no idea...

Posted: Sat Nov 09, 2019 9:07 am
by deltadidirac
Aniknk wrote: Sat Nov 09, 2019 8:39 am Thanks, but it's not this. I have to think about easier way to add time skip. Any sugestions?
Do you mean something like a cheat?
pressing you a button the time go forward and you jump 1 more hour or 1 more day?

Re: I have no idea...

Posted: Sat Nov 09, 2019 9:16 am
by Aniknk
I already resolve this problem, but something new happend:
After I leaving time skip, and go there back, and press button, it kick me out of game. Really if there is a easier way to add visable Calendar to game, please tell me.

Re: I have no idea...

Posted: Sat Nov 09, 2019 9:35 am
by deltadidirac
Aniknk wrote: Sat Nov 09, 2019 9:16 am I already resolve this problem, but something new happend:
After I leaving time skip, and go there back, and press button, it kick me out of game. Really if there is a easier way to add visable Calendar to game, please tell me.
To help you with YOUR code already wrote, I would read it all before , and I'm not the better person here that could be do it because I'm not a programmer; but if the game kick out you (I think you mean that you come back to the main_menu), probably there is some where in one label a "return" command that it could not be there; or you did some mistake with some jump command

The problem could be find also in some screen in witch you didn't wrote correctly all the Hide and Show an Jump sequences...

Generally are things like that often give you problems (I'm talking about myself), when happen, I sotp some minutes, I drink a coffe, and after I re-read all the code step by step doing the scheme on a peper with a pencil, to be sure to have done all correctly.
You could also copy a system already done by another person, perhaps here you can find something:
viewtopic.php?f=51&t=34131

Re: I have no idea...

Posted: Sat Nov 09, 2019 10:17 am
by Aniknk
Hey, thank you! It's very usefull!