[I should probably not read such thread at past 2 AM, but well, now I have to answer else it will bug me]
Oh my fucking dead insane gods...
So watching a tutorial [...]
Stop doing it right now, and never ever watch tutorials made by this person.
I don't know what code is yours and what code is his, but everything is wrong, so wrong. Either he code like a pig, explain like one, or it totally not cared to point to a tutorial where he explain the concept he'll use in his tutorial. Whatever the case, it's clearly something to avoid unless you've already a good knowledge regarding both coding and Ren'py. But if you have such knowledge, you shouldn't need his tutorials.
What is this
Calendar
class that define none identifiable variables ?
Day
is for the day of week, while
Days
is for the day of month. One letter difference, no, no and no !
dayOfWeek
and
Days
, or whatever else, but variable names that have a meaning ; and I mean, a really meaning, not something that could eventually be guessed after looking at the code in its whole.
This while
Month
is the month of the year, while
Months
is the name of the month. Following the logic above, the reader expect the second to be the number of months since the game started.
But well, the logic is anyway thrown away by this...
MonthDays
is for the number of days in the month, while
Weekdays
is for (I guess) the name of the day of week. A minimum of constancy, at least inside of the same class ! When the names are so near, they should have the same meaning.
daysByMonth
and
strDays
or
dayAsString
, or whatever else, but not two names so near. And as I implied, there's the problem with
Months
and
Weekdays
doing the same thing, but having radically different names.
Also, what's the interest to have a
Hour
parameter, if it will never be used by the code ?
And then, what the fuck is supposed to do this
if self.Date > 30 and 27 and 29:
?
It totally not mean "if the date is greater than 30, or greater than 27, or greater than 29".
Anyway it's the
if
block right above that is in charge to reset
self.Date
if it become greater than the number of days in this month. There's just no reason to do it again, especially if it's arbitrarily like it is here. Even if the condition was wrote correctly (what is
not if self.Date > 30 or 27 or 29:
), it would mean that all months would have 28 days.
Then, there's this:
Code:
t = 0
while t < 50:
EVENTS.append(Event(0,0,0,"",False))
t += 1
I know that Ren'py language do not (yet ?) have a
for
statement, but here we are in a Python block !
And after come the script.rpy file... That isn't better.
Code:
label start:
call Variables
$ Gamerunning = True
It's so so wrong.
Firstly you do
not create your variables into a label. It totally break the save compatibility and force the players to restart the game with every updates.
Secondly, why this step back with the indentation ? It make Ren'py stop the "start" label right after the
call
and make it being followed by an anonymous code block. It will works, but in the same way that replacing a flat tire by a wooden circle would works ; you can drive your car, but you can also crash at anytime.
And this:
Code:
if BlockToCall <> "":
call expression BlockToCall
return
Why a
return
? You're on the "start" label ! If the code for the events was correct (see below), your thread would be to ask why you're sent to the main menu after the first event.
And finally, your problem...
Anyways I ran into an issue where I have two events but both events play at the same time.
No they don't. Only the first event is played. But like the code of your events is broke, it looks like they both play at the same time.
Code:
label EvOne:
"This is event one's block of code"
$ EVENTS[0].SetInactive()
label EvTwo:
"Boobies are great and i love when they bounce. bounce bounce bounce"
$ EVENTS[0].SetInactive()
Those two labels are called, but at no time you return from them. This mean that once it finish to proceed "EvOne", Ren'py have no instruction telling it to go somewhere else ; in the present case, to return where it was before the label was called. Therefore, it just naturally continue with what's right after, so the label "EvTwo".
Note:
I'm probably more harsh than I want, sorry for this.
I have nothing against you, nor against people who have near to no knowledge when they start to make their first game. It's not you, nor specifically the code you showed, that made me angry, but the fact that there's idiots who are making video tutorials while clearly not being able to do it. Those peoples are a cancer and one of the main reasons why so many Ren'py games are either broke, or abandoned by their author when he end being drown by problems due to the insanity he was taught.
You would use your time in a more useful way by browsing the
dev help, and
dev guide section of this forum. Not only you would find (probably too) many codes handling a calendar and events, but you would also learn the basis regarding Ren'Py.
All this in a secured environment. It happen that sometime we made an error, but then there's always someone to catch it and correct it ; what mean that in the end of the thread, the code you get is working, and generally you also know why. This by opposition to guys who make a tutorial on their own, and teach stupidities or way too outdated things, with no one to correct them.