defs.89 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. <AND <L? ,MUDDLE 100> <USE "LSRTNS">>
  2. ; "applicables"
  3. <NEWTYPE OFFSET WORD>
  4. <PUT RAPPLIC DECL '<OR ATOM FALSE OFFSET>>
  5. ; "newtypes for parser"
  6. <NEWTYPE BUZZ STRING>
  7. <NEWTYPE DIRECTION ATOM>
  8. <NEWTYPE ADJECTIVE ATOM>
  9. <NEWTYPE PREP ATOM>
  10. \
  11. ;"generalized oflags tester"
  12. <DEFMAC TRNN ('OBJ 'BIT)
  13. <FORM N==? <FORM CHTYPE <FORM ANDB .BIT <FORM OFLAGS .OBJ>> FIX> 0>>
  14. <DEFMAC RTRNN ('RM 'BIT)
  15. <FORM N==? <FORM CHTYPE <FORM ANDB .BIT <FORM RBITS .RM>> FIX> 0>>
  16. <DEFMAC GTRNN ('RM 'BIT)
  17. <FORM N==? <FORM CHTYPE <FORM ANDB .BIT <FORM RGLOBAL .RM>> FIX> 0>>
  18. <DEFMAC RTRZ ('RM 'BIT)
  19. <FORM PUT .RM ,RBITS <FORM ANDB <FORM RBITS .RM> <FORM XORB .BIT -1>>>>
  20. <DEFMAC TRC ('OBJ 'BIT)
  21. <FORM PUT .OBJ ,OFLAGS <FORM XORB <FORM OFLAGS .OBJ> .BIT>>>
  22. <DEFMAC TRZ ('OBJ 'BIT)
  23. <FORM PUT .OBJ ,OFLAGS <FORM ANDB <FORM OFLAGS .OBJ> <FORM XORB .BIT -1>>>>
  24. <DEFMAC TRO ('OBJ 'BIT)
  25. <FORM PUT .OBJ ,OFLAGS <FORM ORB <FORM OFLAGS .OBJ> .BIT>>>
  26. <DEFMAC RTRO ('RM 'BIT)
  27. <FORM PUT .RM ,RBITS <FORM ORB <FORM RBITS .RM> .BIT>>>
  28. <DEFMAC RTRC ('RM 'BIT)
  29. <FORM PUT .RM ,RBITS <FORM XORB <FORM RBITS .RM> .BIT>>>
  30. \
  31. ; "room definition"
  32. <NEWSTRUC
  33. ROOM VECTOR
  34. RID ATOM ;"room id"
  35. RDESC1 STRING ;"long description"
  36. RDESC2 STRING ;"short description"
  37. REXITS EXIT ;"list of exits"
  38. ROBJS <LIST [REST OBJECT]> ;"objects in room"
  39. RACTION RAPPLIC ;"room-action"
  40. RVARS <PRIMTYPE WORD> ;"slot for use of room function"
  41. RVAL FIX ;"value for visiting"
  42. RBITS <PRIMTYPE WORD> ;"random flags"
  43. RRAND ANY ;"random slot"
  44. RGLOBAL <PRIMTYPE WORD>> ;"slot for globals"
  45. ;"flagword for <RBITS room>:
  46. bit-name bit-tester"
  47. <FLAGWORD RSEENBIT RSEEN? ;"visited?"
  48. RLIGHTBIT RLIGHT? ;"endogenous light source?"
  49. RLANDBIT <> ;"on land"
  50. RWATERBIT <> ;"water room"
  51. RAIRBIT <> ;"mid-air room"
  52. RSACREDBIT <> ;"thief not allowed"
  53. RFILLBIT <> ;"can fill bottle here"
  54. RMUNGBIT <> ;"room has been munged"
  55. RBUCKBIT <> ;"this room is a bucket"
  56. RHOUSEBIT <> ;"This room is part of the house">
  57. ; "exit"
  58. <NEWTYPE EXIT
  59. VECTOR
  60. '<<PRIMTYPE VECTOR> [REST ATOM <OR ROOM CEXIT DOOR NEXIT>]>>
  61. ; "conditional exit"
  62. <NEWSTRUC
  63. CEXIT VECTOR
  64. CXFLAG ATOM ;"condition flag"
  65. CXROOM ROOM ;"room it protects"
  66. CXSTR <OR FALSE STRING> ;"description"
  67. CXACTION RAPPLIC ;"exit function">
  68. <NEWSTRUC
  69. DOOR VECTOR
  70. DOBJ OBJECT ;"the door"
  71. DROOM1 ROOM ;"one of the rooms"
  72. DROOM2 ROOM ;"the other one"
  73. DSTR <OR FALSE STRING> ;"what to print if closed"
  74. DACTION RAPPLIC ;"what to call to decide">
  75. <NEWTYPE NEXIT STRING> ;"unusable exit description"
  76. \
  77. ; "PARSER related types"
  78. ; "ACTION -- top level type for verbs"
  79. <NEWSTRUC
  80. ACTION VECTOR
  81. VNAME ATOM ;"atom associated with this action"
  82. VDECL VSPEC ;"syntaxes for this verb (any number)"
  83. VSTR STRING ;"string to print when talking about this verb">
  84. ; "VSPEC -- uvector of syntaxes for a verb"
  85. <NEWTYPE
  86. VSPEC UVECTOR
  87. '<<PRIMTYPE UVECTOR> [REST SYNTAX]>>
  88. ; "SYNTAX -- a legal syntax for a sentence involving this verb"
  89. <NEWSTRUC
  90. SYNTAX VECTOR
  91. SYN1 VARG ;"direct object, more or less"
  92. SYN2 VARG ;"indirect object, more or less"
  93. SFCN VERB ;"function to handle this action"
  94. SFLAGS FIX ;"flag bits for this verb">
  95. ; "SFLAGS of a SYNTAX"
  96. <FLAGWORD SFLIP <> ;"T -- flip args (for verbs like PICK)"
  97. SDRIVER <> ;"T -- default syntax for gwimming and orphanery">
  98. ; "STRNN -- test a bit in the SFLAGS slot of a SYNTAX"
  99. <DEFMAC STRNN ('S 'BIT)
  100. <FORM N==? <FORM CHTYPE <FORM ANDB .BIT <FORM SFLAGS .S>> FIX> 0>>
  101. ; "VARG -- types and locations of objects acceptable as args to verbs,
  102. these go in the SYN1 and SYN2 slots of a SYNTAX."
  103. <NEWSTRUC
  104. VARG VECTOR
  105. VBIT FIX ;"acceptable object characteristics (default any)"
  106. VFWIM FIX ;"spec for fwimming"
  107. VPREP <OR PREP FALSE> ;"preposition that must precede(?) object"
  108. VWORD FIX ;"locations object may be looked for in">
  109. ; "flagbit definitions for VWORD of a VARG"
  110. <FLAGWORD VABIT <> ;"AOBJS -- look in AOBJS"
  111. VRBIT <> ;"ROBJS -- look in ROBJS"
  112. VTBIT <> ;"1 => try to take the object"
  113. VCBIT <> ;"1 => care if can't take object">
  114. ; "VTRNN -- test a bit in the VWORD slot of a VARG"
  115. <DEFMAC VTRNN ('V 'BIT)
  116. <FORM N==? <FORM CHTYPE <FORM ANDB .BIT <FORM VWORD .V>> FIX> 0>>
  117. "VTBIT & VCBIT interact as follows:
  118. vtbit
  119. vcbit
  120. 1 1 = TAKE -- try to take, care if can't ('TURN WITH x')
  121. 1 0 = TRY -- try to take, don't care if can't ('READ x')
  122. 0 1 = MUST -- must already have object ('ATTACK TROLL WITH x')
  123. 0 0 = NO-TAKE (default) -- don't try, don't care ('TAKE x')
  124. "
  125. ; "VERB -- name and function to apply to handle verb"
  126. <NEWSTRUC
  127. VERB VECTOR
  128. VNAME ATOM
  129. VFCN RAPPLIC>
  130. ; "ORPHANS -- mysterious vector of orphan data"
  131. <NEWSTRUC
  132. (ORPHANS) VECTOR
  133. OFLAG <OR FALSE ATOM>
  134. OVERB <OR FALSE VERB>
  135. OSLOT1 <OR FALSE OBJECT>
  136. OPREP <OR FALSE PREP>
  137. ONAME <OR FALSE ATOM>>
  138. ; "prepositional phrases"
  139. <NEWSTRUC
  140. PHRASE VECTOR
  141. PPREP PREP
  142. POBJ OBJECT>
  143. \
  144. ; "adventurer"
  145. <NEWSTRUC
  146. ADV VECTOR
  147. AROOM ROOM ;"where he is"
  148. AOBJS <LIST [REST OBJECT]> ;"what he's carrying"
  149. ASCORE FIX ;"score"
  150. AVEHICLE <OR FALSE OBJECT> ;"what he's riding in"
  151. AOBJ OBJECT ;"what he is"
  152. AACTION RAPPLIC ;"special action for robot, etc."
  153. ASTRENGTH FIX ;"fighting strength"
  154. ARAND ANY ;" ** reserved for future expansion ** "
  155. AFLAGS <PRIMTYPE WORD> ;"flags THIS MUST BE SAME OFFSET AS OFLAGS!">
  156. "bits in <AFLAGS adv>:
  157. bit-name bit-tester"
  158. <FLAGWORD ASTAGGERED STAGGERED? ;"staggered?">
  159. ; "object"
  160. <NEWSTRUC
  161. OBJECT VECTOR
  162. OID ATOM ;"unique name, SETG'd to this"
  163. ONAMES <UVECTOR [REST ATOM]> ;"synonyms"
  164. ODESC1 STRING ;"description when not carried"
  165. ODESC2 STRING ;"short description"
  166. ODESCO <OR STRING FALSE> ;"description when untouched"
  167. OACTION RAPPLIC ;"object-action"
  168. OCONTENTS <LIST [REST OBJECT]> ;"list of contents"
  169. OCAN <OR FALSE OBJECT> ;"what contains this"
  170. OFLAGS <PRIMTYPE WORD> ;"flags THIS MUST BE SAME OFFSET AS AFLAGS!"
  171. OFVAL FIX ;"value for finding"
  172. OTVAL FIX ;"value for putting in trophy case"
  173. ORAND ANY ;"random slot"
  174. OGLOBAL FIX ;"if obj is global, this holds bit"
  175. OSIZE FIX ;"how big is it?"
  176. OCAPAC FIX ;"how much can it hold?"
  177. OADJS <UVECTOR [REST ADJECTIVE]> ;"adjectives for this"
  178. OROOM <OR FALSE ROOM> ;"what room its in"
  179. OREAD <OR FALSE STRING> ;"reading material">
  180. "bits in <OFLAGS object>:
  181. bit-name bit-tester"
  182. <FLAGWORD OVISON OVIS? ;"visible?"
  183. READBIT READABLE? ;"readable?"
  184. TAKEBIT CAN-TAKE? ;"takeable?"
  185. DOORBIT DOOR? ;"object is door"
  186. TRANSBIT TRANSPARENT? ;"object is transparent"
  187. FOODBIT EDIBLE? ;"object is food"
  188. NDESCBIT <> ;"object not describable"
  189. DRINKBIT DRINKABLE? ;"object is drinkable"
  190. CONTBIT <> ;"object can be opened/closed"
  191. LIGHTBIT <> ;"object can provide light"
  192. VICBIT <> ;"object is victim"
  193. BURNBIT BURNABLE? ;"object is flammable"
  194. FLAMEBIT <> ;"object is on fire"
  195. TOOLBIT <> ;"object is a tool"
  196. TURNBIT <> ;"object can be turned"
  197. VEHBIT <> ;"object is a vehicle"
  198. FINDMEBIT <> ;"can be reached from a vehicle"
  199. SLEEPBIT <> ;"object is asleep"
  200. SEARCHBIT <> ;"allow multi-level access into this"
  201. SACREDBIT <> ;"thief can't take this"
  202. TIEBIT <> ;"object can be tied"
  203. ECHO-ROOM-BIT <> ;"nothing can be taken in echo room"
  204. ACTORBIT <> ;"object is an actor"
  205. WEAPONBIT <> ;"object is a weapon"
  206. FIGHTBIT FIGHTING? ;"object is in melee"
  207. VILLAIN <> ;"object is a bad guy"
  208. STAGGERED <> ;"object can't fight this turn"
  209. TRYTAKEBIT <> ;"object wants to handle not being taken"
  210. NO-CHECK-BIT <> ;"no checks (put & drop): for EVERY and VALUA"
  211. OPENBIT OOPEN? ;"object is open"
  212. TOUCHBIT OTOUCH? ;"has this been touched?"
  213. ONBIT <> ;"light on?">
  214. "extra stuff for flagword for objects"
  215. "can i be opened?"
  216. <DEFMAC OPENABLE? ('OBJ) <FORM TRNN .OBJ <FORM + ,DOORBIT ,CONTBIT>>>
  217. "complement of the bit state"
  218. <DEFMAC DESCRIBABLE? ('OBJ) <FORM NOT <FORM TRNN .OBJ ,NDESCBIT>>>
  219. "if object is a light or aflame, then flaming"
  220. <DEFMAC FLAMING? ('OBJ)
  221. <FORM AND
  222. <FORM TRNN .OBJ ,FLAMEBIT>
  223. <FORM TRNN .OBJ ,LIGHTBIT>
  224. <FORM TRNN .OBJ ,ONBIT>>>
  225. "if object visible and open or transparent, can see inside it"
  226. <DEFMAC SEE-INSIDE? ('OBJ)
  227. <FORM AND <FORM OVIS? .OBJ>
  228. <FORM OR <FORM TRANSPARENT? .OBJ> <FORM OOPEN? .OBJ>>>>
  229. <DEFMAC STAR? ('OBJ)
  230. <FORM NOT <FORM 0? <FORM CHTYPE <FORM ANDB ',STAR-BITS <FORM OGLOBAL .OBJ>> FIX>>>>
  231. \
  232. ; "demons"
  233. <NEWSTRUC HACK VECTOR
  234. HACTION RAPPLIC
  235. HOBJS <LIST [REST ANY]>
  236. "REST"
  237. HROOMS <LIST [REST ROOM]>
  238. HROOM ROOM
  239. HOBJ OBJECT
  240. HFLAG ANY>
  241. ; "Clock interrupts"
  242. <NEWSTRUC CEVENT VECTOR
  243. CTICK FIX
  244. CACTION <OR APPLICABLE OFFSET>
  245. CFLAG <OR ATOM FALSE>
  246. CID ATOM>
  247. \
  248. <SETG LOAD-MAX 100>
  249. <SETG SCORE-MAX 0>
  250. <GDECL (RAW-SCORE LOAD-MAX SCORE-MAX) FIX
  251. (RANDOM-LIST ROOMS SACRED-PLACES) <LIST [REST ROOM]>
  252. (STARS OBJECTS WEAPONS NASTIES) <LIST [REST OBJECT]>
  253. (PRSVEC) <VECTOR <OR FALSE VERB> <OR FALSE OBJECT DIRECTION>
  254. <OR FALSE OBJECT>>
  255. (WINNER PLAYER) ADV (HERE) ROOM (INCHAN OUTCHAN) CHANNEL (DEMONS) LIST
  256. (MOVES DEATHS) FIX (DUMMY YUKS) <VECTOR [REST STRING]>
  257. (SWORD-DEMON) HACK>
  258. \
  259. "UTILITY FUNCTIONS"
  260. "TO OPEN DOORS"
  261. <DEFMAC COND-OPEN ('DIR 'RM)
  262. <FORM PROG <LIST <LIST EL <FORM MEMQ .DIR <FORM REXITS .RM>>>>
  263. #DECL ((EL) <<PRIMTYPE VECTOR> ATOM DOOR>)
  264. <FORM TRO <FORM DOBJ <FORM 2 <FORM LVAL EL>>> ,OPENBIT>>>
  265. <DEFMAC COND-CLOSE ('DIR 'RM)
  266. <FORM PROG <LIST <LIST EL <FORM MEMQ .DIR <FORM REXITS .RM>>>>
  267. #DECL ((EL) <<PRIMTYPE VECTOR> ATOM DOOR>)
  268. <FORM TRZ <FORM DOBJ <FORM 2 <FORM LVAL EL>>> ,OPENBIT>>>
  269. <DEFMAC GET-DOOR-ROOM ('RM 'LEAVINGS)
  270. <FORM PROG <LIST <LIST EL <FORM DROOM1 .LEAVINGS>>>
  271. <FORM COND
  272. (<FORM ==? .RM <FORM LVAL EL>>
  273. <FORM DROOM2 .LEAVINGS>)
  274. (<FORM LVAL EL>)>>>
  275. "APPLY AN OBJECT FUNCTION"
  276. <DEFMAC APPLY-OBJECT ('OBJ)
  277. <FORM PROG ((FOO <FORM OACTION .OBJ>))
  278. <FORM COND (<FORM NOT <FORM LVAL FOO>> <>)
  279. (<FORM TYPE? <FORM LVAL FOO> ATOM>
  280. <FORM APPLY <FORM GVAL <FORM LVAL FOO>>>)
  281. (<FORM DISPATCH <FORM LVAL FOO>>)>>>
  282. "FLUSH AN OBJECT FROM A ROOM"
  283. <DEFINE REMOVE-OBJECT (OBJ "AUX" OCAN OROOM)
  284. #DECL ((OBJ) OBJECT (OCAN) <OR OBJECT FALSE> (OROOM) <OR FALSE ROOM>)
  285. <COND (<SET OCAN <OCAN .OBJ>>
  286. <PUT .OCAN ,OCONTENTS <SPLICE-OUT .OBJ <OCONTENTS .OCAN>>>)
  287. (<SET OROOM <OROOM .OBJ>>
  288. <PUT .OROOM ,ROBJS <SPLICE-OUT .OBJ <ROBJS .OROOM>>>)
  289. (<MEMQ .OBJ <ROBJS ,HERE>>
  290. <PUT ,HERE ,ROBJS <SPLICE-OUT .OBJ <ROBJS ,HERE>>>)>
  291. <PUT .OBJ ,OROOM <>>
  292. <PUT .OBJ ,OCAN <>>>
  293. <DEFMAC INSERT-OBJECT ('OBJ 'ROOM)
  294. <FORM PUT
  295. .ROOM
  296. ,ROBJS
  297. (<FORM PUT .OBJ ,OROOM .ROOM> <CHTYPE <FORM ROBJS .ROOM> SEGMENT>)>>
  298. <DEFMAC TAKE-OBJECT ('OBJ "OPTIONAL" ('WINNER ',WINNER))
  299. <FORM PUT
  300. .WINNER
  301. ,AOBJS
  302. (<FORM PUT .OBJ ,OROOM <>> <CHTYPE <FORM AOBJS .WINNER> SEGMENT>)>>
  303. <DEFMAC DROP-OBJECT ('OBJ "OPTIONAL" ('WINNER ',WINNER))
  304. <FORM PUT .WINNER ,AOBJS <FORM SPLICE-OUT .OBJ <FORM AOBJS .WINNER>>>>
  305. <DEFINE KILL-OBJ (OBJ WINNER)
  306. #DECL ((OBJ) OBJECT (WINNER) ADV)
  307. <COND (<MEMQ .OBJ <AOBJS .WINNER>>
  308. <PUT .WINNER ,AOBJS <SPLICE-OUT .OBJ <AOBJS .WINNER>>>)
  309. (<REMOVE-OBJECT .OBJ>)>>
  310. <DEFINE FLUSH-OBJ ("TUPLE" OBJS "AUX" (WINNER ,WINNER))
  311. #DECL ((OBJS) <TUPLE [REST STRING]> (WINNER) ADV)
  312. <MAPF <>
  313. <FUNCTION (X "AUX" (Y <FIND-OBJ .X>))
  314. #DECL ((X) STRING (Y) OBJECT)
  315. <AND <MEMQ .Y <AOBJS .WINNER>>
  316. <DROP-OBJECT <FIND-OBJ .X> .WINNER>>>
  317. .OBJS>>
  318. "ROB-ADV: TAKE ALL OF THE VALUABLES A HACKER IS CARRYING"
  319. <DEFINE ROB-ADV (WIN NEWLIST)
  320. #DECL ((WIN) ADV (NEWLIST) <LIST [REST OBJECT]>)
  321. <MAPF <>
  322. <FUNCTION (X) #DECL ((X) OBJECT)
  323. <COND (<AND <G? <OTVAL .X> 0> <NOT <TRNN .X ,SACREDBIT>>>
  324. <PUT .WIN ,AOBJS <SPLICE-OUT .X <AOBJS .WIN>>>
  325. <SET NEWLIST (.X !.NEWLIST)>)>>
  326. <AOBJS .WIN>>
  327. .NEWLIST>
  328. "ROB-ROOM: TAKE VALUABLES FROM A ROOM, PROBABILISTICALLY"
  329. <DEFINE ROB-ROOM (RM NEWLIST PROB)
  330. #DECL ((RM) ROOM (NEWLIST) <LIST [REST OBJECT]> (PROB) FIX)
  331. <MAPF <>
  332. <FUNCTION (X) #DECL ((X) OBJECT)
  333. <COND (<AND <G? <OTVAL .X> 0>
  334. <NOT <TRNN .X ,SACREDBIT>>
  335. <OVIS? .X>
  336. <PROB .PROB>>
  337. <REMOVE-OBJECT .X>
  338. <TRO .X ,TOUCHBIT>
  339. <SET NEWLIST (.X !.NEWLIST)>)
  340. (<TYPE? <ORAND .X> ADV>
  341. <SET NEWLIST <ROB-ADV <ORAND .X> .NEWLIST>>)>>
  342. <ROBJS .RM>>
  343. .NEWLIST>
  344. <DEFINE VALUABLES? (ADV)
  345. #DECL ((ADV) ADV)
  346. <MAPF <>
  347. <FUNCTION (X) #DECL ((X) OBJECT)
  348. <COND (<G? <OTVAL .X> 0> <MAPLEAVE T>)>>
  349. <AOBJS .ADV>>>
  350. <DEFINE ARMED? (ADV "AUX" (WEAPONS ,WEAPONS))
  351. #DECL ((ADV) ADV (WEAPONS) <LIST [REST OBJECT]>)
  352. <MAPF <>
  353. <FUNCTION (X) #DECL ((X) OBJECT)
  354. <COND (<MEMQ .X .WEAPONS>
  355. <MAPLEAVE T>)>>
  356. <AOBJS .ADV>>>
  357. <DEFINE LIGHT-SOURCE (ME)
  358. #DECL ((ME) ADV)
  359. <MAPF <>
  360. <FUNCTION (X)
  361. #DECL ((X) OBJECT)
  362. <COND (<NOT <TRNN .X ,LIGHTBIT>>
  363. <MAPLEAVE .X>)>>
  364. <AOBJS .ME>>>
  365. <DEFINE GET-DEMON (ID "AUX" (OBJ <FIND-OBJ .ID>) (DEMS ,DEMONS))
  366. #DECL ((ID) STRING (OBJ) OBJECT (DEMS) <LIST [REST HACK]>)
  367. <MAPF <>
  368. <FUNCTION (X) #DECL ((X) HACK)
  369. <COND (<==? <HOBJ .X> .OBJ> <MAPLEAVE .X>)>>
  370. .DEMS>>
  371. <DEFMAC PICK-ONE ('VEC)
  372. <FORM NTH .VEC <FORM + 1 <FORM MOD <FORM RANDOM> <FORM LENGTH .VEC>>>>>
  373. <DEFMAC CLOCK-DISABLE ('EV)
  374. <FORM PUT .EV ,CFLAG <>>>
  375. <DEFMAC CLOCK-ENABLE ('EV)
  376. <FORM PUT .EV ,CFLAG T>>
  377. <DEFINE YES/NO (NO-IS-BAD? "AUX" (INBUF ,INBUF) (INCHAN ,INCHAN))
  378. #DECL ((INBUF) STRING (NO-IS-BAD?) <OR ATOM FALSE> (INCHAN) CHANNEL)
  379. <RESET .INCHAN>
  380. <READSTRING .INBUF .INCHAN ,READER-STRING>
  381. <RESET .INCHAN>
  382. <COND (.NO-IS-BAD?
  383. <NOT <MEMQ <1 .INBUF> "NnfF">>)
  384. (T
  385. <MEMQ <1 .INBUF> "TtYy">)>>
  386. <DEFMAC APPLY-RANDOM ('FROB "OPTIONAL" ('MUMBLE <>))
  387. <FORM COND
  388. (<FORM TYPE? .FROB ATOM>
  389. <COND (.MUMBLE
  390. <FORM APPLY <FORM GVAL .FROB> .MUMBLE>)
  391. (<FORM APPLY <FORM GVAL .FROB>>)>)
  392. (T <FORM DISPATCH .FROB .MUMBLE>)>>
  393. "OLD MAZER"
  394. <MOBLIST FLAG 17>
  395. <PSETG NULL-DESC "">
  396. <PSETG NULL-EXIT <CHTYPE [] EXIT>>
  397. <PSETG NULL-SYN ![]>
  398. <DEFINE FIND-ROOM (ID "AUX" ATM ROOM)
  399. #DECL ((ID) <OR ATOM STRING> (VALUE) ROOM
  400. (ROOM) ROOM (ATM) <OR ATOM FALSE>)
  401. <COND (<TYPE? .ID ATOM> <SET ID <SPNAME .ID>>)>
  402. <COND (<AND <SET ATM <LOOKUP .ID ,ROOM-OBL>>
  403. <GASSIGNED? .ATM>>
  404. ,.ATM)
  405. (<OR .ATM
  406. <SET ATM <INSERT .ID ,ROOM-OBL>>>
  407. <SETG .ATM
  408. <SET ROOM
  409. <CHTYPE <VECTOR .ATM ,NULL-DESC ,NULL-DESC
  410. ,NULL-EXIT () <> 0 0 0 T 0>
  411. ROOM>>>
  412. <SETG ROOMS (.ROOM !,ROOMS)>
  413. .ROOM)>>
  414. <DEFINE FIND-OBJ (ID "AUX" OBJ ATM)
  415. #DECL ((ID) <OR ATOM STRING> (OBJ) OBJECT (ATM) <OR ATOM FALSE> (VALUE) OBJECT)
  416. <COND (<TYPE? .ID ATOM> <SET ID <SPNAME .ID>>)>
  417. <COND (<AND <SET ATM <LOOKUP .ID ,OBJECT-OBL>>
  418. <GASSIGNED? .ATM>>
  419. ,.ATM)
  420. (<OR .ATM
  421. <SET ATM <INSERT .ID ,OBJECT-OBL>>>
  422. <SETG .ATM
  423. <SET OBJ
  424. <CHTYPE [.ATM ,NULL-SYN ,NULL-DESC ,NULL-DESC <>
  425. <> () <> 0 0 0 <> 0 5 0 ,NULL-SYN <> <>]
  426. OBJECT>>>
  427. <SETG OBJECTS (.OBJ !,OBJECTS)>
  428. .OBJ)>>
  429. <DEFINE FIND-DOOR (RM OBJ)
  430. #DECL ((RM) ROOM (OBJ) OBJECT)
  431. <REPEAT ((L <REXITS .RM>) TD)
  432. #DECL ((L) <<PRIMTYPE VECTOR> [REST ATOM <OR DOOR ROOM CEXIT NEXIT>]>)
  433. <COND (<EMPTY? .L>
  434. <RETURN <>>)
  435. (<AND <TYPE? <SET TD <2 .L>> DOOR>
  436. <==? <DOBJ .TD> .OBJ>>
  437. <RETURN .TD>)>
  438. <SET L <REST .L 2>>>>
  439. <DEFINE FUNCTION-PRINT (FROB "AUX" (OUTCHAN .OUTCHAN))
  440. #DECL ((FROB) <OR ATOM OFFSET APPLICABLE FALSE> (OUTCHAN) CHANNEL)
  441. <COND (<NOT .FROB> <PRINC "<>">)
  442. (<TYPE? .FROB RSUBR RSUBR-ENTRY>
  443. <PRIN1 <2 .FROB>>)
  444. (<TYPE? .FROB ATOM>
  445. <PRIN1 .FROB>)
  446. (<TYPE? .FROB OFFSET>
  447. <PRINC "#OFFSET ">
  448. <PRIN1 <GET-ATOM .FROB>>)
  449. (<PRINC "#FUNCTION ">
  450. <PRIN1 <GET-ATOM .FROB>>)>>
  451. <DEFINE CONS-OBJ ("TUPLE" OBJS "AUX" (WINNER ,WINNER))
  452. #DECL ((OBJS) <TUPLE [REST STRING]> (WINNER) ADV)
  453. <MAPF <>
  454. <FUNCTION (X "AUX" (Y <FIND-OBJ .X>))
  455. #DECL ((Y) OBJECT (X) STRING)
  456. <OR <MEMQ .Y <AOBJS .WINNER>>
  457. <TAKE-OBJECT <FIND-OBJ .X> .WINNER>>>
  458. .OBJS>>
  459. <DEFINE IN-ROOM? (OBJ "OPTIONAL" (HERE ,HERE) "AUX" TOBJ)
  460. #DECL ((OBJ) OBJECT (HERE) ROOM (TOBJ) <OR OBJECT FALSE>)
  461. <COND (<SET TOBJ <OCAN .OBJ>>
  462. <COND (<==? <OROOM .TOBJ> .HERE>)
  463. (<TRNN .TOBJ ,SEARCHBIT>
  464. <IN-ROOM? .TOBJ .HERE>)>)
  465. (<==? <OROOM .OBJ> .HERE>)>>