DSE Uncaught Exception on first-time game load

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
E-l337
Regular
Posts: 49
Joined: Thu Jun 19, 2003 11:58 pm
Location: Internetopia
Contact:

DSE Uncaught Exception on first-time game load

#1 Post by E-l337 »

Hey folks, I've been beating my head against the wall trying to figure this one out for a bit now, and at this point I need to ask for help. I know where the problem is, but just not how to solve it.

So here's the problem: Using the DSE as a base, when I save a game on the day planner menu, and load it immediately after launching the game for the first time, it gives me this:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/main.rpy", line 182, in script
    call screen day_planner(["Morning", "Afternoon", "Evening", "Late Eve"])
  File "renpy/common/000statements.rpy", line 457, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "game/day_planner.rpy", line 65, in execute
    screen day_planner(periods):
  File "game/day_planner.rpy", line 65, in execute
    screen day_planner(periods):
  File "game/day_planner.rpy", line 68, in execute
    window:
  File "game/day_planner.rpy", line 70, in execute
    use display_planner(periods)
  File "game/day_planner.rpy", line 72, in execute
    screen display_planner(periods):
  File "game/day_planner.rpy", line 72, in execute
    screen display_planner(periods):
So on and so forth. The issue seems to be that it can't load the day planner, because it hasn't been defined yet... which makes sense, since it is not part of the init python (more on that later). Using the Rollback function seems to restart the day, and allows everything to execute properly, no longer throwing the error (and properly preserving all of the correct variables, such as stat scores and day number).

At this point, I should show you what I'm working with.

Code: Select all

# 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."
    
    python:
    
        dp_period("Morning", "morning_act")
        if (day == 1 or day == 8):
            dp_choice("Attend Class1", "class01")
        if day == 2:
            dp_choice("Attend Class2", "class03")
        if day == 3:
            dp_choice("Attend Class3", "class05")
        if day == 4:
            dp_choice("Attend Class4", "class07")
        if day == 5:
            dp_choice("Attend Class5", "class09")
        if (day == 6 or day == 7):
            dp_choice("Something Else", "class05")
Instead of running the dp_period and dp_choice in the init python line, I've chosen to run it on its own as part of the normal day script. This is because I need to make sure that only certain options appear on specific days, and that the correct events play. So on the first day, you only have the option to go to class 1, and on day two you go to class 2.

The problem is, I'm not sure how to resolve this issue. I can't put the day planner stuff in the python init because it throws an exception that Day is not defined (which it isn't, yet....). Attempting to set the day value in the python init and moving the day planner up there too causes it to display ALL of the options, regardless of whether they should be showing up for that day or not (presumably because it sets the day to zero, and doesn't properly store the correct day value...)

At this point, I am fairly sure my problem is that I am running up against the limits of my programming knowledge. Is there a command I'm missing somewhere? The issue only comes up when loading a save for the first time without starting the game. Once the game runs, it all works just fine...

Trying to put the basic dp_periods in the init python and also leaving the current code intact causes the error not to show up, but doesn't properly display any of the choices that should be available for that day.

What completely simple solution am I overlooking here? Or is this actually as complicated as I seem to think it is?

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: DSE Uncaught Exception on first-time game load

#2 Post by gas »

You already have a conditional statement for the dp_choice, no need for that... python thing:

Function: dp_choice (name, value=..., enable="True", show="True"):
Defines a new choice within a period. Name is the name that is shown to the user. Value is the value that will be assigned to a variable if this is the selected choice. Enable and Show are expressions that determine if the choice will be enabled or shown, respectively. (If either expression evaluates to False, the choice is not selectable.)
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

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

Re: DSE Uncaught Exception on first-time game load

#3 Post by E-l337 »

Forgive my ignorance here, but I'm struggling to understand how this fixes the issue I'm currently experiencing - which is that my game isn't loading data properly if the day planner script hasn't run at least once.

For some reason, running it as part of the init Python requires me to define the Day variable (because classes only appear on certain days). Doing so makes it so that the day value no longer increments properly (so day is always equal to 0, or 1, or whatever value I put in there).

I should note that I am not particularly good at programming, and while I've figured out most of the DSE, this one bit is giving me a bit of a problem for some reason.

