Page 4 of 13

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

Posted: Mon May 23, 2016 10:57 am
by CrimsonHazel
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?

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

Posted: Fri May 27, 2016 10:19 pm
by E-l337
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. :)

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

Posted: Fri Jun 24, 2016 5:20 pm
by LinaG
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!

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

Posted: Sat Jun 25, 2016 10:41 am
by SweetChiel
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

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

Posted: Wed Jul 06, 2016 3:09 am
by trismegistus
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

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

Posted: Wed Jul 06, 2016 8:21 pm
by gas
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.

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

Posted: Wed Jul 06, 2016 8:32 pm
by minyan
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

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

Posted: Wed Jul 06, 2016 8:43 pm
by qirien
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).

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

Posted: Thu Jul 07, 2016 2:35 am
by trismegistus
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.

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

Posted: Thu Jul 07, 2016 8:38 pm
by qirien
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! :)

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

Posted: Thu Jul 07, 2016 8:52 pm
by qirien
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

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

Posted: Thu Jul 07, 2016 11:03 pm
by trismegistus
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!

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

Posted: Fri Jul 08, 2016 5:22 am
by minyan
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!!

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

Posted: Sun Sep 11, 2016 3:09 am
by perfect-daiya
How can I set it so that a player can choose more than one option in the day planner?

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

Posted: Mon Sep 12, 2016 11:24 am
by qirien
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.