-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUTILITY.ACH
More file actions
156 lines (113 loc) · 3.37 KB
/
UTILITY.ACH
File metadata and controls
156 lines (113 loc) · 3.37 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
# UTILITY.ACH
#
# Generally useful class definitions.
# Hollow objects. These are objects that can double as rooms.
class hollow_object based on object
IsAhollow_object : TRUE
proximity : "in"
visited : FALSE
intro : "I can see"
empty_intro : "There is nothing of interest " & proximity & " " &
('DEF' -> self) & "."
open : UNDEFINED
methods
'ACCESS' : ('ACCESS' --> object) or player.location = self
'exit' :
if location then {
if player.location ~= self then
write "I'm not ", proximity, " ", 'DEF' -> self, "."
else {
player.location := location
'MOVE' -> player
}
}
else
write "I can't leave ", 'DEF' -> self, "."
'leave' : 'exit'
'look' :
>>It looks roomy enough to enter.
'look in' :
if 'TRANSPARENT' -> self then {
writes "I look inside. "
'INVENTORY'
}
else
write "I can't look inside that."
'enter' :
if player.location = self then
write "I'm already ", proximity, " ", 'DEF' -> self, "."
else if location = player.location then {
if open = FALSE then
>>It's closed at the moment.
else {
player.location := self
'MOVE' -> player
}
}
else if location = player then
write "I cannot enter something that I'm carrying."
else
write "I can't enter ", 'DEF' -> self, " because ",
pronoun, " isn't here."
'go' : 'enter'
'go to' : 'enter'
'go in' : 'enter'
'get' :
if player.location = self then
write "I can't pick up something that I'm ", proximity, "."
else
message --> object
'BRIEF' :
write "I am ", proximity, " ", 'DEF' -> self, "."
'LONGDESC' : 'BRIEF'
# The following is an example of how a kind of multiple inheritance
# can be accomplished in Archetype. This only "inherits" the messages,
# however, not the attributes. Be careful to pass only
# non-verb messages to the room object.
default :
if not (message -> compass) and message -> verb_filter then
ABSENT
else
message --> room
end # hollow_object
# Furniture class. This is the sort of object that is so much a part
# of the room that it really inherits the exits of the room that it is
# in; it it also possible to "leave" it and remain in the same
# room.
class furniture based on hollow_object
IsAfurniture : TRUE
proximity : "on"
methods
'TRANSPARENT' : TRUE
'HORIZON' : location
default : {
if message -> compass then
message -> location
else if message -> verb_filter then
ABSENT
else
message --> room
}
end # furniture
# container
#
# Simply fill in the "holder" and "contents" attributes with descriptive
# strings; the rest is taken care of.
class container based on object
IsAcontainer : TRUE
holder : "can"
contents : "stuff"
desc : 'DESC' -> self
syn : holder & "|" & contents & " " & holder
filled : TRUE
methods
'look' :
if filled then
write "The ", holder, " is full of ", contents, "."
else
write "The ", holder, " is empty."
'DESC' : if filled then
holder & " of " & contents
else
"empty " & holder
end