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()