If you're suggesting that the built-in conditionals for the day planner will accomplish what I'm looking for, could you give me a practical example?

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

Re: DSE Uncaught Exception on first-time game load

#4 Post by E-l337 »

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/main.rpy", line 215, in script
    call screen day_planner(["Morning", "Afternoon", "Evening", "Late Eve"])
  File "renpy/common/000statements.rpy", line 457, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "game/day_planner.rpy", line 65, in execute
    screen day_planner(periods):
  File "game/day_planner.rpy", line 65, in execute
    screen day_planner(periods):
  File "game/day_planner.rpy", line 68, in execute
    window:
  File "game/day_planner.rpy", line 70, in execute
    use display_planner(periods)
  File "game/day_planner.rpy", line 72, in execute
    screen display_planner(periods):
  File "game/day_planner.rpy", line 72, in execute
    screen display_planner(periods):
  File "game/day_planner.rpy", line 73, in execute
    frame:
  File "game/day_planner.rpy", line 75, in execute
    vbox:
  File "game/day_planner.rpy", line 77, in execute
    vbox:
  File "game/day_planner.rpy", line 79, in execute
    for p in periods:
  File "game/day_planner.rpy", line 80, in execute
    hbox:
  File "game/day_planner.rpy", line 82, in execute
    if p not in __periods:
  File "game/day_planner.rpy", line 83, in execute
    $ raise Exception("Period %r was never defined." % p)
  File "game/day_planner.rpy", line 83, in <module>
    $ raise Exception("Period %r was never defined." % p)
Exception: Period 'Morning' was never defined.

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

Full traceback:
  File "game/main.rpy", line 215, in script
    call screen day_planner(["Morning", "Afternoon", "Evening", "Late Eve"])
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\ast.py", line 1661, in execute
    self.call("execute")
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\ast.py", line 1679, in call
    renpy.statements.call(method, parsed, *args, **kwargs)
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\statements.py", line 144, in call
    return method(parsed, *args, **kwargs)
  File "renpy/common/000statements.rpy", line 457, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\exports.py", line 2365, in call_screen
    rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\ui.py", line 277, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\display\core.py", line 2357, in interact
    scene_lists.replace_transient()
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\display\core.py", line 725, in replace_transient
    self.remove(layer, tag)
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\display\core.py", line 1012, in remove
    self.hide_or_replace(layer, remove_index, "hide")
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\display\core.py", line 936, in hide_or_replace
    d = oldsle.displayable._hide(now - st, now - at, prefix)
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\display\screen.py", line 430, in _hide
    self.update()
  File "C:\Users\Ed\Desktop\renpy-6.99.6-sdk\renpy\display\screen.py", line 565, in update
    self.screen.function(**self.scope)
  File "game/day_planner.rpy", line 65, in execute
    screen day_planner(periods):
  File "game/day_planner.rpy", line 65, in execute
    screen day_planner(periods):
  File "game/day_planner.rpy", line 68, in execute
    window:
  File "game/day_planner.rpy", line 70, in execute
    use display_planner(periods)
  File "game/day_planner.rpy", line 72, in execute
    screen display_planner(periods):
  File "game/day_planner.rpy", line 72, in execute
    screen display_planner(periods):
  File "game/day_planner.rpy", line 73, in execute
    frame:
  File "game/day_planner.rpy", line 75, in execute
    vbox:
  File "game/day_planner.rpy", line 77, in execute
    vbox:
  File "game/day_planner.rpy", line 79, in execute
    for p in periods:
  File "game/day_planner.rpy", line 80, in execute
    hbox:
  File "game/day_planner.rpy", line 82, in execute
    if p not in __periods:
  File "game/day_planner.rpy", line 83, in execute
    $ raise Exception("Period %r was never defined." % p)
  File "game/day_planner.rpy", line 83, in <module>
    $ raise Exception("Period %r was never defined." % p)
Exception: Period 'Morning' was never defined.

Windows-7-6.1.7601-SP1
Ren'Py 6.99.6.739
 
This is the full error I am currently getting. This is currently what my main looks like:

Code: Select all

