1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*- Inform -*- !!!!
2
! DOORS An INFORM 6.10 library creating easy-to-code doors
3
! By L. Ross Raszewski <rraszews@skipjack.bluecrab.org>
5
! According to "The Inform Designer's Manual, 3rd edition" (reprinted
9
! (a) give the object the door attribute;
10
! (b) set its door_to property to the destination;
11
! (c) set its door_dir property to the direction which that would be,
13
! (d) make the room's map connection in that direction point to the door
16
! Yeah, right. The majority of doors you'll meet in real life are two-sided
17
! and anyone who's tried to code up a two-sided door in Inform knows what
18
! they're in for. You'll need something like a
19
! door_to [; if (location == shrine) return jungle; return shrine;],
21
! door_dir [; if (location == shrine) return u_to; return d_to;],
22
! Now, I'll agree this isn't all that bad, but I'm sure you've wished it
23
! was easier. Many a newbie has died trying to code up something lke this.
27
! Observe if you will the Connector class.
29
! Suppose you need a door between roomA and roomB, where roomA is to the east
33
! Connector door "door"
37
! when_open "The door is open",
38
! when_closed "The door is closed",
41
! Voila! This simple syntax is equivalent to the conventional syntax:
45
! door_to [; if (location == roomA) return roomB; return roomA;],
46
! door_dir [; if (location == roomB) return e_to; return w_to;],
47
! when_open "The door is open",
48
! when_closed "The door is closed",
49
! found_in roomA roomB;
50
! has openable door static;
52
! I can hear you now. "What? I save three lousy lines?" Well, yeah, but in
53
! a game with a lot of doors, you've saved yourself some syntax. And it
54
! certaintly is more intuitive.
56
! The only catch, for the sake of economy, is that you have to call the
57
! function InitDoors(); in your initialise.
60
! The AltMenuing system
61
! Center Centers a line of text in either window.
62
! Domenu Improved menuing with multiple description lines
63
! Altmenu Object oriented menuing system
64
! Hints Altmenu hint system
65
! Sound The Inform Sound System
66
! YesNo pseudo-rhetorical Yes or no questions
67
! Date Datekeeping and printing
68
! Footnote Autonumbering footnotes
69
! Locktest Default key selection
70
! Newlock Key-side lock definition
71
! Ordinal Ordinal number printing
72
! Whatis "What is a" questions
73
! Senses Recursive sensory perception
74
! Pmove Move objects into the tree as the youngest object
75
! Movie Non-interactive cut-scenes
76
! Manual inform "instruction manual" system
79
! Converse Hit-word based conversation
80
! MenuTalk Menu-based Conversation
81
! UniCursr Unicursor- Text adventures with the contol simplicity
82
! of omnifunction click graphic games (ie. Type "clock"
83
! to examine, take, or manipulate the clock)
85
! Please write me and tell me what you think.
89
if (location==self.sidea) return self.dira;
93
if (location==self.sidea) return self.sideb;
104
objectloop (j ofclass Connector) {
105
objectloop (o in compass) {
113
objectloop (o in compass) {
115
if ((j provides i) && (j.dirb ~= i)) {
121
j.&found_in-->0 = j.sidea;
122
j.&found_in-->1 = j.sideb;