Dating Sim Engine (DSE) 4.0! 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.
Message
Author
CrimsonHazel
Newbie
Posts: 3
Joined: Fri Dec 11, 2015 12:14 am
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#46 Post by CrimsonHazel » Mon May 23, 2016 10:57 am

E-l337 wrote:
I want to split the planner into weekdays and weekends, so the planner would show up every monday and saturday
How do I do that?
How do I determine when monday and saturday is?
CrimsonHazel wrote:My problem is that the time period would be around 10 months and the storyline is not quite long, I originally want to make it weekly planner but won't it make the game too short? but making it daily would just make it too long....

Do you have any other recommendation?
If not, I'll go with the weekly planner
Thanks in advance
Having spent the last couple of months off and on hacking the day planner and making it do what I want, I think I can help you a little.

If you're talking about wanting to change the options that are available on the day planner (different options on the weekend), you'll need to declare a variable that you can change in your init. The best way is a binary system, where "weekend = 0" or "weekend = 1".

With this variable set in place, you can determine what options are available on the planner during a given planning period. So you'll have events look something like this:

Code: Select all

    dp_period("Morning", "morning_act")
    dp_choice("Attend Class1", "class01", show="weekend == 0")
    dp_choice("Attend Class2", "class02", show="weekend == 1")
This code tells the game that on Monday, 'Attend class 1' is an option, but on the weekends it would be 'Attend class 2' instead.

From the sounds of things, you need something slightly more dynamic, so the other option is to create two day planners. If you intend the player to select options on a daily basis (go to park on monday, attend class on tuesday, etc), that's not too difficult. You'll want to create seven (or as many as necessary) 'periods' to use as options.

Code: Select all

    dp_period("Monday", "mon_act")
You'll want to make one of those for each day of the week. From here, you just need to hack the day planner itself.

Code: Select all


if weekend == 0:

    $ mon_act = None
    $ tue_act = None
    $ wed_act = None
    $ thu_act = None
    $ fri_act = None
    $ narrator("What should I do today?", interact=False)

    # Now, we call the day planner, which may set the act variables
    # to new values. We call it with a list of periods that we want
    # to compute the values for.

    call screen day_planner(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"])

if weekend == 1:

    $ sat_act = None
    $ sun_act = None
    $ narrator("What should I do today?", interact=False)

    # Now, we call the day planner, which may set the act variables
    # to new values. We call it with a list of periods that we want
    # to compute the values for.

    call screen day_planner(["Saturday", "Sunday"])
Just make sure that the weekend variable gets adjusted before you call the acts and day planner.

It really depends on just how you're breaking apart your game.

Hope this helps.
Thanks for your help...
I think I'll go with the second one. where do i declare the weekend variable and when would it change from 0 to 1?
And sorry to bother you, but could you help me with adding a calendar to it?

User avatar
E-l337
Regular
Posts: 46
Joined: Thu Jun 19, 2003 11:58 pm
Location: Internetopia
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#47 Post by E-l337 » Fri May 27, 2016 10:19 pm

Thanks for your help...
I think I'll go with the second one. where do i declare the weekend variable and when would it change from 0 to 1?
And sorry to bother you, but could you help me with adding a calendar to it?
No problem, always happy to help out. :) You'll want to declare the weekend variable in your init line (so that, say, it defaults to 'not a weekend' the first time you launch the game). You'll want to make it one of the very first things you declare, but so long as it is anywhere before the dp_choice blocks it will be fine (since you need to check if it is the weekend in those blocks, and it doesn't like it when the variable doesn't exist yet!).

As for when to change them? I recommend during the evening slot, before the 'day' ends. Just have it check what the value is, and adjust it accordingly. Example:

Code: Select all

if weekend == 0:
      weekend += 1
if weekend == 1:
      weekend -= 1
It's important that the variable be a number, since the day planner blocks don't seem to recognize non-integer values.

I'll PM you about the rest, since I don't want to clutter this thread with non-DSE talk. :)

LinaG
Newbie
Posts: 2
Joined: Fri Jun 24, 2016 5:17 pm
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#48 Post by LinaG » Fri Jun 24, 2016 5:20 pm

