~ubuntu-branches/ubuntu/vivid/inform/vivid

« back to all changes in this revision

Viewing changes to tutor/house02.inf

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-05-26 22:09:44 UTC
  • mfrom: (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526220944-ba7phz0d1k4vo7wx
Tags: 6.31.1+dfsg-1
* Remove a considerable number of files from the package
  due to unacceptable licensing terms.
* Repair library symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
! ------------------------------------------------------------------------------
2
 
! Inform for New Writers
3
 
!
4
 
! The House - Version 2
5
 
!
6
 
! Last Modified: David Cornelson - 04-Jan-1998
7
 
!
8
 
! ------------------------------------------------------------------------------
9
 
 
10
 
Constant Story "The House";
11
 
 
12
 
Constant Headline
13
 
           "^Inform for New Writers^
14
 
             The House - Version 2^
15
 
             By New Writer (1998) - Last Compiled: 04-Jan-1998^";
16
 
 
17
 
Constant MAX_SCORE 100;
18
 
Serial "980104";
19
 
 
20
 
Release 1;
21
 
 
22
 
Include "Parser";
23
 
Include "VerbLib";
24
 
 
25
 
!-------------------------------------------------------------------------------
26
 
! Initialise
27
 
!
28
 
!-------------------------------------------------------------------------------
29
 
 
30
 
[ Initialise;
31
 
 
32
 
  location = Sidewalk;
33
 
 
34
 
];
35
 
 
36
 
[ PrintRank;
37
 
  print ", earning you the rank of ";
38
 
  if (score >= 100) "the greatest.";
39
 
  if (score >= 80) "above average.";
40
 
  if (score >= 60) "average.";
41
 
  if (score >= 40) "below average.";
42
 
  if (score >= 20) "the barely living.";
43
 
  "the living dead.";
44
 
];
45
 
 
46
 
! ----------------------------------------------------------------------------
47
 
! Locations
48
 
!
49
 
! In this section we will define our locations. These are "Objects" to Inform
50
 
! and contain the following elements.
51
 
!
52
 
! - object name
53
 
!   The object name represents the variable or handle of the object.
54
 
! - short description
55
 
!   The short description is the description printed in bold before the
56
 
!   normal description.
57
 
! - initial description
58
 
!   The initial description is printed only once when the location is first
59
 
!   entered by the player.
60
 
! - normal description
61
 
!   The normal description is printed everytime the player enters the location.
62
 
! - directional properties (tells which direction player can move) (optional)
63
 
!   These include n_to, ne_to, e_to, up_to, in_to, etc. and are followed by
64
 
!   another location object name.
65
 
! - properties
66
 
!   Properties are functions that you can add to an object that help determine
67
 
!   events and actions.
68
 
! - attributes
69
 
!   Attributes are True/False values that help you remember certain states of
70
 
!   an object or event, such as whether the lights are on or not. The positive
71
 
!   value is represented as "light" and the negative would be "~light". There
72
 
!   are standard attributes used by Inform and you can add your own as well.
73
 
!
74
 
! Actually, there's more than this, but we'll add the complicated stuff later!
75
 
!
76
 
! ----------------------------------------------------------------------------
77
 
 
78
 
Object Sidewalk "Sidewalk"
79
 
    with  description
80
 
          "You are standing on the sidewalk in front of a house to the west.",
81
 
    w_to  Front_Porch,
82
 
    has   light;
83
 
 
84
 
!
85
 
! VERSION 2 - Adding more locations to your Inform program
86
 
!
87
 
! We're going to take one small step in this version. Let's add a bunch of
88
 
! locations so that the player can move around a little bit.
89
 
!
90
 
! Notice that in the Sidewalk Object definition we added a direction in the
91
 
! description "to the west" and we added the directional property "w_to"
92
 
! that leads to the "Front_Porch" location that we defined below.
93
 
!
94
 
! If you follow these examples you will see how locations are "connected"
95
 
! or "mapped" together with the directional properties. Feel free to change
96
 
! then around so that they connect in different ways.
97
 
!
98
 
! Q: In the "Front_Porch" definition, the description continues over two
99
 
!    lines. Is this okay?
100
 
!
101
 
! A: Inform allows you to extend statements over multiple lines as you
102
 
!    need. You may need to write code that extends over multiple lines
103
 
!    but mostly it will be descriptions as in "Front_Porch". You don't
104
 
!    need to add any extra characters to tell Inform that you've jumped
105
 
!    to the next line either...Inform will figure that out when it compiles.
106
 
!
107
 
 
108
 
Object Front_Porch "Front Porch"
109
 
    with  description
110
 
          "This is the front porch of the house. There is an open door
111
 
           leading inside to the west.",
112
 
    e_to  Sidewalk,
113
 
    w_to  Foyer,
114
 
    in_to Foyer,
115
 
    has   light;
116
 
 
117
 
Object Foyer "Foyer"
118
 
    with  description
119
 
          "You are standing in the foyer of the house. It seems as though
120
 
           you can go up a staircase, northwest, or back out the front
121
 
           door to the east.",
122
 
    out_to Front_Porch,
123
 
    e_to   Front_Porch,
124
 
    nw_to  Hallway,
125
 
    u_to   Upper_Hallway,
126
 
    has    light;
127
 
 
128
 
Object Hallway "Hallway"
129
 
    with   description
130
 
           "You are in the hallway on the first floor of the house. The
131
 
            foyer is southeast and the kitchen is west of here.",
132
 
    se_to  Foyer,
133
 
    w_to   Kitchen,
134
 
    has    light;
135
 
 
136
 
Object Kitchen "Kitchen"
137
 
    with   description
138
 
           "This is the kitchen of the house. A hallway can be seen to the
139
 
            east.",
140
 
    e_to   Hallway,
141
 
    has    light;
142
 
 
143
 
Object Upper_Hallway "Upper Hallway"
144
 
    with   description
145
 
           "This is the second floor hallway. Rooms can be seen north and
146
 
            south and a staircase leads down.",
147
 
    n_to   North_Bedroom,
148
 
    s_to   South_Bedroom,
149
 
    d_to   Foyer,
150
 
    has    light;
151
 
 
152
 
Object North_Bedroom "North Bedroom"
153
 
    with   description
154
 
           "This is a bedroom on the north side of the house.",
155
 
    s_to   Upper_Hallway,
156
 
    has    light;
157
 
 
158
 
Object South_Bedroom "South Bedroom"
159
 
    with   description
160
 
           "This is a bedroom on the south side of the house.",
161
 
    n_to   Upper_Hallway,
162
 
    has    light;
163
 
 
164
 
! ----------------------------------------------------------------------------
165
 
! Grammar
166
 
!
167
 
! The grammar section includes the file "Grammar" and will later include
168
 
! extensions to the standard grammar library.
169
 
!
170
 
! ----------------------------------------------------------------------------
171
 
 
172
 
Include "Grammar";
173
 
 
174
 
! ----------------------------------------------------------------------------
175
 
! Compilation Results
176
 
! ----------------------------------------------------------------------------
177
 
! Command: INFRMW32 -J HOUSE02.INF
178
 
!
179
 
! PC/Win32 Inform 6.14 (8th September 1997)
180
 
!   6 "compass"
181
 
!   7 "north wall"
182
 
!   8 "south wall"
183
 
!   9 "east wall"
184
 
!  10 "west wall"
185
 
!  11 "northeast wall"
186
 
!  12 "northwest wall"
187
 
!  13 "southeast wall"
188
 
!  14 "southwest wall"
189
 
!  15 "ceiling"
190
 
!  16 "floor"
191
 
!  17 "outside"
192
 
!  18 "inside"
193
 
!  19 "(darkness object)"
194
 
!  20 "(self object)"
195
 
!  21 "(Inform Parser)"
196
 
!  22 "(Inform Library)"
197
 
!  23 "(with no short name)"
198
 
!  24 "Sidewalk"
199
 
!  25 "Front Porch"
200
 
!  26 "Foyer"
201
 
!  27 "Hallway"
202
 
!  28 "Kitchen"
203
 
!  29 "Upper Hallway"
204
 
!  30 "North Bedroom"
205
 
!  31 "South Bedroom"