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.
Message
Author
TheChatotMaestro
Regular
Posts: 91
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: Dating Sim Engine (DSE) 3.12! Day Planner and Event Manager

#106 Post by TheChatotMaestro »

Is there any fix for a problem I'm encountering where every time I use the event.choose_one, no matter how many times I go to the next day, the same event from the list always happens?

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) 4.0! Day Planner and Event Manager

#107 Post by qirien »

TheChatotMaestro, can you post the code you are using? In the sample code in dse-events.rpy, the "Cut Class" event uses this and it seems to be pretty random to me. Maybe taking a look at how it is used in there will give you some direction on how to use it in your game.
Finished games:
Image
Image
Image

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) 4.0! Day Planner and Event Manager

#108 Post by qirien »

I just posted a new version of the DSE that uses the new GUI. I also renamed the files so it was obvious which ones you need and which ones you don't. Please try it out and let me know if you encounter any problems!

Because of this renaming, you may need to remove all the old .rpyc files or you may get an error.

https://github.com/renpy/dse/releases/tag/4.0
Finished games:
Image
Image
Image

TheChatotMaestro
Regular
Posts: 91
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: Dating Sim Engine (DSE) 4.0! Day Planner and Event Manager

#109 Post by TheChatotMaestro »

Thank you so much, that fixed everything, even a persistent problem when it would revert back to one background. This is amazing! :D

drakonrenders
Newbie
Posts: 3
Joined: Wed Jul 26, 2017 1:11 am
Deviantart: drakonrenders
Contact:

Re: Dating Sim Engine (DSE) 4.0! Day Planner and Event Manager

#110 Post by drakonrenders »

Ok, I'm having what I assume is a silly easy problem to fix, but I haven't been able to figure out where I've gone wrong (I am an absolute noob to programming, so that's not helping). I've got my8 game up and running to the point that the day planner comes up and lets the user choose their activities for the day, but when you finish planning and run it I am getting an error that "__dse_stats" is not defined. I can't figure out how to define it. Here is my traceback log:

I'm sorry, but an uncaught exception occurred.

While running game code:
File "renpy/common/00start.rpy", line 176, in script call
call _start_store
File "renpy/common/00start.rpy", line 128, in script
python hide:
File "game/dse-stats.rpy", line 38, in normalize_stats
for s in _dse_stats:
NameError: global name '_dse_stats' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "X:\Data\Renpy Dev Kit\renpy-6.99.12.4-sdk\renpy\bootstrap.py", line 295, in bootstrap
renpy.main.main()
File "X:\Data\Renpy Dev Kit\renpy-6.99.12.4-sdk\renpy\main.py", line 487, in main
run(restart)
File "X:\Data\Renpy Dev Kit\renpy-6.99.12.4-sdk\renpy\main.py", line 147, in run
renpy.execution.run_context(True)
File "X:\Data\Renpy Dev Kit\renpy-6.99.12.4-sdk\renpy\execution.py", line 761, in run_context
context.run()
File "renpy/common/00start.rpy", line 176, in script call
call _start_store
File "renpy/common/00start.rpy", line 128, in script
python hide:
File "X:\Data\Renpy Dev Kit\renpy-6.99.12.4-sdk\renpy\ast.py", line 819, in execute
i()
File "game/dse-stats.rpy", line 38, in normalize_stats
for s in _dse_stats:
NameError: global name '_dse_stats' is not defined

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187

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) 4.0! Day Planner and Event Manager

#111 Post by qirien »

Huh, I haven't seen that error before. Do you still have this statement on line 9 of dse-stats.rpy?

Code: Select all

    __dse_stats = [ ]
Finished games:
Image
Image
Image

drakonrenders
Newbie
Posts: 3
Joined: Wed Jul 26, 2017 1:11 am
Deviantart: drakonrenders
Contact:

Re: Dating Sim Engine (DSE) 4.0! Day Planner and Event Manager

#112 Post by drakonrenders »

