Dating Sim Engine (DSE) 4.1! Day Planner and Event Manager

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
Meinos Kaen
Regular
Posts: 107
Joined: Wed Jan 04, 2012 1:01 pm
Completed: JPDE - Sonata of Fire
Projects: JPDE, Ars Oratoria, ONHA
Skype: therealmeinoskaen
Location: Somewhere in Italy...
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#61 Post by Meinos Kaen »

Good morning from Italy :D

I was wondering: is it possible to use the event planner without the daily dispatcher?

What I mean is, I'd like in my game to use a map instead of the day planner as in: the player has access to certain locations and depending on the day of the week, time of the day and his stats certain events can happen.

So, more than not having the daily dispatcher it'd be showing it three times a day -morning, afternoon, night- and instead of showing the planner I'd show the map.

Edit: Okay, I think I could do this by making, at the start of every period, call a different screen depending on the value of a variable called Time. 1 for Morning Screen, 2 for Afternoon Screen, 3 for Evening Screen. And I could make it so that each location would make the player jump to an 'act' where the check for stats, time and day would happen. Did I forget anything?

I think the only thing missing is: how do I make a rotating list for a WeekDays variable? O_O

User avatar
qirien
Miko-Class Veteran
Posts: 541
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#62 Post by qirien »

Yes, I think what you're proposing would work - basically, you have 3 different day planners, with a map interface instead of buttons.

What do you mean by a rotating list?
Finished games:
Image
Image
Image

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#63 Post by philat »

Modulo.

Code: Select all

if WeekDays % 7 == 1:
    # Sunday
elif WeekDays % 7 == 2:
    # Monday 
...
and so forth.

User avatar
Meinos Kaen
Regular
Posts: 107
Joined: Wed Jan 04, 2012 1:01 pm
Completed: JPDE - Sonata of Fire
Projects: JPDE, Ars Oratoria, ONHA
Skype: therealmeinoskaen
Location: Somewhere in Italy...
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#64 Post by Meinos Kaen »

philat wrote:Modulo.

Code: Select all

if WeekDays % 7 == 1:
    # Sunday
elif WeekDays % 7 == 2:
    # Monday 
...
and so forth.
Basically this :3 So, from a still learning guy, what does the % 7 stand for?

User avatar
qirien
Miko-Class Veteran
Posts: 541
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#65 Post by qirien »

It means "the remainder after dividing by 7". So:
1 % 7 = 1
2 % 7 = 2
3 % 7 = 3
...
7 % 7 = 0
8 % 7 = 1
...
26 % 7 = 5
Finished games:
Image
Image
Image

User avatar
Meinos Kaen
Regular
Posts: 107
Joined: Wed Jan 04, 2012 1:01 pm
Completed: JPDE - Sonata of Fire
Projects: JPDE, Ars Oratoria, ONHA
Skype: therealmeinoskaen
Location: Somewhere in Italy...
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#66 Post by Meinos Kaen »

qirien wrote:It means "the remainder after dividing by 7". So:
1 % 7 = 1
2 % 7 = 2
3 % 7 = 3
...
7 % 7 = 0
8 % 7 = 1
...
26 % 7 = 5
So basically that'd... Take away 7 from the total number of days passed from the start of the game as many time as possible and then use the remainder ones to calculate what day it is. Got it.

So a possible code would be something like this?

Code: Select all

if WeekDays % 7 == 0:
     DayOfTheWeek = Sunday

if WeekDays % 7 == 1:
     DayOfTheWeek = Monday
And so on?

Edit: No, wait, elif is needed. So...

Code: Select all

if WeekDays % 7 == 0:
     DayOfTheWeek = Sunday
elif WeekDays % 7 == 1:
     DayOfTheWeek = Monday
Would I need to set up the DayOfTheWeek variable at the start of the script with an init or initpython?

User avatar
qirien
Miko-Class Veteran
Posts: 541
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#67 Post by qirien »

Yeah, you got it! The elif is slightly more efficient but the other one would work, too.

It's generally a good idea to initialize all your variables in one place; not only does that help you keep track of what variables you're using, but it also makes sure that you don't get any errors from uninitialized variables. You can do that in a python init section, or use Ren'Py's "define" statement.
Finished games:
Image
Image
Image

