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
User avatar
qirien
Veteran
Posts: 451
Joined: Thu Jul 31, 2003 10:06 pm
Organization: Metasepia Games
Deviantart: qirien
Github: qirien
itch: qirien
Location: New Mexico, USA
Contact:

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

#121 Post by qirien » Mon Jan 08, 2018 9:38 pm

Hmm, it looks like you changed to days of the week in one place but not in all the places? Can you search dse-schedule.rpy for "morning" and see if there are some places that are still using those instead of your days of the week?

You need to change this line:

Code: Select all

call screen day_planner(["Morning", "Afternoon", "Evening"])
as well as this section:

Code: Select all

    dp_period("Morning", "morning_act")
    dp_choice("Attend Class", "class")
    dp_choice("Cut Class", "cut")
    
    # This is an example of an event that should only show up under special circumstances
    dp_choice("Fly to the Moon", "fly", show="strength >= 100 and intelligence >= 100")

    dp_period("Afternoon", "afternoon_act")
    dp_choice("Study", "study")
    dp_choice("Hang Out", "hang")

    dp_period("Evening", "evening_act")
    dp_choice("Exercise", "exercise")
    dp_choice("Play Games", "play")
Finished games:
Image
Image
Image
In progress: Our Personal Space 2: Space to Grow

verysunshine
Veteran
Posts: 231
Joined: Wed Sep 24, 2014 5:03 pm
Projects: No Good Wife
Organization: Wild Rose Interactive
Contact:

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

#122 Post by verysunshine » Sat Jan 13, 2018 2:08 pm

This is working really well! I've imported dse-day_planner, dse-event_dispatcher, dse-stats, and dse-styles into my project files and rewritten the schedule and event scripts using DSE4 as a basis, keeping the code but changing the variables for my own because I would have to do that anyway. I'm going to dig around Ren'Py's code references to see if I can add a day counter and inventory button to the schedule screen.

Unfortunately, I had to stop that to debug what I had. This error baffles me because it's calling for information in scripts I didn't change, including one of Ren'Py's core scripts.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/days_script.rpy", line 42, in script
    call screen day_planner(["Morning", "Afternoon", "Evening"])
  File "renpy/common/000statements.rpy", line 471, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  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 74, in execute
    vbox:
  File "game/dse-day_planner.rpy", line 76, in execute
    for name, curr_val, enable, should_show in this_period.acts:
  File "game/dse-day_planner.rpy", line 77, in execute
    $ show_this = eval(should_show)
  File "game/dse-day_planner.rpy", line 77, in <module>
    $ show_this = eval(should_show)
SyntaxError: invalid syntax (<none>, line 1)

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

Full traceback:
  File "game/days_script.rpy", line 42, in script
    call screen day_planner(["Morning", "Afternoon", "Evening"])
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\ast.py", line 1706, in execute
    self.call("execute")
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\ast.py", line 1724, in call
    return renpy.statements.call(method, parsed, *args, **kwargs)
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\statements.py", line 145, in call
    return method(parsed, *args, **kwargs)
  File "renpy/common/000statements.rpy", line 471, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\exports.py", line 2526, in call_screen
    rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\ui.py", line 285, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2538, in interact
    scene_lists.replace_transient()
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\display\core.py", line 822, in replace_transient
    self.remove(layer, tag)
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\display\core.py", line 1107, in remove
    self.hide_or_replace(layer, remove_index, "hide")
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\display\core.py", line 1031, in hide_or_replace
    d = oldsle.displayable._hide(now - st, now - at, prefix)
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 443, in _hide
    self.update()
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 578, 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 74, in execute
    vbox:
  File "game/dse-day_planner.rpy", line 76, in execute
    for name, curr_val, enable, should_show in this_period.acts:
  File "game/dse-day_planner.rpy", line 77, in execute
    $ show_this = eval(should_show)
  File "game/dse-day_planner.rpy", line 77, in <module>
    $ show_this = eval(should_show)
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\python.py", line 1748, in py_eval
    code = py_compile(code, 'eval')
  File "REDACTED_DIRECTORY\renpy-6.99.12.4-sdk\renpy\python.py", line 584, in py_compile
    raise e