Yep, here is line 9: __dse_stats = [ ]
I'm still new enough at this I don't even know what to show to help figure out where the problem is, I'll be happy to post anything that you think will help

TheChatotMaestro
Regular
Posts: 91
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: Dating Sim Engine (DSE) 4.0! Day Planner and Event Manager

#113 Post by TheChatotMaestro »

Looks like one has two underscores and the other has one underscore, in the forum post at least. Would that mess anything up?

drakonrenders
Newbie
Posts: 3
Joined: Wed Jul 26, 2017 1:11 am
Deviantart: drakonrenders
Contact:

Re: Dating Sim Engine (DSE) 4.0! Day Planner and Event Manager

#114 Post by drakonrenders »

When I take out the extra underscore, it throws a similar error, but pointing to a different name:
While running game code:
File "game/script.rpy", line 45, in script
init python:
File "game/script.rpy", line 46, in <module>
register_stat("Strength", "strength", 10, 100)
File "game/dse-stats.rpy", line 36, in register_stat
__dse_stats.append(__Stat(name, var, default, max))
NameError: global name '_m1_dse0x2dstats__dse_stats' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "X:\Data\Renpy Dev Kit\renpy-6.99.12.4-sdk\renpy\bootstrap.py", line 295, in bootstrap
renpy.main.main()
File "X:\Data\Renpy Dev Kit\renpy-6.99.12.4-sdk\renpy\main.py", line 419, in main
game.context().run(node)
File "game/script.rpy", line 45, in script
init python:
File "X:\Data\Renpy Dev Kit\renpy-6.99.12.4-sdk\renpy\ast.py", line 814, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "X:\Data\Renpy Dev Kit\renpy-6.99.12.4-sdk\renpy\python.py", line 1719, in py_exec_bytecode
exec bytecode in globals, locals
File "game/script.rpy", line 46, in <module>
register_stat("Strength", "strength", 10, 100)
File "game/dse-stats.rpy", line 36, in register_stat
__dse_stats.append(__Stat(name, var, default, max))
NameError: global name '_m1_dse0x2dstats__dse_stats' is not defined

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) 4.0! Day Planner and Event Manager

#115 Post by qirien »

Yeah, it's not an extra underscore; there's supposed to be two of them.

If you can zip up your project files and PM me a link or something, I can take a look at it. :-)
Finished games:
Image
Image
Image

User avatar
MadeVeryMerry
Newbie
Posts: 12
Joined: Wed Nov 11, 2015 12:52 am
Contact:

Re: Dating Sim Engine (DSE) 4.0! Day Planner and Event Manager

#116 Post by MadeVeryMerry »

OK, this is probably super silly, but I'm trying to figure out how to use this engine... without the day planner? (This is probably really ambitious for someone who's a complete novice at Ren'Py and has never touched Python in their life.) I like the event dispatcher and it makes it a lot simpler than the system I used in a previous test game (a system that hinged on the Random property, calling labels, and lots and lots of variables instead of .once and .only), but I want periods to run without choices/with random events, without a planner.

For example, I want a morning period to pass with a few randomly-chosen events ("I go to class," "I go to work," "This happens," "That happens"), the afternoon to pass the same way, and the evening to be the "choice" section. Events occur based on variables in the morning and afternoon, but the choice of what to do is made in the evening (unless there's an afternoon event that skips the evening period).

I'm sure that someone's talked about this earlier in the thread, but I'm completely lost in the code - I can't figure out how I need to define acts or periods. I used the event_dispatcher.rpy to call some of the random morning events (using choose.one() and removing the act=""), but they didn't randomize; is this because the act is needed to group those events together?

IDK, this is a bit rambly and I'm very new to this. I can do what I want with some really clunky, extended code but I want to consolidate it as much as possible, and the event dispatcher in this engine seems like it would work with what I need.

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) 4.0! Day Planner and Event Manager

#117 Post by qirien »