DMKalwin
Newbie
Posts: 2
Joined: Sun Nov 20, 2016 9:34 pm
Location: Ohio, USA
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#68 Post by DMKalwin »

I have a question about customizing the day planner. I have the labels with the days of the week across the top of the planner with the buttons going down from there. I have been trying to make the days of the week go up to down with the buttons for locations go left to right, but can't seem to figure it out. Any ideas?

User avatar
qirien
Miko-Class Veteran
Posts: 541
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#69 Post by qirien »

This isn't too hard to do. Basically you want to open up day_planner.rpy and swap some of the hboxes and vboxes in the display_planner screen.

An hbox is a horizontal box, which means it will lay the things you give it out next to each other. A vbox is a vertical box, meaning it will lay things out below each other.

When you're done, your code for the display_planner screen will look something like this:

Code: Select all

screen display_planner(periods):            
    frame:
        style_group "dp"        
        vbox:
            text "Day Planner" yalign 0.0 xalign 0.5
            vbox:
                $ can_continue = True
                for p in periods:
                    hbox:
                        xalign 1.0
                        label p
                        if p not in __periods:
                            $ raise Exception("Period %r was never defined." % p)
                        $ this_period = __periods[p]
                        $ selected_choice = getattr(store, this_period.var)

                        $ valid_choice = False
                        hbox:
                            style_group "dp_choice"
                            for name, curr_val, enable, should_show in this_period.acts:
                                $ show_this = eval(should_show)
                                $ enable = eval(enable)

                                $ selected = (selected_choice == curr_val)
                        
                                if show_this:
                                    if enable:
                                        textbutton name action SetField(store, this_period.var, curr_val)
                                    else:
                                        textbutton name
            
                                if show_this and enable and selected:
                                    $ valid_choice = True

                            if not valid_choice:
                                $ can_continue = False
                                    
            if (can_continue):
                textbutton dp_done_title style "dp_done_button" action Return()
            else:
                textbutton dp_done_title style "dp_done_button"

Finished games:
Image
Image
Image

DMKalwin
Newbie
Posts: 2
Joined: Sun Nov 20, 2016 9:34 pm
Location: Ohio, USA
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#70 Post by DMKalwin »

Thank you! I was looking at vbox and hbox but didn't think of that code section needed to change, thanks again!

FangOfDrknss
Newbie
Posts: 2
Joined: Sat Dec 10, 2016 4:49 pm
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#71 Post by FangOfDrknss »

This engine is the kind of 'feel' I've been looking for, ever since I've given Ren'py an actual try, awhile ago. The Day planner's layout works great as is, but I was wondering if one of the choices can be swapped for 'Visit' or 'Date', which clicking on it would take it to a planner with that label, and in place of the choices are names.

User avatar
qirien
Miko-Class Veteran
Posts: 541
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Discord: qirien
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#72 Post by qirien »

Yes, you could certainly do that. The easiest way would be to have "Visit X" "Visit Y" and "Visit Z" be options for that time period. You can do that by modifying the main.rpy and changing/adding the dp_choice lines to be whatever you want. You can even add flags like "show=met_Y" to only show an option after they've met a certain person.

If you wanted to make a separate screen pop up when they click "Visit" or "Date", you could do that but it would take a lot more modification. The file to start at for that is day_planner.rpy.
Finished games:
Image
Image
Image

FangOfDrknss
Newbie
Posts: 2
Joined: Sat Dec 10, 2016 4:49 pm
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#73 Post by FangOfDrknss »

Both methods are worth looking into, but the first is definitely more of what I want. Especially with having the option appear with flags. Thanks.

User avatar
aliishaq
Newbie
Posts: 6
Joined: Sun Jan 08, 2017 8:03 pm
Completed: Gulungan Pengembara & Puteri
Projects: Sim VN Setia
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#74 Post by aliishaq »

wow ... thanks qirien. its awesome sim engine. i'll try it.

User avatar
awurawuran
Newbie
Posts: 3
Joined: Wed Jan 11, 2017 4:23 am
Contact:

Re: Dating Sim Engine (DSE) 3.11! Day Planner and Event Mana

#75 Post by awurawuran »

Hi thanks for this very nice DSE.

Post Reply

Who is online

Users browsing this forum: No registered users