-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLearningZIL.lyx
More file actions
13509 lines (9823 loc) · 272 KB
/
LearningZIL.lyx
File metadata and controls
13509 lines (9823 loc) · 272 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass scrbook
\options openany
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "cmtt" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures false
\graphics default
\default_output_format pdf2
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref true
\pdf_title "Learning ZIL"
\pdf_author "Steven Eric Meretzky"
\pdf_subject "Everything You Always Wanted to KnowAbout Writing Interactive FictionBut Couldn't Find Anyone Still Working Here to Ask"
\pdf_keywords "Infocom ZIL Zork IF IntFiction Interactive Fiction"
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder true
\pdf_colorlinks false
\pdf_backref false
\pdf_pdfusetitle true
\papersize a4paper
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 2.5cm
\topmargin 2cm
\rightmargin 2cm
\bottommargin 2cm
\headheight 1cm
\headsep 0.5cm
\footskip 1cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 2
\paperpagestyle fancy
\listings_params "xleftmargin=25pt"
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Title
Learning ZIL
\end_layout
\begin_layout Subtitle
or
\begin_inset Newline newline
\end_inset
\begin_inset space ~
\end_inset
\begin_inset Newline newline
\end_inset
Everything You Always Wanted to Know
\begin_inset Newline newline
\end_inset
About Writing Interactive Fiction
\begin_inset Newline newline
\end_inset
But Couldn't Find Anyone Still Working Here to Ask
\end_layout
\begin_layout Author
Steven Eric Meretzky (SEM)
\end_layout
\begin_layout Date
8/1/95
\end_layout
\begin_layout Publishers
Copyright ©1989 Infocom, Inc.
\begin_inset Newline newline
\end_inset
For internal use only.
\begin_inset Newline newline
\end_inset
Comments to SEM
\end_layout
\begin_layout Standard
\begin_inset CommandInset toc
LatexCommand tableofcontents
\end_inset
\end_layout
\begin_layout Chapter
The Basics
\end_layout
\begin_layout Section
The Basic Ingredients
\end_layout
\begin_layout Standard
When you write interactive fiction (hereafter IF), you will mostly be dealing
with two kinds of things: objects and routines.
There are two major categories of objects: rooms (such as the Living Room
in
\emph on
\noun on
Zork I
\emph default
\noun default
or Joe's Bar in
\emph on
\noun on
Leather Goddesses
\emph default
\noun default
), and objects you can refer to, such as the brass lantern in
\emph on
\noun on
Zork I
\emph default
\noun default
or the dressing gown in
\emph on
\noun on
Hitchhiker's Guide
\emph default
\noun default
.
\end_layout
\begin_layout Standard
Routines are little sub-programs which perform a whole variety of functions.
There are many kinds of routines, but the kind you'll be concerned with
first are called action routines.
These are directly linked to a room or object.
Much more detail on objects and routines in subsequent chapters.
\end_layout
\begin_layout Section
The Handler
\end_layout
\begin_layout Standard
In IF, the player types an input, and the game must produce a response:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
>HIT UNCLE OTTO WITH THE HAMMER
\end_layout
\begin_layout Plain Layout
You knock some sense back into Uncle Otto, and he stops
\end_layout
\begin_layout Plain Layout
insisting that he's Napoleon Bonaparte.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Somewhere, the game decided to print that response.
The part of the game that printed that response is said to have handled
the input.
The input must be handled at some point; a non-response is always a no-no:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
>UNCLE OTTO, REMOVE YOUR HAND FROM YOUR SHIRT
\end_layout
\begin_layout Plain Layout
>
\end_layout
\end_inset
\end_layout
\begin_layout Section
The Parser's Role
\end_layout
\begin_layout Standard
There's a notorious part of every IF program called the parser.
It gets the first look at the input.
If it decides that the input is indecipherable, for any of several reasons,
it handles the input.
For example:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
>EXAMINE THE FLEECY CLOUD
\end_layout
\begin_layout Plain Layout
[I don't know the word "fleecy."]
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
>ASK UNCLE OTTO ABOUT MOSCOW AND WATERLOO
\end_layout
\begin_layout Plain Layout
[You can't use multiple objects with the verb "ask."]
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Cases like these are called parser failures.
(This is not to be confused with those times when the parser fails, which
are called parser bugs.)
\end_layout
\begin_layout Standard
If the parser succeeds in digesting the input, it passes three pieces of
information on to the rest of the program: the verb, the direct object,
and the indirect object.
Internally, these are called PRSA, PRSO, and PRSI.
In the first example in section 1.1, PRSA is HIT, PRSO is the UNCLE OTTO
object, and PRSI is the HAMMER object.
\end_layout
\begin_layout Standard
Not every input has a PRSI.
For example, in:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
>CALL THE FUNNY FARM
\end_layout
\begin_layout Plain Layout
Men in white coats arrive and hustle Uncle Otto into
\end_layout
\begin_layout Plain Layout
the wagon.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
the verb is CALL and the PRSO is the FUNNY FARM object.
In such a case, when there is no PRSI, the parser sets the value of PRSI
to false.
Furthermore, not every input has a PRSO.
Some examples of inputs where PRSO and PRSI are both false:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
>YELL
\end_layout
\begin_layout Plain Layout
>PANIC
\end_layout
\begin_layout Plain Layout
>INVENTORY
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Note that you cannot have a PRSI without also having a PRSO.
Also note that every input has a PRSA.
\end_layout
\begin_layout Section
The Basic Handling Sequence
\end_layout
\begin_layout Standard
After the parser identifies PRSA, PRSO, and PRSI, the game gets to decide
who will handle the input.
By convention, PRSI gets the first crack (providing there is a PRSI, of
course).
\end_layout
\begin_layout Standard
What this means, is that if PRSI has an associated object action routine,
that action routine tries to handle the input.
If it does so, the current turn is considered to be complete.
If not, then the PRSO's action routine is given the opportunity next.
The PRSO and PRSI routines can give very specific responses to the input.
\end_layout
\begin_layout Standard
If the PRSO also fails to handle the input, the task falls to the routine
associated with the verb.
Because such a routine is the "last resort," and since it usually gives
a very general response, it is called the default response.
Here's an example of how the response to an input might look depending
on who handled it:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
>HIT THE OAK CHEST WITH THE CROWBAR
\end_layout
\begin_layout Plain Layout
The crowbar bends! It appears to be made of rubber, not
\end_layout
\begin_layout Plain Layout
iron!
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\lang ngerman
\begin_inset Formula $\rightarrow$
\end_inset
\lang english
(handled by PRSI's action routine)
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
The sound of the impact reverberates inside the chest.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\lang ngerman
\begin_inset Formula $\rightarrow$
\end_inset
\lang english
(handled by the PRSO's action routine)
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
Hitting the oak chest accomplishes nothing.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\lang ngerman
\begin_inset Formula $\rightarrow$
\end_inset
\lang english
(handled by the verb default)
\end_layout
\begin_layout Standard
\begin_inset VSpace defskip
\end_inset
As you can see, the verb default is the least interesting and "colorful"
of the responses.
Of course, there's not enough space on the disk or time in the schedule
to give every possible input its own special response; a good implementor
must find the proper balance, deciding when to write a special colorful
response, and when to let the relatively drab verb default do the handling.
\end_layout
\begin_layout Standard
There are other places where the game gets a chance to handle the input,
but we'll get to that later on.
\end_layout
\begin_layout Chapter
Creating Rooms
\end_layout
\begin_layout Section
What a Typical Room Definition Looks Like
\end_layout
\begin_layout Standard
Here's what the definition of the Living Room from Zork I looks like:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
<ROOM LIVING-ROOM
\end_layout
\begin_layout Plain Layout
(LOC ROOMS)
\end_layout
\begin_layout Plain Layout
(DESC "Living Room")
\end_layout
\begin_layout Plain Layout
(EAST TO KITCHEN)
\end_layout
\begin_layout Plain Layout
(WEST TO STRANGE-PASSAGE IF CYCLOPS-FLED ELSE
\end_layout
\begin_layout Plain Layout
"The wooden door is nailed shut.")
\end_layout
\begin_layout Plain Layout
(DOWN PER TRAP-DOOR-EXIT)
\end_layout
\begin_layout Plain Layout
(ACTION LIVING-ROOM-F)
\end_layout
\begin_layout Plain Layout
(FLAGS RLANDBIT ONBIT SACREDBIT)
\end_layout
\begin_layout Plain Layout
(GLOBAL STAIRS)
\end_layout
\begin_layout Plain Layout
(THINGS <> NAILS NAILS-PSEUDO)>
\end_layout
\end_inset
\end_layout
\begin_layout Standard
Note that, as with everything you will ever write in ZIL, the parentheses
and angle brackets are balanced.
\end_layout
\begin_layout Standard
Let's go over this room definition line by line.
The first thing in a room definition is the word ROOM followed by the internal
name of the room.
This name, like all names of objects or routines in ZIL, must be one word
(or, if more than one word, connected by hyphens) and must be all capital
letters.
\end_layout
\begin_layout Standard
The second line, LOC, gives its internal location.
All rooms are located in a special object called the ROOMS object.
\end_layout
\begin_layout Standard
The third line is the external name of the room, its DESC.
This is what will appear in the output each time a player enters that room.
Note: The internal and external names of a room (or object) do not need
to be identical.
For example, there's no reason the internal name couldn't be LIV-ROOM.
It's up to the author.
Usually, it's a trade-off: using the same name makes it easier to remember
the internal name, but it means more typing.
\end_layout
\begin_layout Section
Exits
\end_layout
\begin_layout Standard
The next several lines are all the exits from the Living Room.
In general, the bulk of a room definition is its exits.
The fourth line, (EAST TO KITCHEN), is an example of the simplest kind
of exit, called a UEXIT (for unconditional exit).
This means that when the player is in the Living Room and types EAST, the
player will go to the Kitchen — in all cases.
\end_layout
\begin_layout Standard
The fifth line is a CEXIT (for conditional exit).
If involves a global called CYCLOPS-FLED.
A global is the simplest way that you store a piece of information in ZIL.
(See section 5.2 and section 7.2.) In this case, CYCLOPSFLED is either true
or false depending on whether the cyclops has made a hole in the oak door.
What this CEXIT means is that when the player types WEST, the player will
be sent to Strange Passage if the global CYCLOPS-FLED is true.
If CYCLOPS-FLED is false, the player will be told "The door is nailed shut."
This piece of text inside quotes is called a string.
The string is not required for a CEXIT; if it is omitted, the game will
supply a default string like "You can't go that way."
\end_layout
\begin_layout Standard
The sixth line is an example of an FEXIT (for function exit).
(Function is another word for routine.) The game will recognize this line
as an FEXIT because of the "PER." In this case, if the player types DOWN,
the routine called TRAP-DOOREXIT decides if the player can move, and if
so, to where, and if not, what the response should be.
In this case, it will say "You can't go that way." if you haven't moved
the rug, or "The trap door is closed." if you have moved the rug but haven't
opened the trap door.
\end_layout
\begin_layout Standard
There are two other types of exits, which don't happen to be used by the
Living Room in Zork I.
The NEXIT (for non-exit) is simply a direction in which you can never go,
but for which you want something more interesting than the default "You
can't go that way." response.
The game will recognize it as an NEXIT because of the use of "SORRY." It
might look something like this:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
(NW SORRY "The soldier at Uncle Otto's front door
\end_layout
\begin_layout Plain Layout
informs you that only Emperor Bonaparte is allowed
\end_layout
\begin_layout Plain Layout
through.")
\end_layout
\end_inset
\end_layout
\begin_layout Standard
The other is the DEXIT (for door exit).
This is similar to the CEXIT, substituting the condition of a door object
for the global.
It might look something like this.
Note the "IS OPEN" which isn't found in a CEXIT:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
(SOUTH TO GARAGE IF GARAGE-DOOR IS OPEN ELSE
\end_layout
\begin_layout Plain Layout
"You ought to use the garage door opener.")
\end_layout
\end_inset
\end_layout
\begin_layout Standard
If the GARAGE-DOOR object is open, and the player types SOUTH, you'll end
up in the GARAGE.
Else, the player will be told the string.
Once again, the string is optional.
If no string is supplied, the response will be something like "You'll have
to open the garage door, first."
\end_layout
\begin_layout Section
Other Parts of a Room Definition
\end_layout
\begin_layout Standard
Getting back to the Living Room example, the next line defines the room's
action routine, LIVING-ROOM-F.
(The F at the end is short for "function.") You'll hear (a lot) more about
a room's action routine in a while.
\end_layout
\begin_layout Standard
The next line contains those FLAGS which are applicable to this room.
RLANDBIT (the R is for "room") means that the room is on dry land, rather
than water (such as the Reservoir) or in the air (such as the volcano rooms
in Zork II).
ONBIT means that the room is always lit.
Some flag names appear in every game; but you can make up special ones
to fit the requirements of your own game.
For example, SACREDBIT is special to Zork I, and means that the thief never
visits this room.
By convention, all flag names end with "BIT." For a complete list of commonly
used flags, see Appendix B.
\end_layout
\begin_layout Standard
Forget about the GLOBAL and THINGS lines for now.
You'll learn about the GLOBAL property in section 7.4, and can read about
THINGS in Appendix A.
All these things — EAST, UP, FLAGS, ACTION, etc.
— are called properties.
As you'll see in a moment, objects have properties as well; some are the
same as the properties that rooms have, but some are different.
Although most properties are the same from game to game, you may occasionally
want to create your own.
For a complete list of commonly used properties, see the Appendix A.
\end_layout
\begin_layout Chapter
Creating Objects
\end_layout
\begin_layout Section
What an Object Definition Looks Like
\end_layout
\begin_layout Standard
Here's what the definition of Zork I's brass lantern looks like:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
<OBJECT LANTERN
\end_layout
\begin_layout Plain Layout
(LOC LIVING-ROOM)
\end_layout
\begin_layout Plain Layout
(SYNONYM LAMP LANTERN LIGHT)
\end_layout
\begin_layout Plain Layout
(ADJECTIVE BRASS)
\end_layout
\begin_layout Plain Layout
(DESC "brass lantern")
\end_layout
\begin_layout Plain Layout
(FLAGS TAKEBIT LIGHTBIT)
\end_layout
\begin_layout Plain Layout
(ACTION LANTERN-F)
\end_layout
\begin_layout Plain Layout
(FDESC "A battery-powered lantern is on the trophy
\end_layout
\begin_layout Plain Layout
case.")
\end_layout
\begin_layout Plain Layout
(LDESC "There is a brass lantern (battery-powered)
\end_layout
\begin_layout Plain Layout
here.")
\end_layout
\begin_layout Plain Layout
(SIZE 15)>
\end_layout
\end_inset
\end_layout
\begin_layout Standard
As you can see, there are some properties which appeared in the room example,
but some new ones as well.
\end_layout
\begin_layout Section
Object properties
\end_layout
\begin_layout Standard
LOC refers to the location of the object at the start of the game.
In this case, the location of the lamp is in the Living Room room.
Over the course of the game, the location of objects may change as the
player does stuff.
For example, if the player picked up the lamp, the LOC of the lamp would
then be the PLAYER (sometimes called PROTAGONIST) object.
If the player then dropped the lamp in the Kitchen, the Kitchen room would
be the lamp's LOC.
\end_layout
\begin_layout Standard
The SYNONYM property is a list of all those nouns which can be used to refer
to the lamp.
The ADJECTIVE property is a list of those adjectives which can be used
to refer to the lamp.
An object, to be referred to, must have at least one synonym; the ADJECTIVE
property is optional.
In the case of the lamp, the player could refer to it using any of six
combinations: lamp, lantern, light, brass lamp, brass lantern, brass light.
\end_layout
\begin_layout Standard
The DESC property, as with rooms, is the name of the object for external
consumption.
It will appear whenever a routine needs to "plug in" the name of the object.
For example, the EAT verb default would use it to form the output: "I doubt
the brass lantern would agree with you."
\end_layout
\begin_layout Standard
The lamp has two flags: the TAKEBIT means that the lamp can be picked up
by the player; the LIGHTBIT means that the lamp can be lit.
The lamp is not currently on; once it gets turned on, it will have the
ONBIT, meaning that it is giving off light.
The flags in the object definition are only those attributes which the
object has at the start of the game.
\end_layout
\begin_layout Standard
The ACTION property identifies LANTERN-F as the action routine which tries
to handle inputs relating to the lantern.
For example, if the player typed THROW THE NERF BALL AT THE BRASS LANTERN,
the LAMP object would be the PRSI, and the routine LANTERN-F would get
the first crack at handling the input.
If the player typed THROW THE BRASS LANTERN AT THE NERF BALL, then the
LAMP object would be the PRSO, and LANTERN-F would get a crack at handling
the input provided that the nerf ball's action routine failed to do so.
The FDESC property is a string which is used to describe the brass lantern
until the player picks it up for the first time; in other words, it describes
its original state.
The LDESC property is a string which subsequently describes the lantern
when it's on the ground.
These strings are used when a room description is given, which occurs when
you enter a room or when you do a LOOK.
If there are no FDESC or LDESC properties, an object will be described
by plugging its DESC into a default: "There is a brass lantern here."
\end_layout
\begin_layout Standard
The SIZE property defines the size/weight of the object.
This helps the game decide things like whether you can pick something up,
or whether you're holding too much already.
If no SIZE is given to a takeable object, the default is usually 5.
A very light object, like a key or a credit card, might have a SIZE of
1 or 2.
A very heavy object, like a trunk or anvil, might have a SIZE of 25 or
50.
Don't worry too much when you're creating the object; you can always go
back and tweak the sizes during the testing phase.
\end_layout
\begin_layout Chapter
Routines in ZIL
\end_layout
\begin_layout Section
The Basic Parts
\end_layout
\begin_layout Standard
A routine is the most common item that makes up ZIL code.
If you think of rooms and objects as the skeletal structure of a game,
then routines are the blood and muscle that make the skeleton dance.
\end_layout
\begin_layout Standard
Like all things in ZIL, a routine must have balanced sets of parentheses
and angle brackets.
The basic parts of a routine look like this.
Note how the angle brackets balance out:
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\ttfamily},xleftmargin=25pt"
inline false
status open
\begin_layout Plain Layout
<ROUTINE ROUTINE-NAME (argument-list)
\end_layout
\begin_layout Plain Layout
<guts of the routine>>
\end_layout
\end_inset