# This is the main program. This can be changed quite a bit to
# customize it for your program... But remember what you do, so you
# can integrate with a new version of DSE when it comes out.

# Set up a default schedule.
init python:
    register_stat("Combat", "combat", 5, 250)
    register_stat("Athletics", "athletics", 5, 250)
    register_stat("Subterfuge", "subterfuge", 5, 250)
    register_stat("Alchemy", "alchemy", 5, 250)
    register_stat("Medicine", "medicine", 5, 250)
    register_stat("History", "history", 5, 250)
    register_stat("Speech", "speech", 5, 250)
    register_stat("Posture", "posture", 5, 250)
    register_stat("Etiquette", "etiquette", 5, 250)
    register_stat("Arcana", "arcana", 5, 250)
    register_stat("Divination", "divination", 5, 250)
    register_stat("Perception", "perception", 5, 250)

    


# 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")

    dp_period ("Late Eve", "late_act")
    dp_choice ("Twiddle Thumbs", "twiddle")
    dp_choice ("Stare at ceiling", "stare")

    dp_period ("SunAM", "SunAM_act")
    dp_choice ("Attend Class1", "class01")

    dp_period ("SunNoon", "SunNoon_act")
    dp_choice("Study", "study")
    dp_choice("Hang Out", "hang")


# 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

    $ daynames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

    # Show a default background.
    scene black

    # The script here is run before any event.

    "This is the intro to the damned game."
    
    "There should be a choice thing here."
    
    menu:
        "Please select a class."
   
        "Fighter":
            $ combat += 20
            $ athletics += 20
            $ posture += 10
        
        "Doctor":
            $ medicine += 20
            $ alchemy += 20
            $ perception += 10
            
        "Thief":
            $ subterfuge += 20
            $ perception += 20
            $ athletics += 10
        
        "Arcanist":
            $ arcana += 20
            $ history += 20
            $ alchemy += 10

        "Seer":
            $ divination += 20
            $ perception += 20
            $ history += 10

        "Merchant":
            $ speech += 20
            $ etiquette += 20
            $ posture += 10

        "Artist":
            $ perception += 20
            $ posture += 20
            $ subterfuge += 10

    dr "I'm a dragon. Rawwwr bitches."
    
    "I was staring at a dragon. Holy shit."
    
    c "YOU ARE A DRAGON. HOLY. SHIT."
    
    dr "Yep. GIT IN MAH BELLEH."
    
    "I looked around, desperately looking for a way out. There was a sword nearby, maybe..."
    
    menu:
        "What should I do?"
        
        "Grab the sword and prepare for combat!":
            
            if combat >= 20:
                "I snatch up the blade and instantly take up a defensive stance."
            
            else:
                "I scramble for the blade, my body trembling."

                        
        
        "Plead for my life.":
            
            c "Please don't eat me. I don't taste very good."
        
        "Run away!":
            
            "I haul ass."
        
        "Cast a spell!" if arcana >=20: 
                        
            "I cast magic missile at the darkness."
        
        



    # 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

    $ todays =  daynames[(day%7)]
    
    # We may also want to compute the name for the day here, but
    # right now we don't bother.

    "It's day %(day)d. Today is [todays]."
    
    $ dp_period("Morning", "morning_act")
    if (day == 1 or day == 8):
        $ dp_choice("Attend Class1", "class01")
    if day == 2:
        $ dp_choice("Attend Class2", "class03")
    if day == 3:
        $ dp_choice("Attend Class3", "class05")
    if day == 4:
        $ dp_choice("Attend Class4", "class07")
    if day == 5:
        $ dp_choice("Attend Class5", "class09")
    if (day == 6 or day == 7):
        $ dp_choice("Something Else", "class05")
        
    # 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")

    $ dp_period ("Late Eve", "late_act")
    $ dp_choice ("Twiddle Thumbs", "twiddle")
    $ dp_choice ("Stare at ceiling", "stare")

    $ dp_period ("SunAM", "SunAM_act")
    $ dp_choice ("Attend Class1", "class01")

    $ dp_period ("SunNoon", "SunNoon_act")
    $ dp_choice("Study", "study")
    $ dp_choice("Hang Out", "hang")
        
        
    # 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
    $ late_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(["Morning", "Afternoon", "Evening", "Late Eve"])
        
        
    # 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

    # That's it for the morning, so we fall through to the
    # afternoon.

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"

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

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

    centered "Late Evening"

    $ period = "late_eve"
    $ act = late_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, so I decide 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
         