E-l337 wrote:
Thanks for your help...
I think I'll go with the second one. where do i declare the weekend variable and when would it change from 0 to 1?
And sorry to bother you, but could you help me with adding a calendar to it?
No problem, always happy to help out. :) You'll want to declare the weekend variable in your init line (so that, say, it defaults to 'not a weekend' the first time you launch the game). You'll want to make it one of the very first things you declare, but so long as it is anywhere before the dp_choice blocks it will be fine (since you need to check if it is the weekend in those blocks, and it doesn't like it when the variable doesn't exist yet!).

As for when to change them? I recommend during the evening slot, before the 'day' ends. Just have it check what the value is, and adjust it accordingly. Example:

Code: Select all

if weekend == 0:
      weekend += 1
if weekend == 1:
      weekend -= 1
It's important that the variable be a number, since the day planner blocks don't seem to recognize non-integer values.

I'll PM you about the rest, since I don't want to clutter this thread with non-DSE talk. :)
I am new to ren py too and I would love if you could pm me with explanation of doing a calendar that would work :) in game. Sounds extremely complicated for some beginner like me XD Thank you so much for the help!

User avatar
SweetChiel
Veteran
Posts: 409
Joined: Wed Jul 02, 2014 8:53 am
Completed: Nusantara: Legend of the Winged Ones
Deviantart: SweetChiel
Skype: Cecilia Susanto
Location: Indonesia
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#49 Post by SweetChiel » Sat Jun 25, 2016 10:41 am

Hi! I'm very happy to find this tutorial and just wondering if we can show a chibi image or two of the heroine (for success and fails) for every activity?
I don't mean to change screen, but to show it right below the daily planner screen.

and if it's not too much trouble, is there a way to customize the style of the daily planner window/button into using hotspots or imagebuttons?

I'm a newbie programmer tho and I don't have a clue how to add/change them myself x_x
Completed Project:
Image

WIP Project:
Image

Facebook fanpage:
https://www.facebook.com/NusantaraSeries/
Support me on my Patreon
Commission Status: Open!

trismegistus
Newbie
Posts: 7
Joined: Mon Jul 04, 2016 4:02 pm
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#50 Post by trismegistus » Wed Jul 06, 2016 3:09 am

This does almost exactly what I want, with one exception: I don't want to plan out the events for the whole day ahead of time; I want the player to choose one, see the results, then choose the next one. I think I could just call display_planner with only one period at a time, but that makes the "Done Planning" button unnecessary. I'd rather just have the button for each action execute that action immediately. Could somebody tell me how I need to modify it to make that happen?

I think I need something like this (from display_planner()):

Code: Select all

                        vbox:                                                   
                            style_group "dp_choice"                             
                            for name, curr_val, enable, should_show in this_period.acts:                                                                        
                                $ show_this = eval(should_show)                 
                                $ enable = eval(enable)                         
                                                                                
# Probably don't need this anymore
#                                $ selected = (selected_choice == curr_val)     
                                                                                
                                if show_this:                                   
                                    if enable:                                  
# And this probably needs to change...
                                        textbutton name action SetField(store, this_period.var, curr_val)
# But to what? I think I basically just need it to do the same thing but then also Return()? Would I just make a new function that does both? (I'm assuming Return() breaks out of the entire menu and doesn't just act like a return statement)
                                    else:                                       
                                        textbutton name                         
                                                                                
                                if show_this and enable and selected:           
                                    $ valid_choice = True                       
                                                                                
                            if not valid_choice:                                
                                $ can_continue = False                          
                                                                                
            if (can_continue):                                                  
# Where is this returning to and how does it know which actions to execute? Does that come from this_period.var?
                textbutton dp_done_title style "dp_done_button" action Return() 
            else:                                                               
                textbutton dp_done_title style "dp_done_button"           
I feel like I'm fairly close to understanding how this should work, but I'm a little fuzzy on some of the UI stuff.

Thanks in advance

User avatar
gas
Veteran
Posts: 354
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#51 Post by gas » Wed Jul 06, 2016 8:21 pm