OK, it sounds like you could use the day planner/event manager for this, though if you wanted to make your own system for choosing things randomly, that probably wouldn't be harder/easier; just different.

If you decide to use the DSE, you can just remove the dp_period and dp_choices lines for periods you aren't using, so that you only give a choice for the nighttime period (see dse-schedule.rpy). You'll also need to remove them from where you call the day_planner screen. When the day starts (under the label "day"), you can set morning_act and afternoon_act to whatever you are choosing for the user, and it will execute events for them just as if the user picked those from the GUI.

Make sure when you use choose_one('group') you give it a group; it will pick a random item from that group.

If you haven't already, check out the documentation here:
https://www.renpy.org/wiki/renpy/DSE

And I guess you're already looking at the sample code; you might try playing around with it and changing one thing at a time.

I hope this helps a bit! Good luck!
Finished games:
Image
Image
Image

User avatar
MadeVeryMerry
Newbie
Posts: 12
Joined: Wed Nov 11, 2015 12:52 am
Contact:

Re: Dating Sim Engine (DSE) 4.0! Day Planner and Event Manager

#118 Post by MadeVeryMerry »

Okay, awesome! I did some fiddling and got confused for a hot second, but I think I figured it out. (I did have a system for a different game that ran events and randomly picked events, but it was a lot less efficient and was very confusing to read. I'm hoping that this will be a bit easier to deal with, especially when adding new events.)

I am experiencing a weird issue, though. I'm playing with the acts and periods like you suggested, and this is the code I'm using:

Code: Select all

init python:
   
    dp_period("Evening", "evening_act")
    dp_choice("Exercise", "exercise")
    dp_choice("Play Games", "play")
Right at the beginning, pulling out the dp_periods for morning and afternoon.

Code: Select all

label day:

    # Increment the day it is.
    $ day += 1

    # We may also want to compute the name for the day here, but
    # right now we don't bother.

    "It's day %(day)d."

    # Here, we want to set up some of the default values for the
    # day planner. In a more complicated game, we would probably
    # want to add and remove choices from the dp_ variables
    # (especially dp_period_acts) to reflect the choices the
    # user has available.

    $ morning_act = "class"
    $ afternoon_act = "study"
    $ evening_act = None
    $ narrator("What should I do today?", interact=False)
    window show
    

    # 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(["Evening"])
Pulled out the "Morning" and "Afternoon" calls so only the Evening shows up in the game, which is exactly what I wanted. However, you'll notice I set the morning act to "class" and the afternoon act to "study." Originally it was set to "cut" and "study," which ran fine, but when I changed it to "class," the "cut" act would call until I closed the game entirely and restarted (instead of just reloading).

Additionally, is it possible to set the period_act to something defined at random? Would I (for example) set it to "morningstuff" and then just have events in the "morningstuff" act with different variables (or random)? I think this would work pretty much exactly like the triggered events like gg_studying and gg_bookslide, I just want to be sure. Nevermind! This should work fine.

Also, oh gosh, one last question - is it possible to call the day planner after the morning and afternoon acts have been run? I want there to be the feel of "I finished my day and now I'm deciding what to do". Figured this out! Nevermind!

Sorry I'm asking so many questions! Thanks for your help! :)

ETA: Is it possible to have a separate planner for weekend events? e.g. "weekdaymornings" called when the calendar day is 2-6, "weekendmornings" called when the calendar day is 1 or 7? ETA2: I think I've got this figured out...

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) 4.0! Day Planner and Event Manager

#119 Post by qirien »

Is it still doing this, or was that just a weird one-time thing that happened when you reloaded it? I'm glad you're figuring most of it out!
Finished games:
Image
Image
Image

weirdmaggedon
Newbie
Posts: 1
Joined: Thu Jan 04, 2018 6:04 pm
Contact:

Re: Dating Sim Engine (DSE) 4.0! Day Planner and Event Manager

#120 Post by weirdmaggedon »