# This is a callback that is called by the day planner. 
label dp_callback:

    # Add in a line of dialogue asking the question that's on
    # everybody's mind.
    $ narrator("What should I do today?", interact=False)
    
    return

This is the day planner I have as it stands. Not too different from the stock.

Code: Select all

# This contains code for the new day planner. You probably
# don't want to change this file, but it might make sense to
# change many of the variables or styles defined here from
# other files.

# The frame containing the day planner.
style dp_frame is frame
 
# The frame and vbox containing a single choice. 
style dp_choice:
    xalign 0.5

style dp_choice is default:
    xalign 0.5
    
# Buttons    
style dp_choice_button is button
style dp_choice_button_text is button_text
    
# Labels    
style dp_label is label

init -100 python:

    # The title of the done button.
    dp_done_title = "Done Planning"

    # A map from period name to the information we know about that
    # period.
    __periods = { }

    # The period we're updating.
    __period = None
    
    class __Period(object):

        def __init__(self, name, var):
            self.name = name
            self.var = var
            self.acts = [ ]

    def dp_period(name, var):
        __periods[name] = store.__period = __Period(name, var)

    __None = object()
        
    def dp_choice(name, value=__None, enable="True", show="True"):

        if not __period:
            raise Exception("Choices must be part of a defined period.")

        if value is __None:
            value = name
        
        __period.acts.append((name, value, enable, show))

    def __set_noncurried(var, value):
        setattr(store, var, value)
        return True
        
    __set = renpy.curry(__set_noncurried)
        
# Our Day Planner displays the stats, and buttons for the user to choose what to do
# during each period of time defined in "periods".
screen day_planner(periods):
    # indicate to Ren'Py engine that this is a choice point
    $ renpy.choice_for_skipping()
    window:
        use display_stats(True, False, True, False)
        use display_planner(periods)            
            
screen display_planner(periods):            
    frame:
        style_group "dp"
        vbox:
            text "Day Planner" yalign 0.0 xalign 0.5
            vbox:
                $ can_continue = True
                for p in periods:
                    hbox:
                        label p
                        if p not in __periods:
                            $ raise Exception("Period %r was never defined." % p)
                        $ this_period = __periods[p]
                        $ selected_choice = getattr(store, this_period.var)

                        $ valid_choice = False
                        vbox:
                            style_group "dp_choice"
                            

                            for name, curr_val, enable, should_show in this_period.acts:
                                $ show_this = eval(should_show)
                                $ enable = eval(enable)

                                $ selected = (selected_choice == curr_val)
                        
                                if show_this:
                                    if enable:
                                        textbutton name action SetField(store, this_period.var, curr_val)
                                    else:
                                        textbutton name
            
                                if show_this and enable and selected:
                                    $ valid_choice = True

                            if not valid_choice:
                                $ can_continue = False
                                    
            if (can_continue):
                textbutton dp_done_title style "dp_done_button" action Return()
            else:
                textbutton dp_done_title style "dp_done_button"

My Events.

Code: Select all

# This file contains the events that will be part of the game. It's
# expected that the user will add and remove events as appropriate
# for this game.


# Some characters that are used in events in the game.
init:
    $ t = Character('Teacher')
    $ dr = Character('Dragon', color=(192, 255, 192, 255))
    $ c = Character('Cranberry', color=(255, 255, 192, 255))
    $ narrator = Character(' ')
    

init:
    # First up, we define some simple events for the various actions, that
    # are run only if no higher-priority event is about to occur.
    
    $ event("class01", "act == 'class01'", event.only(), priority=200)
    $ event("class02", "act == 'class02'", event.only(), priority=200)
    $ event("class03", "act == 'class03'", event.only(), priority=200)
    $ event("class04", "act == 'class04'", event.only(), priority=200)
    $ event("class05", "act == 'class05'", event.only(), priority=200)
    $ event("class06", "act == 'class06'", event.only(), priority=200)
    $ event("class07", "act == 'class07'", event.only(), priority=200)
    $ event("class08", "act == 'class08'", event.only(), priority=200)
    $ event("class09", "act == 'class09'", event.only(), priority=200)
    $ event("class10", "act == 'class10'", event.only(), priority=200)
    $ event("library", "act == 'library'", event.only(), priority=200)
 
    

        ### This is for the class-based events

