I have my main page of text, which is just an altered form of the DSE page.
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 theme.
init python:
register_stat("Charisma", "charisma", 10, 1000)
register_stat("Strength", "strength", 10, 1000)
register_stat("Intelligence", "intelligence", 10, 1000)
register_stat("Stability","stability", 10, 1000)
dp_period("Morning", "morning_act")
dp_choice("Attend Class", "class")
dp_choice("Visit Shopping District", "shop")
dp_choice("Go To Work", "work")
dp_choice("Order Groceries", "groceries")
dp_choice("Stay Home", "home")
dp_period("Afternoon", "afternoon_act")
dp_choice("Hit The Gym", "gym")
dp_choice("Visit The Park","park")
dp_choice("Go To Work","work")
dp_choice("Visit The Hot Springs","springs")
dp_choice("Order Groceries", "groceries")
dp_choice("Stay Home", "home")
dp_period("Evening", "evening_act")
dp_choice("Go For A Run", "run")
dp_choice("Visit The Hot Springs","springs")
dp_choice("Order Groceries", "groceries")
dp_choice("Stay Home", "home")
dp_choice("Hang Out", "hang")
dp_period("Night","night_act")
dp_choice("Visit The Club", "club")
dp_choice("Visit Late Night Café", "café")
dp_choice("Study", "study")
dp_choice("Order Groceries", "groceries")
dp_choice("Stay Home", "home")
# 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.
"In case you're just tuning in, here's the story of my life to
date."
"I'm a guy in the second year of high school."
"I'm not good at sports or school or even something as simple as
remembering peoples names."
"In short, I am your usual random loser guy."
"And this is my story..."
# 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 to him.
$ morning_act = None
$ afternoon_act = None
$ evening_act = None
$ night_act = None
# 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 day_planner(["Morning", "Afternoon", "Evening", "Night"])
# 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
# Ensure that the stats are in the proper range.
$ normalize_stats()
# 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
$ normalize_stats()
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
$ normalize_stats()
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"
$ period = "Night"
$ act = night_act
$ normalize_stats()
call events_run_period
"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. One of the
# uses of this is to show the statistics to the user.
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)
$ display_stats()
return
Code: Select all
# If you want to add schedules,
# you should change January, Feburary to 13, 14th month
# because for drawing a calendar, January and February is concidered as previous year's 13, 14th month.
# For example, if you want to add date like 2010,2,1 you should write like [2009, 14, 1]
init python:
week_day = ['sun', 'mon', 'tues', 'wed', 'thur', 'fri', 'sat'] #
year = 2009 #
month = 3 #
day = 2 # these variables are for your main game progressing.
schedules = [[2009,3,2,'enter']]
holiday_list=[ (2009,12,25) ] # This list is for drawing text to red color. You can add your own holiday list.
###############################################
## For test ##
###############################################
label start:
"I'll ask her..."
$ ui.vbox(xpos=.5, ypos=.75, xanchor =.5, yanchor=.5)
$ ui.textbutton('Today is %d. %d. %d. ' %(month, day,year))
$ ui.textbutton('See Calendar', ui.jumps('initializeForCal'))
$ ui.textbutton('Add Schedule', ui.jumps('setSchedule'))
$ ui.close()
$ ui.interact()
label setSchedule:
# if you want to add a special schedule, use this
# schedules.append([year,month,day, schedule name that you want to put on calendar])
if not schedules.count([2009,3,4,'date']):
$ schedules.append([2009,3,4,'date'])
"Set the schedule"
else:
"Schedule is already set"
jump start
#############################################
## Calendar ##
#############################################
label initializeForCal: # If you want to show a calendar, your button should call this label.
python:
yearForCal = year
monthForCal = month
todayWeek = 0
label calendar:
$ weekDayForCal = ['S', 'M', 'T', 'W', 'T', 'F', 'Sa']
python:
# Start drawing calendar
ui.frame(xminimum = 400, yminimum=550, xpos=.5, ypos=.5, xanchor = .5, yanchor=.5)
ui.vbox()
ui.hbox(xpos=.5, ypos=.5, xanchor = .5, yanchor=.5)
# Drawing date, prev, next button #########
if (yearForCal==2009 and monthForCal==3):
ui.textbutton("Prev")
else:
ui.textbutton("Prev", ui.returns(0))
if monthForCal>12:
ui.textbutton("%d. %d." %( yearForCal+1, monthForCal-12), xminimum=250)
else:
ui.textbutton("%d. %d." %( yearForCal, monthForCal), xminimum=250)
if (yearForCal==2011 and monthForCal==14):
ui.textbutton("Next")
else:
ui.textbutton("Next", ui.returns(1))
ui.close() #for hbox
# Drawing the day of weeks ####################
ui.hbox()
for weekd in weekDayForCal:
ui.frame()
ui.button(xminimum=50)
if weekd == "S":
ui.text("{color=#ff0000}"+weekd+"{/size}")
else:
ui.text(weekd)
ui.close() #for hbox
# The variables required for drawing date ############
num = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,31,28]
lastday= num[monthForCal]
if monthForCal == 2 or monthForCal == 1:
yearForCal-=1
monthForCal += 12
th = yearForCal / 100
yearC = yearForCal % 100
week = ((21 * th / 4) + (5 * yearC / 4) + (26 * (monthForCal + 1)) / 10) % 7
# These dates need 6 rows to draw calendar perfectly.
# So if there is years that you want to use in calendar,
# you have to check that days with another calendar and add its date here.
# In here, 2009.5 / 2009.8 / 2010.1 / 2010. 5 / 2010. 10 / 2011.1 / 2011. 7 / 2011. 10
# needs 6 row
if ((yearForCal==2009 and (monthForCal==5 or monthForCal == 8 or monthForCal ==13))
or (yearForCal==2010 and (monthForCal==5 or monthForCal==10 or monthForCal == 13))
or (yearForCal == 2011 and (monthForCal==7 or monthForCal==10))):
r=6
else:
r=5
count = 1
# Draw Calendar days ####################
for i in range(0, r):
ui.hbox()
for j in range(0,7):
if i == 0 and j < week: # Draw null before the first day of the month start
ui.frame()
ui.null(width=50)
todayWeek = i + 1
else:
todayWeek = todayWeek + 1
ui.frame()
ui.vbox()
if yearForCal==year and monthForCal == month and day ==count:
normal = RoundRect("#800") # Mark today in Calendar
else:
normal = RoundRect("#404040")
ui.button(xminimum=50, background = normal)
redMark = '#ffffff'
if todayWeek == 1 : # Sunday must be drawn in red
redMark = '#ff0000'
else:
for h_year, h_month, h_day in holiday_list: # Checking holidays and draw that day (text) in red color.
if h_year==yearForCal and h_month==monthForCal and h_day==count:
redMark = '#ff0000'
ui.text("%d" %count, color=redMark) # Draw day (text) for calendar
for y,m,d,s in schedules:
if y==yearForCal and m == monthForCal and d == count:
ui.text(s) # Check the added schedule and draw schedule name in bottom of day(text) button
ui.close() # for vbox
count+=1
if count > lastday:
ui.close()
todayWeek = 1
break
todayWeek = 0
ui.close()
ui.textbutton('return', ui.jumps('start'))
next = ui.interact()
if next:
if monthForCal >11 and not (monthForCal >=13) :
monthForCal = 1
yearForCal+=1
elif monthForCal==14:
monthForCal = 3
yearForCal+=1
else:
monthForCal +=1
else:
monthForCal-=1
call calendar
I don't get an error or anything, it just doesn't work. Any ideas where I'm going wrong?