SyntaxError: invalid syntax (<none>, line 1)

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
I think what's happening is it can't figure out how to execute the "call screen" script. There is a bit of instruction that should be there but isn't. The only change I made to dse-day_planner is adding another line of code at line 62 (under the text "Day Planner"), but I removed the text, restoring the file to its original state.

SyntaxError usually means "go find a typo", but I can't find one.

Edit: My game originally didn't start in the script with the planner code. I tried moving the code to the beginning file to see if that would help, renaming the labels in the other file so they wouldn't conflict. It didn't help. The problem is definitely with call screen.

Edit 2: Commenting out the "call screen" and "window auto" brings up the error that it can't find a place to return, so the error must be there.

"Date for the romance. Marry for the truth." - No Good Wife (Alpha available for Mac and PC.)

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

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

#123 Post by qirien » Tue Jan 16, 2018 1:32 pm

Wow, that is a really weird error - it is not even telling you where the error is, but just says <none>. :-/ Are you using a saved game, or does this happen when you run the game from the beginning? I would also try removing all the .rpyc files and running the game fresh to make sure there's not like two copies compiled under different filenames or something.

Checking for conflicting labels is a good start. The order they are in shouldn't matter, but if there is more than one copy of the screen or any labels that will cause problems.
Finished games:
Image
Image
Image
In progress: Our Personal Space 2: Space to Grow

verysunshine
Veteran
Posts: 231
Joined: Wed Sep 24, 2014 5:03 pm
Projects: No Good Wife
Organization: Wild Rose Interactive
Contact:

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

#124 Post by verysunshine » Tue Jan 16, 2018 5:58 pm

qirien wrote:
Tue Jan 16, 2018 1:32 pm
Wow, that is a really weird error - it is not even telling you where the error is, but just says <none>. :-/ Are you using a saved game, or does this happen when you run the game from the beginning? I would also try removing all the .rpyc files and running the game fresh to make sure there's not like two copies compiled under different filenames or something.

Checking for conflicting labels is a good start. The order they are in shouldn't matter, but if there is more than one copy of the screen or any labels that will cause problems.
There are no conflicting labels, variables, or events. This occurs on a fresh game with the compiled files deleted. Lint complains if there are two labels with the same name, and there aren't.

Would NVL mode cause problems? Your game doesn't use it, but mine does. After commenting out the NVL code in my game (which won't affect me anyway), the same error appears.

Sometimes re-writing the code as instructions in plain English helps me.

Code: Select all

1) Get the instructions for the screen "day_planner".
2) Get the common statement that tells you how to execute a call screen function.
3) Get the screen "day_planner" for the defined periods.
4) Get the screen "day_planner" for the defined periods (repeated)
5) This involves getting some commands to show how the screen should look by default.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/days_script.rpy", line 62, in script
    call screen day_planner(["Morning", "Afternoon", "Evening"])
  File "renpy/common/000statements.rpy", line 485, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  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 74, in execute
    vbox:
  File "game/dse-day_planner.rpy", line 76, in execute
    for name, curr_val, enable, should_show in this_period.acts:
  File "game/dse-day_planner.rpy", line 77, in execute
    $ show_this = eval(should_show)
  File "game/dse-day_planner.rpy", line 77, in <module>
    $ show_this = eval(should_show)
SyntaxError: invalid syntax (<none>, line 1)
In this situation, the commands "screen day_planner(periods):" and "$ show_this = eval(should_show)" are repeated. This might indicate the problem has something to do with the displaying of the screen.