trismegistus wrote:This does almost exactly what I want, with one exception: I don't want to plan out the events for the whole day ahead of time; I want the player to choose one, see the results, then choose the next one. I think I could just call display_planner with only one period at a time, but that makes the "Done Planning" button unnecessary. I'd rather just have the button for each action execute that action immediately. Could somebody tell me how I need to modify it to make that happen?

I think I need something like this (from display_planner()):

Code: Select all

                        vbox:                                                   
                            style_group "dp_choice"                             
                            for name, curr_val, enable, should_show in this_period.acts:                                                                        
                                $ show_this = eval(should_show)                 
                                $ enable = eval(enable)                         
                                                                                
# Probably don't need this anymore
#                                $ selected = (selected_choice == curr_val)     
                                                                                
                                if show_this:                                   
                                    if enable:                                  
# And this probably needs to change...
                                        textbutton name action SetField(store, this_period.var, curr_val)
# But to what? I think I basically just need it to do the same thing but then also Return()? Would I just make a new function that does both? (I'm assuming Return() breaks out of the entire menu and doesn't just act like a return statement)
                                    else:                                       
                                        textbutton name                         
                                                                                
                                if show_this and enable and selected:           
                                    $ valid_choice = True                       
                                                                                
                            if not valid_choice:                                
                                $ can_continue = False                          
                                                                                
            if (can_continue):                                                  
# Where is this returning to and how does it know which actions to execute? Does that come from this_period.var?
                textbutton dp_done_title style "dp_done_button" action Return() 
            else:                                                               
                textbutton dp_done_title style "dp_done_button"           
I feel like I'm fairly close to understanding how this should work, but I'm a little fuzzy on some of the UI stuff.

Thanks in advance
The last Return close the screen and return None in the _return variable. In fact, it does nothing but closing the called screen.
About your question...
You can really simplify things by just doing a simple screen that show the available options to players, period by period, with a simple conditional.
Those SetField actions are out of your goals. They are conceived the way they are 'cause of registering x values for x periods in a generic system.
Incidentally, high chances you don't need the dating system but the functions for events to call at the right time.
10 ? "RENPY"
20 GOTO 10

RUN

User avatar
minyan
Veteran
Posts: 427
Joined: Tue Feb 10, 2015 3:59 pm
Completed: Trial By Fire, Heartbaked, Ellaria, Plain, This My Soul
Projects: Arena Circus
itch: minyan
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#52 Post by minyan » Wed Jul 06, 2016 8:32 pm

I think I found an error where periods wouldn't skip properly, I think it's because of wrong variable names in the event_dispatcher.rpy file. There is a skip_period and a skip_periods. It wouldn't skip the period when I was testing until I changed these to the same thing. I'm not sure if the problem was something else and this happened to coincidentally fix it or what, but either way I thought it prudent to comment! If it is a coincidence please let me know what the real issue is, I couldn't for the life of me figure out why it wouldn't skip after properly using jump events_skip_period xD
Image ImageImage Image

User avatar
qirien
Veteran
Posts: 431
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
Location: New Mexico, USA
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#53 Post by qirien » Wed Jul 06, 2016 8:43 pm

You're right, trismegistus; that shouldn't be a difficult change to make. First, a few things to understand about how this works.

The display_planner will display choices for all the periods you give it. So it shouldn't be hard to just pass it one of your periods at a time.

As for not requiring the "Done Planning" button...

The SetField action is what stores what choices are selected. The screen is run multiple times whenever the engine refreshes, so it stores what is currently selected so that it can keep showing the previous choices made.

Then, when a choice has been made for each period, can_continue will be True and the "Done Planning" button is enabled. Then when the user clicks that button, the Return() screen action is called, which returns the flow of the program to wherever the display_planner screen was called. But now, we have set variables saying what the user picked, and so the program can run the proper events.

It would be nice if you could run two actions with your button (to set the field and then return), but I don't see anything like that in the Screen Actions Documentation. If you were writing this from scratch, you would probably just do something like Return(next_period_choice="homework") and then use that variable in your code, but that won't work with the DSE.

