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
TheChatotMaestro
Regular
Posts: 59
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 » Mon Sep 11, 2017 1:22 pm

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

#107 Post by qirien » Mon Sep 18, 2017 1:55 pm

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

#108 Post by qirien » Mon Sep 18, 2017 1:56 pm

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
In progress: Our Personal Space 2: Space to Grow

TheChatotMaestro
Regular
Posts: 59
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 » Sun Sep 24, 2017 2:36 pm

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 » Sun Oct 08, 2017 4:15 pm

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

#111 Post by qirien » Mon Oct 09, 2017 1:51 pm

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
In progress: Our Personal Space 2: Space to Grow

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 » Fri Oct 13, 2017 1:08 am

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: 59
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 » Sat Oct 14, 2017 4:22 pm

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 » Sat Oct 14, 2017 9:02 pm

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

#115 Post by qirien » Mon Oct 16, 2017 1:20 pm

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
In progress: Our Personal Space 2: Space to Grow

User avatar
MadeVeryMerry
Newbie
Posts: 8
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 » Fri Nov 17, 2017 5:40 pm

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

#117 Post by qirien » Sat Nov 18, 2017 8:16 pm

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
In progress: Our Personal Space 2: Space to Grow

User avatar
MadeVeryMerry
Newbie
Posts: 8
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 » Sat Nov 18, 2017 9:20 pm

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

#119 Post by qirien » Tue Nov 21, 2017 12:17 pm

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
In progress: Our Personal Space 2: Space to Grow

Post Reply

Who is online

Users browsing this forum: No registered users