In annoyance, I copied the remaining dse files to the game library and directed the game to run code from dse_schedule instead of my own code.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/dse-schedule.rpy", line 93, in script
    call screen day_planner(["Morning", "Afternoon", "Evening"])
  File "renpy/common/000statements.rpy", line 485, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  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 74, in execute
    vbox:
  File "game/dse-day_planner.rpy", line 76, in execute
    for name, curr_val, enable, should_show in this_period.acts:
  File "game/dse-day_planner.rpy", line 77, in execute
    $ show_this = eval(should_show)
  File "game/dse-day_planner.rpy", line 77, in <module>
    $ show_this = eval(should_show)
SyntaxError: invalid syntax (<none>, line 1)
Looking at the last two lines of the full traceback, it appears the compiler is confused with the command "eval".

"<none>, line 1" appears to mean "The code can't identify where the problem is." It's been used to show:
  • setting a variable instead of checking it
    instances of incompatible code
    a lack of if statements where there should be if statements
    ampersands instead of the word "and"
    a Dynamic Displayable not operating with a Dynamic Character
With that in mind, I decided to check my variables. I caught two instances of incorrect equals signs in my schedule declarations. After fixing that, the error still shows up.

Edit 10:30PM:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/dse-schedule.rpy", line 93: expected 'name' not found.
    call screen (["Morning", "Afternoon", "Evening"])
                ^

Ren'Py Version: Ren'Py 6.99.14.3135
This popped up when I tried loading the game just now. Adding "display_planner" to the function lets it continue. It gives me a new error.

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/dse-day_planner.rpy", line 50: expected 'word' not found.
    screen (periods):  
           ^

Ren'Py Version: Ren'Py 6.99.14.3135
Adding define_screen fixed that.

The invalid syntax error comes up when it tries to call the screen, but there is probably new syntax for the code in that section.

"Date for the romance. Marry for the truth." - No Good Wife (Alpha available for Mac and PC.)

User avatar
PoisionLullaby
Regular
Posts: 42
Joined: Wed Jan 10, 2018 9:11 pm
Projects: We're all human
Deviantart: PoisionLullaby
Contact:

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

#125 Post by PoisionLullaby » Thu Jan 18, 2018 10:01 pm

So, I don't know what exactly caused this error. I haven't touched this code. All I've done is add stats and change the names of them on a different tab as well as add some dialogue once again on a different tab. I'm new to coding so it is very possible that I typed something wrong and it confused the heck out of something but I'm not sure what I need to change.

This is the error code.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00start.rpy", line 186, in script call
    call _start_store
  File "renpy/common/00start.rpy", line 141, in script
    python hide:
  File "game/dse-stats.rpy", line 39, in normalize_stats
    v = getattr(store, s.var)
TypeError: getattr(): attribute name must be string
So I though maybe changing the () around "(store, s.var)" would clear it up.

Code: Select all

def normalize_stats():
        for s in __dse_stats:

            v = getattr(store, s.var)

            if v > s.max:
                v = s.max
            if v < 0:
                v = 0

            setattr(store, s.var, v)
Instead I get the same thing but now the very bottom says...

Code: Select all

TypeError: 'builtin_function_or_method' object has no attribute '__getitem__'
I have no clue how to even start trying to fix the second error or where its even pulling those words from. ^^' Any help is greatly appreciated.
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~

verysunshine
Veteran
Posts: 231
Joined: Wed Sep 24, 2014 5:03 pm
Projects: No Good Wife
Organization: Wild Rose Interactive
Contact:

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

#126 Post by verysunshine » Fri Jan 19, 2018 1:32 am

Hi, Poision! The "tabs" in your editing program are actually different scripts. I'm assuming you changed stats in "dse-schedule" and added dialogue in "dse-events".

I'm not sure what you mean by "changing the () around '(store, s.var)". Your (seemingly modified) code and my (unchanged) code are identical.

Could you show us your stats code? That's probably where the issue actually is.