If you don't need complicated event decisions, you might not want to use the DSE except as a reference for doing your own (simpler) events! If you would still like to use it, I can look a little harder at figuring out a way to do that (not on my main computer right now).
Finished games:
Image
Image
Image
In progress: Our Personal Space 2: Space to Grow

trismegistus
Newbie
Posts: 7
Joined: Mon Jul 04, 2016 4:02 pm
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#54 Post by trismegistus » Thu Jul 07, 2016 2:35 am

qirien wrote:As for not requiring the "Done Planning" button...

The SetField action is what stores what choices are selected. The screen is run multiple times whenever the engine refreshes, so it stores what is currently selected so that it can keep showing the previous choices made.

Then, when a choice has been made for each period, can_continue will be True and the "Done Planning" button is enabled. Then when the user clicks that button, the Return() screen action is called, which returns the flow of the program to wherever the display_planner screen was called. But now, we have set variables saying what the user picked, and so the program can run the proper events.
That makes sense. So the list of events to execute during that period is global and is getting modified every time the player clicks a different button for that period, and the done button doesn't actually do anything but take you out of the day planner screen. I guess just changing it so that the day planner returns whatever function you clicked on would work, but the event dispatcher has a lot of other features that I'd like to take advantage of, so I'd rather use the existing systems than reinvent a bunch of wheels just to get rid of the done button. Oh well.

User avatar
qirien
Veteran
Posts: 431
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
Location: New Mexico, USA
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#55 Post by qirien » Thu Jul 07, 2016 8:38 pm

OK, it turns out this is really easy. I found this thread, which shows how you can make a screen element perform multiple actions. So you just need to change the button to be like this:

Code: Select all

textbutton name action [SetField(store, this_period.var, curr_val), Return()]
Hope this helps! :)
Finished games:
Image
Image
Image
In progress: Our Personal Space 2: Space to Grow

User avatar
qirien
Veteran
Posts: 431
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
Location: New Mexico, USA
Contact:

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

#56 Post by qirien » Thu Jul 07, 2016 8:52 pm

minyan, you are completely correct! Thank you for catching that bug! I fixed it on Github, added a test for it, and made a new release (v3.11). Get it here:
https://github.com/renpy/dse/releases/latest
Finished games:
Image
Image
Image
In progress: Our Personal Space 2: Space to Grow

trismegistus
Newbie
Posts: 7
Joined: Mon Jul 04, 2016 4:02 pm
Contact:

Re: Dating Sim Engine (DSE) 3.1! Day Planner and Event Manag

#57 Post by trismegistus » Thu Jul 07, 2016 11:03 pm

qirien wrote:

Code: Select all

textbutton name action [SetField(store, this_period.var, curr_val), Return()]
(palm to forehead) Of course. I'd been trying to do stuff like write a separate function and then call that. Just using a list makes a lot more sense. Thanks!

User avatar
minyan
Veteran
Posts: 427
Joined: Tue Feb 10, 2015 3:59 pm
Completed: Trial By Fire, Heartbaked, Ellaria, Plain, This My Soul
Projects: Arena Circus
itch: minyan
Contact:

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

#58 Post by minyan » Fri Jul 08, 2016 5:22 am

qirien wrote:minyan, you are completely correct! Thank you for catching that bug! I fixed it on Github, added a test for it, and made a new release (v3.11). Get it here:
https://github.com/renpy/dse/releases/latest
Thank you!!
Image ImageImage Image

perfect-daiya
Newbie
Posts: 1
Joined: Sun Sep 11, 2016 12:37 am
Tumblr: perfect-daiya
Contact:

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

#59 Post by perfect-daiya » Sun Sep 11, 2016 3:09 am

How can I set it so that a player can choose more than one option in the day planner?

User avatar
qirien
Veteran
Posts: 431
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
Location: New Mexico, USA
Contact:

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

#60 Post by qirien » Mon Sep 12, 2016 11:24 am

Right now, you can choose one option per time period. It would not be very simple to add more than one option per time period; it would be easier to add another time period (like Morning 1 and Morning 2) or something like that.
Finished games:
Image
Image
Image
In progress: Our Personal Space 2: Space to Grow

Post Reply

Who is online

Users browsing this forum: Marionette