I tried looking where else to ask my question, but nothing seems to be coming up. I noticed others posting questions here so I would like to ask. I intended to change the whole Morning to Evening system for the default DSE to a Mon-Friday type schedule. So I changed the names of morning, afternoon, and evening to Monday, Tuesday, Wednesday and just added the Thursday and Friday. The introduction runs well, however once the planner has to open up this exception occurs. Any advice?

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/dse-schedule.rpy", line 198, in script
    centered "Friday"
  File "game/dse-day_planner.rpy", line 50, in execute
    screen day_planner(periods):
  File "game/dse-day_planner.rpy", line 50, in execute
    screen day_planner(periods):
  File "game/dse-day_planner.rpy", line 53, in execute
    frame:
  File "game/dse-day_planner.rpy", line 56, in execute
    use display_planner(periods)
  File "game/dse-day_planner.rpy", line 58, in execute
    screen display_planner(periods):
  File "game/dse-day_planner.rpy", line 58, in execute
    screen display_planner(periods):
  File "game/dse-day_planner.rpy", line 59, in execute
    frame:
  File "game/dse-day_planner.rpy", line 61, in execute
    vbox:
  File "game/dse-day_planner.rpy", line 63, in execute
    hbox:
  File "game/dse-day_planner.rpy", line 65, in execute
    for p in periods:
  File "game/dse-day_planner.rpy", line 66, in execute
    vbox:
  File "game/dse-day_planner.rpy", line 68, in execute
    if p not in __periods:
  File "game/dse-day_planner.rpy", line 69, in execute
    $ raise Exception("Period %r was never defined." % p)
  File "game/dse-day_planner.rpy", line 69, in <module>
    $ raise Exception("Period %r was never defined." % p)
Exception: Period u'Monday' was never defined.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/dse-schedule.rpy", line 198, in script
    centered "Friday"
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\ast.py", line 624, in execute
    renpy.exports.say(who, what, interact=self.interact, *args, **kwargs)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\exports.py", line 1173, in say
    who(what, *args, **kwargs)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\character.py", line 911, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\character.py", line 747, in do_display
    **display_args)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\character.py", line 523, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\ui.py", line 287, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\display\core.py", line 2553, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\display\core.py", line 2821, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\display\screen.py", line 401, in visit_all
    callback(self)
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\display\core.py", line 2821, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\display\screen.py", line 411, in per_interact
    self.update()
  File "C:\Users\river\OneDrive\Desktop\Ren'Py\renpy-6.99.13-sdk\renpy\display\screen.py", line 580, in update
    self.screen.function(**self.scope)
  File "game/dse-day_planner.rpy", line 50, in execute
    screen day_planner(periods):
  File "game/dse-day_planner.rpy", line 50, in execute
    screen day_planner(periods):
  File "game/dse-day_planner.rpy", line 53, in execute
    frame:
  File "game/dse-day_planner.rpy", line 56, in execute
    use display_planner(periods)
  File "game/dse-day_planner.rpy", line 58, in execute
    screen display_planner(periods):
  File "game/dse-day_planner.rpy", line 58, in execute
    screen display_planner(periods):
  File "game/dse-day_planner.rpy", line 59, in execute
    frame:
  File "game/dse-day_planner.rpy", line 61, in execute
    vbox:
  File "game/dse-day_planner.rpy", line 63, in execute
    hbox:
  File "game/dse-day_planner.rpy", line 65, in execute
    for p in periods:
  File "game/dse-day_planner.rpy", line 66, in execute
    vbox:
  File "game/dse-day_planner.rpy", line 68, in execute
    if p not in __periods:
  File "game/dse-day_planner.rpy", line 69, in execute
    $ raise Exception("Period %r was never defined." % p)
  File "game/dse-day_planner.rpy", line 69, in <module>
    $ raise Exception("Period %r was never defined." % p)
Exception: Period u'Monday' was never defined.

Windows-8-6.2.9200
Ren'Py 6.99.13.2919
Sunshine Paradise 1.0

Post Reply

Who is online

Users browsing this forum: No registered users