(You don't need to read past this point. Everything below here is debugging another problem.)
_ _ _
Meanwhile, at the SyntaxError:
_ _ _

I've done some more careful debugging by commenting out code in the affected area to see exactly where the problem is. The code operates as expected until the line "show_this = eval(should_show)" is run. Then, it puts up the syntax error.

Code: Select all

While running game code:
  File "game/dse-schedule.rpy", line 93, in script
    call screen display_planner(["Morning", "Afternoon", "Evening"])
  File "renpy/common/000statements.rpy", line 485, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  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 74, in execute
    vbox:
  File "game/dse-day_planner.rpy", line 76, in execute
    for name, curr_val, enable, should_show in this_period.acts:
  File "game/dse-day_planner.rpy", line 78, in execute
    $ enable = eval(enable)
  File "game/dse-day_planner.rpy", line 78, in <module>
    $ enable = eval(enable)
SyntaxError: invalid syntax (<none>, line 1)

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

Full traceback:
  File "game/dse-schedule.rpy", line 93, in script
    call screen display_planner(["Morning", "Afternoon", "Evening"])
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\ast.py", line 1801, in execute
    self.call("execute")
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\ast.py", line 1789, in call
    return renpy.statements.call(method, parsed, *args, **kwargs)
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\statements.py", line 169, in call
    return method(parsed, *args, **kwargs)
  File "renpy/common/000statements.rpy", line 485, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\exports.py", line 2614, in call_screen
    rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\ui.py", line 287, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2620, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2925, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\display\core.py", line 511, in visit_all
    d.visit_all(callback)
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\display\core.py", line 511, in visit_all
    d.visit_all(callback)
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\display\core.py", line 511, in visit_all
    d.visit_all(callback)
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 401, in visit_all
    callback(self)
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2925, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 411, in per_interact
    self.update()
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 592, in update
    self.screen.function(**self.scope)
  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 74, in execute
    vbox:
  File "game/dse-day_planner.rpy", line 76, in execute
    for name, curr_val, enable, should_show in this_period.acts:
  File "game/dse-day_planner.rpy", line 78, in execute
    $ enable = eval(enable)
  File "game/dse-day_planner.rpy", line 78, in <module>
    $ enable = eval(enable)
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\python.py", line 1833, in py_eval
    code = py_compile(code, 'eval')
  File "C:\Users\Me\Documents\renpy-6.99.12.4-sdk\renpy\python.py", line 630, in py_compile
    raise e
SyntaxError: invalid syntax (<none>, line 1)
I've done a lot of reading about Python and Ren'Py trying to figure out what "show_this = eval(should_show)" means. Here's my understanding:
"show_this" should be set to the result of "should_show"
How do we evaluate "should_show"?
"should_show" is found one other time in all of the documentation. This is in the "for statement" that controls the display of the options. This use isn't instructions.
"should_show" doesn't appear in the Ren'Py documentation.
I wrote "show_this = should_show" just to see if that would cause the error to go away. It does. The resulting screen will show all of the events, ignoring the show conditions. When "Done Planning" is clicked, it will run the selected event and all events after it, even if the events are not for that period before going to the next period. "show_this = True" does the same thing, while "show_this = False" hides all of the events, as it should.

The problem appears to be that the game can't find the instructions for what it's evaluating.

Did I miss the "should_show" evaluation? I can't see a reference to it in the DSE guide either, and that works flawlessly.

"Date for the romance. Marry for the truth." - No Good Wife (Alpha available for Mac and PC.)

User avatar
PoisionLullaby
Regular
Posts: 42
Joined: Wed Jan 10, 2018 9:11 pm
Projects: We're all human
Deviantart: PoisionLullaby
Contact:

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

#127 Post by PoisionLullaby » Fri Jan 19, 2018 3:45 am

Oh it is? Well now I know. :P And by "changing the () around '(store, s.var)" I had changed the parenthesis into brackets [] and other types of what I understood to be "strings" in a hope it was a simple problem. When all it did was cause the new but similar error I changed it back.

And sure anything to figure out what happened. ^^'

Code: Select all

# stats.rpy
# Keeps track of and displays the stats for the DSE.
#
# To change styles, look for the dse_stats_* blocks in styles.rpy


init -100 python:

    __dse_stats = [ ]

    class __Stat(object):

        def __init__(self, name, var, default, max, hidden=False):
            self.name = name
            self.var = var
            self.default = default
            self.max = max
            self.hidden = hidden

    def __init_stats():
        for s in __dse_stats:
            setattr(store, s.var, s.default)

    config.start_callbacks.append(__init_stats)
    
    # Call this function to add a stat to keep track of. 
    # Arguments:
    # Name: name of stat. Will be displayed in the Stats screen
    # var: name of variable to use to keep track of stat.
    # default: starting value for the stat
    # max: maximum value for the stat
    # hidden: Is this stat hidden from the user? Hidden stats will not be displayed in the stats screen.
    def register_stat(name, var, default=0, max=100, hidden=False):
        __dse_stats.append(__Stat(name, var, default, max, hidden))

    def normalize_stats():
        for s in __dse_stats:

            v = getattr(store, s.var)

            if v > s.max:
                v = s.max
            if v < 0:
                v = 0

            setattr(store, s.var, v)

    # Whenever a python statement is executed, we will ensure our stats
    # stay within range.
    config.python_callbacks.append(normalize_stats)                        

# Display the stats in a frame.
# name -  display the stat's name
# bar -   display a bar indicating the value of the stat
# value - display the numerical value of the stat
# max -   display the maximum value of the stat
screen display_stats(name=True, bar=True, value=True, max=True):
    $ dse_stat_length = len(__dse_stats)
    
    #The number of rows is the number of stats that are not hidden
    for s in __dse_stats:
        if s.hidden:
            $ dse_stat_length -= 1
    
    frame:
        style_group "dse_stats"        
        yalign 0.0
        xalign 0.0


        vbox:
            yalign 0.0
            xalign 0.5
            label "Statistics" xalign 0.5

            # Depending on what the user chooses to display, calculate how many columns we need
            $ num_columns = 0
            if name:
                $ num_columns+=1
            if bar:
                $ num_columns+=1
            if value or max:
                $ num_columns+=1
                        
            # Make a grid with up to 3 columns and as many rows as there are stats.
            grid num_columns dse_stat_length:
                xalign 0.5
                yalign 0.5
                spacing 5
                
                for s in __dse_stats:
                    #Skip if the stat is a hidden stat
                    if (not s.hidden):
                        $ v = getattr(store, s.var)
    
                            
                        if name:
                            label s.name
                        
                        if bar:
                            bar value v range s.max xmaximum 150 xalign 0.0
                            
                        if value and max:
                            label ("%d/%d" % (v, s.max)) xalign 1.0
                        elif value:
                            label ("%d" % (v,)) xalign 1.0
                        elif max:
                            label ("%d" % (s.max,)) xalign 1.0
                            
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~

verysunshine
Veteran
Posts: 231
Joined: Wed Sep 24, 2014 5:03 pm
Projects: No Good Wife
Organization: Wild Rose Interactive
Contact:

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

#128 Post by verysunshine » Fri Jan 19, 2018 8:34 pm

Right now, the only difference I can see is line 68, which shouldn't affect this, I'd think.

Code: Select all

	        xalign 0.0

Code: Select all

	        xalign 0.5
This only affects object placement.

As far as I am aware, the value it's saying should be a string is a string.

What about the area that sets up variables? In the default package it is in dse_schedule, and it looks like this:

Code: Select all

init python:
    register_stat("Strength", "strength", 10, 100)
    register_stat("Intelligence", "intelligence", 10, 100)
    register_stat("Relaxation", "relaxation", hidden=True)

    dp_period("Morning", "morning_act")
    dp_choice("Attend Class", "class")
    dp_choice("Cut Class", "cut")
    
    # This is an example of an event that should only show up under special circumstances
    dp_choice("Fly to the Moon", "fly", show="strength >= 100 and intelligence >= 100")

    dp_period("Afternoon", "afternoon_act")
    dp_choice("Study", "study")
    dp_choice("Hang Out", "hang")

    dp_period("Evening", "evening_act")
    dp_choice("Exercise", "exercise")
    dp_choice("Play Games", "play")

"Date for the romance. Marry for the truth." - No Good Wife (Alpha available for Mac and PC.)

User avatar
PoisionLullaby
Regular
Posts: 42
Joined: Wed Jan 10, 2018 9:11 pm
Projects: We're all human
Deviantart: PoisionLullaby
Contact:

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

#129 Post by PoisionLullaby » Fri Jan 19, 2018 9:38 pm

Yeah I figured that wasn't the issue because It was fine before hand.

here is that page.

Code: Select all

# The Dating Sim Engine was written by PyTom, 
# with updates added by Andrea Landaker (qirien),
# and contributions by Edmund Wilfong (Pneumonica)
#
# For support, see the Lemma Soft forums thread:
# http://lemmasoft.renai.us/forums/viewtopic.php?f=51&t=31571
#
# It is released under the MIT License - see DSE-LICENSE.txt
#
#
# This is the main part of the program, where you setup your schedule and
# the options for the user. You can change the stats, periods, and choices
# here; just make sure they match up with the events setup in
# dse-events.rpy.  You can even have different time periods (months, instead
# of times of day, for example).

# Set up a default schedule.
init python:
    register_stat("Social", "social", 0, 100)
    register_stat("Intelligence", "int", 10, 100)
    register_stat("Art Skill", "art", 15, 100)
    register_stat("Gameing Skill," "gaming", 5, 100)
    register_stat("Stress Level", "stress", 10, 100)
    register_stat("Followers", "follow", 0, 10000)
    register_stat("Subscribers", "subs", 0, 10000)
    #Romance options
    register_stat("Guy 1 Affection", "guyone", 0, 100, hidden = True)
    register_stat("Guy 2 Affection", "guytwo", 0, 100, hidden = True)


    dp_period("Morning", "morning_act")
    dp_choice("Draw", "draw")
    dp_choice("Browse Youtube", "youtube")
    dp_choice("Browse Twitter", "twitter")
    
    dp_period("Noon", "noon_act")
    dp_choice("Attend Class", "class")
    dp_choice("Cut Class", "cut")
    
    # This is an example of an event that should only show up under special circumstances
    dp_choice("Go out with Guy One.", "Date", show="social >= 30 and guyone >= 100")

    dp_period("Afternoon", "afternoon_act")
    dp_choice("Study", "study")
    dp_choice("Browse Twitter", "twitter")
    dp_choice("Play Games", "play")

    dp_period("Evening", "evening_act")
    dp_choice("Draw", "draw")
    dp_choice("Play Games", "play")
    dp_choice("Browse Youtube", "youtube")

    
# This is the entry point into the game.
label start:

    # Initialize the default values of some of the variables used in
    # the game.
    $ day = 0

    # Show a default background.
    scene black

    # The script here is run before any event.

    "I'm just test text."
    
    "Yup"
    
    "More words to fill space."

    # We jump to day to start the first day.
    jump day


# This is the label that is jumped to at the start of a day.
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 = None
    $ afternoon_act = None
    $ 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(["Morning", "Noon", "Afternoon", "Evening"])
    window auto
    
    # We process each of the three periods of the day, in turn.
label morning:

    # Tell the user what period it is.
    centered "Morning"

    # Set these variables to appropriate values, so they can be
    # picked up by the expression in the various events defined below. 
    $ period = "morning"
    $ act = morning_act
    
    # Execute the events for the morning.
    call events_run_period

    
label noon:
    
    if check_skip_period():
        jump afternoon

    centered "Noon"
    
    "Time for school!"
 
    $ period = "noon"
    $ act = noon_act

    call events_run_period
    

label afternoon:

    # It's possible that we will be skipping the afternoon, if one
    # of the events in the morning jumped to skip_next_period. If
    # so, we should skip the afternoon.
    if check_skip_period():
        jump evening

    # The rest of this is the same as for the morning.

    centered "Afternoon"

    $ period = "afternoon"
    $ act = afternoon_act

    call events_run_period


label evening:
    
    # The evening is the same as the afternoon.
    if check_skip_period():
        jump night

    centered "Evening"
    
    "I'm so glad school is over... "

    $ period = "evening"
    $ act = evening_act
    
    call events_run_period


label night:

    # This is now the end of the day, and not a period in which
    # events can be run. We put some boilerplate end-of-day text
    # in here.

    centered "Night"

    "It's getting late, I should really to go to sleep."

    # We call events_end_day to let it know that the day is done.
    call events_end_day

    # And we jump back to day to start the next day. This goes
    # on forever, until an event ends the game.
    jump day
         

[\code]
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~

verysunshine
Veteran
Posts: 231
Joined: Wed Sep 24, 2014 5:03 pm
Projects: No Good Wife
Organization: Wild Rose Interactive
Contact:

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

#130 Post by verysunshine » Fri Jan 19, 2018 11:43 pm

"int" is a default parameter for Python, the scripting language Ren'Py is based on. It means "integer". Try replacing it with "intel", or something.

"Date for the romance. Marry for the truth." - No Good Wife (Alpha available for Mac and PC.)

User avatar
PoisionLullaby
Regular
Posts: 42
Joined: Wed Jan 10, 2018 9:11 pm
Projects: We're all human
Deviantart: PoisionLullaby
Contact:

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

#131 Post by PoisionLullaby » Sat Jan 20, 2018 12:48 am

I tried it and got this error.

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/dse-schedule.rpy", line 18: expected statement.
    intel python:
          ^

Ren'Py Version: Ren'Py 6.99.13.2919
this is all i changed

Code: Select all

# Set up a default schedule.
intel python:
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~

verysunshine
Veteran
Posts: 231
Joined: Wed Sep 24, 2014 5:03 pm
Projects: No Good Wife
Organization: Wild Rose Interactive
Contact:

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

#132 Post by verysunshine » Sat Jan 20, 2018 9:35 pm

That was my fault. I was not specific about where to make the change.
"init" is not "int". "init" means "initialize".

The line

Code: Select all

    register_stat("Intelligence", "int", 10, 100)
actually shouldn't matter because "int" is in quotation marks, so the computer should not think it is an instruction. (In Editra, things in quotation marks will always show up in green.)

Code: Select all

    register_stat("Intelligence", "intelligence", 10, 100)
Quirian, my screens.rpy looks totally different than yours. Is there something in that screen or the options screen that I should move?

"Date for the romance. Marry for the truth." - No Good Wife (Alpha available for Mac and PC.)

User avatar
PoisionLullaby
Regular
Posts: 42
Joined: Wed Jan 10, 2018 9:11 pm
Projects: We're all human
Deviantart: PoisionLullaby
Contact:

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

#133 Post by PoisionLullaby » Sat Jan 20, 2018 11:20 pm

That makes sense, so i'm confused what should I change then? And wait you want to see my screens.rpy? Or are you asking qirian? :P
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~

verysunshine
Veteran
Posts: 231
Joined: Wed Sep 24, 2014 5:03 pm
Projects: No Good Wife
Organization: Wild Rose Interactive
Contact:

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

#134 Post by verysunshine » Mon Jan 22, 2018 6:48 pm

I was asking Qirian about screens.rpy.

Try adding a # to the start of:

register_stat("Intelligence", "int", 10, 100)

This will comment out the line.

"Date for the romance. Marry for the truth." - No Good Wife (Alpha available for Mac and PC.)

User avatar
PoisionLullaby
Regular
Posts: 42
Joined: Wed Jan 10, 2018 9:11 pm
Projects: We're all human
Deviantart: PoisionLullaby
Contact:

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

#135 Post by PoisionLullaby » Tue Jan 23, 2018 12:53 pm

Ah sorry. And nope, still get the same error.
~Everyone has bad days. Don't judge someone on that day and that day alone, judge them on their actions after it and onward.~

Post Reply

Who is online

Users browsing this forum: No registered users