label class01:

    "This is the class01 placeholder."
    
    return

label class02:

    "This is the class02 placeholder."
    
    return

label class03:

    "This is the class03 placeholder."
    
    return
    
label class04:

    "This is the class04 placeholder."
    
    return
    
label class05:

    "This is the class05 placeholder."
    
    return
    
label class06:

    "This is the class06 placeholder."
    
    return
    
label class07:

    "This is the class07 placeholder."
    
    return
    
label class08:

    "This is the class08 placeholder."
    
    return
    
label class09:

    "This is the class09 placeholder."
    
    return
    
label class10:

    "This is the class10 placeholder."
    
    return

        ### This is for the general areas to visit

label library:

    "This is the library placeholder. Praise Patchouli."
    
    return
    
label garden:

    "This is the garden placeholder. No zombies here."
    
    return
    
label cemetary:

    "This is the cemetary placeholder. Spoopy."
    
    return
    
label dojo:

    "This is the dojo placeholder. Hiyah!"
    
    return
    
label workshop:

    "This is the workshop placeholder. Much craft."
    
    return
    
label laboratory:

    "This is the laboratory placeholder. No meth in sight."
    
    return
    
label office:

    "This is the office placeholder. YOU IN TROUBLE NOW!"
    
    return
    

label ending:

    "THIS IS THE END. IF YOU ARE SEEING THIS EARLY YOU DONE MESSED UP."

    $ renpy.full_restart()
    

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

Re: DSE Uncaught Exception on first-time game load

#5 Post by E-l337 »

For anyone else who may be running into the same issue, I appear to have fixed the issue. Thanks to Gas who did point me in the right direction, and special thanks to Biomass in IRC for sitting down with me for a few hours to puzzle at just how weird the DSE framework can be sometimes.

The solution to this problem is pretty simple: Define the day variable at the start. Why this didn't work the first five times I tried it, I don't know, but your init python block should look a little something like this:

Code: Select all

init python:
    day = 1
    
    register_stat("Combat", "combat", 5, 250)
    register_stat("Athletics", "athletics", 5, 250)
    register_stat("Subterfuge", "subterfuge", 5, 250)
    register_stat("Alchemy", "alchemy", 5, 250)
    register_stat("Medicine", "medicine", 5, 250)
    register_stat("History", "history", 5, 250)
    register_stat("Speech", "speech", 5, 250)
    register_stat("Posture", "posture", 5, 250)
    register_stat("Etiquette", "etiquette", 5, 250)
    register_stat("Arcana", "arcana", 5, 250)
    register_stat("Divination", "divination", 5, 250)
    register_stat("Perception", "perception", 5, 250)

    dp_period("Morning", "morning_act")
    dp_choice("Attend Class1", "class01", show="day == 1 or day == 8")
    dp_choice("Attend Class2", "class03", show="day == 2")
    dp_choice("Attend Class3", "class05", show="day == 3")
    dp_choice("Attend Class4", "class07", show="day == 4")
    dp_choice("Attend Class5", "class09", show="day == 5")
    dp_choice("Something Else", "class05", show="day == 6 or day == 7 or EVDay == True")
        
    # 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", show="day == 2 or day == 8")
    dp_choice("Hang Out", "hang")

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

    dp_period ("Late Eve", "late_act")
    dp_choice ("Twiddle Thumbs", "twiddle")
    dp_choice ("Stare at ceiling", "stare")


# This is the entry point into the game.
label start:
I'm posting this here because try as I might I could find no examples of working code that showed how the Show value was supposed to be used in the DSE. This works.

Now I can finally move onto other problems. Thanks again to everyone for all their help!

(And for the record, I am well aware there are more elegant ways to make use of the show conditional. I was just in a hurry to get something that worked, which this does.)

Post Reply

Who is online

Users browsing this forum: No registered users