Inventory This is the complete source code of the example game Grammar.inf.
Back to List
Complete
Browsing Grammar.h
001 ! ----------------------------------------------------------------------------
002 ! GRAMMAR: Grammar table entries for the standard verbs library.
003 !
004 ! Supplied for use with Inform 6 Serial number 991113
005 ! Release 6/10
006 ! (c) Graham Nelson 1993, 1994, 1995, 1996, 1997, 1998, 1999
007 ! but freely usable (see manuals)
008 ! ----------------------------------------------------------------------------
009 ! The "meta-verbs", commands to the game rather than in the game, come first:
010 ! ----------------------------------------------------------------------------
011
012 System_file;
013
014 Verb meta 'score'
015 * -> Score;
016 Verb meta 'fullscore' 'full'
017 * -> FullScore
018 * 'score' -> FullScore;
019 Verb meta 'q//' 'quit' 'die'
020 * -> Quit;
021 Verb meta 'restore'
022 * -> Restore;
023 Verb meta 'restart'
024 * -> Restart;
025 Verb meta 'verify'
026 * -> Verify;
027 Verb meta 'save'
028 * -> Save;
029 Verb meta 'script' 'transcript'
030 * -> ScriptOn
031 * 'off' -> ScriptOff
032 * 'on' -> ScriptOn;
033 Verb meta 'noscript' 'unscript'
034 * -> ScriptOff;
035 Verb meta 'superbrief' 'short'
036 * -> LMode3;
037 Verb meta 'verbose' 'long'
038 * -> LMode2;
039 Verb meta 'brief' 'normal'
040 * -> LMode1;
041 Verb meta 'pronouns' 'nouns'
042 * -> Pronouns;
043 Verb meta 'notify'
044 * 'on' -> NotifyOn
045 * 'off' -> NotifyOff;
046 Verb meta 'version'
047 * -> Version;
048 #IFNDEF NO_PLACES;
049 Verb meta 'places'
050 * -> Places;
051 Verb meta 'objects'
052 * -> Objects;
053 #ENDIF;
054
055 ! ----------------------------------------------------------------------------
056 ! Debugging grammar
057 ! ----------------------------------------------------------------------------
058
059 #ifdef DEBUG;
060 Verb meta 'trace'
061 * -> TraceOn
062 * number -> TraceLevel
063 * 'on' -> TraceOn
064 * 'off' -> TraceOff;
065 Verb meta 'actions'
066 * -> ActionsOn
067 * 'on' -> ActionsOn
068 * 'off' -> ActionsOff;
069 Verb meta 'routines' 'messages'
070 * -> RoutinesOn
071 * 'on' -> RoutinesOn
072 * 'off' -> RoutinesOff;
073 Verb meta 'timers' 'daemons'
074 * -> TimersOn
075 * 'on' -> TimersOn
076 * 'off' -> TimersOff;
077 Verb meta 'changes'
078 * -> ChangesOn
079 * 'on' -> ChangesOn
080 * 'off' -> ChangesOff;
081 Verb meta 'recording'
082 * -> CommandsOn
083 * 'on' -> CommandsOn
084 * 'off' -> CommandsOff;
085 Verb meta 'replay'
086 * -> CommandsRead;
087 Verb meta 'random'
088 * -> Predictable;
089 Verb meta 'purloin'
090 * multi -> XPurloin;
091 Verb meta 'abstract'
092 * noun 'to' noun -> XAbstract;
093 Verb meta 'tree'
094 * -> XTree
095 * noun -> XTree;
096 Verb meta 'goto'
097 * number -> Goto;
098 Verb meta 'gonear'
099 * noun -> Gonear;
100 Verb meta 'scope'
101 * -> Scope
102 * noun -> Scope;
103 Verb meta 'showverb'
104 * special -> Showverb;
105 Verb meta 'showobj'
106 * -> Showobj
107 * multi -> Showobj;
108 #endif;
109
110 ! ----------------------------------------------------------------------------
111 ! And now the game verbs.
112 ! ----------------------------------------------------------------------------
113
114 Verb 'take' 'carry' 'hold'
115 * multi -> Take
116 * 'off' worn -> Disrobe
117 * multiinside 'from' noun -> Remove
118 * multiinside 'off' noun -> Remove
119 * 'inventory' -> Inv;
120 Verb 'get' * 'out'/'off'/'up' -> Exit
121 * multi -> Take
122 * 'in'/'into'/'on'/'onto' noun -> Enter
123 * 'off' noun -> GetOff
124 * multiinside 'from' noun -> Remove;
125 Verb 'pick'
126 * 'up' multi -> Take
127 * multi 'up' -> Take;
128 Verb 'stand'
129 * -> Exit
130 * 'up' -> Exit
131 * 'on' noun -> Enter;
132 Verb 'remove'
133 * held -> Disrobe
134 * multi -> Take
135 * multiinside 'from' noun -> Remove;
136 Verb 'shed' 'doff' 'disrobe'
137 * held -> Disrobe;
138 Verb 'wear' 'don'
139 * held -> Wear;
140 Verb 'put'
141 * multiexcept 'in'/'inside'/'into' noun
142 -> Insert
143 * multiexcept 'on'/'onto' noun -> PutOn
144 * 'on' held -> Wear
145 * 'down' multiheld -> Drop
146 * multiheld 'down' -> Drop;
147 Verb 'insert'
148 * multiexcept 'in'/'into' noun -> Insert;
149 Verb 'empty'
150 * noun -> Empty
151 * 'out' noun -> Empty
152 * noun 'out' -> Empty
153 * noun 'to'/'into'/'on'/'onto' noun
154 -> EmptyT;
155 Verb 'transfer'
156 * noun 'to' noun -> Transfer;
157 Verb 'drop' 'throw' 'discard'
158 * multiheld -> Drop
159 * multiexcept 'in'/'into'/'down' noun
160 -> Insert
161 * multiexcept 'on'/'onto' noun -> PutOn
162 * held 'at'/'against'/'on'/'onto' noun
163 -> ThrowAt;
164 Verb 'give' 'pay' 'offer' 'feed'
165 * held 'to' creature -> Give
166 * creature held -> Give reverse
167 * 'over' held 'to' creature -> Give;
168 Verb 'show' 'present' 'display'
169 * creature held -> Show reverse
170 * held 'to' creature -> Show;
171 [ ADirection; if (noun in compass) rtrue; rfalse; ];
172 Verb 'go' 'walk' 'run'
173 * -> VagueGo
174 * noun=ADirection -> Go
175 * noun -> Enter
176 * 'into'/'in'/'inside'/'through' noun
177 -> Enter;
178 Verb 'leave'
179 * -> VagueGo
180 * noun=ADirection -> Go
181 * noun -> Exit
182 * 'into'/'in'/'inside'/'through' noun
183 -> Enter;
184 Verb 'inventory' 'inv' 'i//'
185 * -> Inv
186 * 'tall' -> InvTall
187 * 'wide' -> InvWide;
188 Verb 'look' 'l//'
189 * -> Look
190 * 'at' noun -> Examine
191 * 'inside'/'in'/'into'/'through' noun
192 -> Search
193 * 'under' noun -> LookUnder
194 * 'up' topic 'in' noun -> Consult;
195 Verb 'consult' * noun 'about' topic -> Consult
196 * noun 'on' topic -> Consult;
197 Verb 'open' 'unwrap' 'uncover' 'undo'
198 * noun -> Open
199 * noun 'with' held -> Unlock;
200 Verb 'close' 'shut' 'cover'
201 * noun -> Close
202 * 'up' noun -> Close
203 * 'off' noun -> SwitchOff;
204 Verb 'enter' 'cross'
205 * -> GoIn
206 * noun -> Enter;
207 Verb 'sit' 'lie'
208 * 'on' 'top' 'of' noun -> Enter
209 * 'on'/'in'/'inside' noun -> Enter;
210 Verb 'in' 'inside'
211 * -> GoIn;
212 Verb 'exit' 'out' 'outside'
213 * -> Exit;
214 Verb 'examine' 'x//' 'watch' 'describe' 'check'
215 * noun -> Examine;
216 Verb 'read'
217 * noun -> Examine
218 * 'about' topic 'in' noun -> Consult
219 * topic 'in' noun -> Consult;
220 Verb 'yes' 'y//'
221 * -> Yes;
222 Verb 'no'
223 * -> No;
224 Verb 'sorry'
225 * -> Sorry;
226 Verb 'shit' 'fuck' 'damn' 'sod'
227 * -> Strong
228 * topic -> Strong;
229 Verb 'bother' 'curses' 'drat' 'darn'
230 * -> Mild
231 * topic -> Mild;
232 Verb 'search'
233 * noun -> Search;
234 Verb 'wave'
235 * -> WaveHands
236 * noun -> Wave;
237 Verb 'set' 'adjust'
238 * noun -> Set
239 * noun 'to' special -> SetTo;
240 Verb 'pull' 'drag'
241 * noun -> Pull;
242 Verb 'push' 'move' 'shift' 'clear' 'press'
243 * noun -> Push
244 * noun noun -> PushDir
245 * noun 'to' noun -> Transfer;
246 Verb 'turn' 'rotate' 'twist' 'unscrew' 'screw'
247 * noun -> Turn
248 * noun 'on' -> Switchon
249 * noun 'off' -> Switchoff
250 * 'on' noun -> Switchon
251 * 'off' noun -> Switchoff;
252 Verb 'switch'
253 * noun -> Switchon
254 * noun 'on' -> Switchon
255 * noun 'off' -> Switchoff
256 * 'on' noun -> Switchon
257 * 'off' noun -> Switchoff;
258 Verb 'lock'
259 * noun 'with' held -> Lock;
260 Verb 'unlock'
261 * noun 'with' held -> Unlock;
262 Verb 'attack' 'break' 'smash' 'hit' 'fight' 'wreck' 'crack'
263 'destroy' 'murder' 'kill' 'torture' 'punch' 'thump'
264 * noun -> Attack;
265 Verb 'wait' 'z//'
266 * -> Wait;
267 Verb 'answer' 'say' 'shout' 'speak'
268 * topic 'to' creature -> Answer;
269 Verb 'tell'
270 * creature 'about' topic -> Tell;
271 Verb 'ask'
272 * creature 'about' topic -> Ask
273 * creature 'for' noun -> AskFor;
274 Verb 'eat'
275 * held -> Eat;
276 Verb 'sleep' 'nap'
277 * -> Sleep;
278 Verb 'peel'
279 * noun -> Take
280 * 'off' noun -> Take;
281 Verb 'sing'
282 * -> Sing;
283 Verb 'climb' 'scale'
284 * noun -> Climb
285 * 'up'/'over' noun -> Climb;
286 Verb 'buy' 'purchase'
287 * noun -> Buy;
288 Verb 'squeeze' 'squash'
289 * noun -> Squeeze;
290 Verb 'swim' 'dive'
291 * -> Swim;
292 Verb 'swing'
293 * noun -> Swing
294 * 'on' noun -> Swing;
295 Verb 'blow'
296 * held -> Blow;
297 Verb 'pray'
298 * -> Pray;
299 Verb 'wake' 'awake' 'awaken'
300 * -> Wake
301 * 'up' -> Wake
302 * creature -> WakeOther
303 * creature 'up' -> WakeOther
304 * 'up' creature -> WakeOther;
305 Verb 'kiss' 'embrace' 'hug'
306 * creature -> Kiss;
307 Verb 'think'
308 * -> Think;
309 Verb 'smell' 'sniff'
310 * -> Smell
311 * noun -> Smell;
312 Verb 'hear' 'listen'
313 * -> Listen
314 * noun -> Listen
315 * 'to' noun -> Listen;
316 Verb 'taste'
317 * noun -> Taste;
318 Verb 'touch' 'fondle' 'feel' 'grope'
319 * noun -> Touch;
320 Verb 'rub' 'shine' 'polish' 'sweep' 'clean' 'dust' 'wipe' 'scrub'
321 * noun -> Rub;
322 Verb 'tie' 'attach' 'fasten' 'fix'
323 * noun -> Tie
324 * noun 'to' noun -> Tie;
325 Verb 'burn' 'light'
326 * noun -> Burn
327 * noun 'with' held -> Burn;
328 Verb 'drink' 'swallow' 'sip'
329 * noun -> Drink;
330 Verb 'fill'
331 * noun -> Fill;
332 Verb 'cut' 'slice' 'prune' 'chop'
333 * noun -> Cut;
334 Verb 'jump' 'skip' 'hop'
335 * -> Jump
336 * 'over' noun -> JumpOver;
337 Verb 'dig' * noun -> Dig
338 * noun 'with' held -> Dig;
339 ! ----------------------------------------------------------------------------
340 ! This routine is no longer used here, but provided to help existing games
341 ! which use it as a general parsing routine:
342
343 [ ConTopic w; consult_from = wn;
344 do w=NextWordStopped();
345 until (w==-1 || (w=='to' && action_to_be==##Answer));
346 wn--;
347 consult_words = wn-consult_from;
348 if (consult_words==0) return -1;
349 if (action_to_be==##Ask or ##Answer or ##Tell)
350 { w=wn; wn=consult_from; parsed_number=NextWord();
351 if (parsed_number=='the' && consult_words>1) parsed_number=NextWord();
352 wn=w; return 1;
353 }
354 return 0;
355 ];
356 ! ----------------------------------------------------------------------------
357 ! Final task: provide trivial routines if the user hasn't already:
358 ! ----------------------------------------------------------------------------
359 #Stub TimePasses 0;
360 #Stub Amusing 0;
361 #Stub DeathMessage 0;
362 #Stub DarkToDark 0;
363 #Stub NewRoom 0;
364 #Stub LookRoutine 0;
365 #Stub AfterLife 0;
366 #Stub GamePreRoutine 0;
367 #Stub GamePostRoutine 0;
368 #Stub AfterPrompt 0;
369 #Stub BeforeParsing 0;
370 #Stub PrintTaskName 1;
371 #Stub InScope 1;
372 #Stub UnknownVerb 1;
373 #Stub PrintVerb 1;
374 #Stub ParserError 1;
375 #Stub ParseNumber 2;
376 #Stub ChooseObjects 2;
377 #IFNDEF PrintRank;
378 Constant Make__PR;
379 #ENDIF;
380 #IFDEF Make__PR;
381 [ PrintRank; "."; ];
382 #ENDIF;
383 #IFNDEF ParseNoun;
384 Constant Make__PN;
385 #ENDIF;
386 #IFDEF Make__PN;
387 [ ParseNoun obj; obj=obj; return -1; ];
388 #ENDIF;
389 #Default Story 0;
390 #Default Headline 0;
391 #IFDEF INFIX;
392 #Include "infix";
393 #ENDIF;
394 ! ----------------------------------------------------------------------------
Last updated 27 February 2004.
This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation.
Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.