home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume18 / dunnet2 / part02 < prev    next >
Encoding:
Text File  |  1993-07-11  |  56.1 KB  |  1,805 lines

  1. Path: uunet!news.tek.com!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v18i012:  dunnet2 - emacs-lisp text adventure, Ver 2, Part02/03
  5. Date: 10 Jul 1993 22:58:41 GMT
  6. Organization: Tektronix, Inc, Redmond, OR, USA
  7. Lines: 1792
  8. Approved: billr@saab.CNA.TEK.COM
  9. Message-ID: <21nhj1$q4h@ying.cna.tek.com>
  10. NNTP-Posting-Host: saab.cna.tek.com
  11. Xref: uunet comp.sources.games:1812
  12.  
  13. Submitted-by: ronnie@media.mit.edu
  14. Posting-number: Volume 18, Issue 12
  15. Archive-name: dunnet2/part02
  16. Supersedes: dunnet: Volume 14, Issue 28-29
  17. Environment: Emacs
  18.  
  19.  
  20.  
  21. #! /bin/sh
  22. # This is a shell archive.  Remove anything before this line, then unpack
  23. # it by saving it into a file and typing "sh file".  To overwrite existing
  24. # files, type "sh file -c".  You can also feed this as standard input via
  25. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  26. # will see the following message at the end:
  27. #        "End of archive 2 (of 3)."
  28. # Contents:  CHANGES dun-batch.el dun-commands.el dun-dos.el
  29. #   dun-unix.el
  30. # Wrapped by billr@saab on Sat Jul 10 15:54:30 1993
  31. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  32. if test -f 'CHANGES' -a "${1}" != "-c" ; then 
  33.   echo shar: Will not clobber existing file \"'CHANGES'\"
  34. else
  35. echo shar: Extracting \"'CHANGES'\" \(693 characters\)
  36. sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
  37. XChanges to dunnet for version 2:
  38. X
  39. XVery few changes to game content except for the movement of one
  40. Xobject which makes the game a little easier, and a small section added.
  41. XNot really worth playing again if you have already finished it.
  42. X
  43. XFixed to work with version 19 keymaps.
  44. X
  45. XMany bugfixes and code style fixes.
  46. X
  47. XSpelling fixes.
  48. X
  49. XNow uses rot13 instead of /bin/crypt to encrypt the saved games and
  50. Xglobal data.
  51. X
  52. XYou can now write over old saved files.
  53. X
  54. XIn dunnet.window it now correctly fixes the screen when it would have
  55. Xjump-scrolled the screen up before.
  56. X
  57. XYou can now type random control characters in batch mode without it 
  58. Xerroring out (not control-c).
  59. X
  60. XOld saved games are incompatible.
  61. END_OF_FILE
  62. if test 693 -ne `wc -c <'CHANGES'`; then
  63.     echo shar: \"'CHANGES'\" unpacked with wrong size!
  64. fi
  65. # end of 'CHANGES'
  66. fi
  67. if test -f 'dun-batch.el' -a "${1}" != "-c" ; then 
  68.   echo shar: Will not clobber existing file \"'dun-batch.el'\"
  69. else
  70. echo shar: Extracting \"'dun-batch.el'\" \(2156 characters\)
  71. sed "s/^X//" >'dun-batch.el' <<'END_OF_FILE'
  72. X;;;;;;;;;;;;;;;;;;;
  73. X;;;;;;;;;;;;;;;;;;;
  74. X
  75. X
  76. X; These are functions, and function re-definitions so that dungeon can
  77. X; be run in batch mode.
  78. X
  79. X(if nil
  80. X    (eval-and-compile (setq byte-compile-warnings nil)))
  81. X
  82. X(defun mprinc (arg)
  83. X   (if (stringp arg)
  84. X       (send-string-to-terminal arg)
  85. X     (send-string-to-terminal (prin1-to-string arg))))
  86. X
  87. X(defun mprincl (arg)
  88. X   (if (stringp arg)
  89. X       (progn
  90. X           (send-string-to-terminal arg)
  91. X           (send-string-to-terminal "\n"))
  92. X     (send-string-to-terminal (prin1-to-string arg))
  93. X     (send-string-to-terminal "\n")))
  94. X
  95. X(defun parse (ignore verblist line)
  96. X  (setq line-list (listify-string (concat line " ")))
  97. X  (doverb ignore verblist (car line-list) (cdr line-list)))
  98. X
  99. X(defun parse2 (ignore verblist line)
  100. X  (setq line-list (listify-string2 (concat line " ")))
  101. X  (doverb ignore verblist (car line-list) (cdr line-list)))
  102. X
  103. X(defun read-line ()
  104. X  (read-from-minibuffer "" nil dungeon-batch-map))
  105. X
  106. X(setq batch-mode t)
  107. X
  108. X(defun dungeon-batch-loop ()
  109. X  (setq dead nil)
  110. X  (setq room 0)
  111. X  (while (not dead)
  112. X    (if (eq dungeon-mode 'dungeon)
  113. X    (progn
  114. X      (if (not (= room current-room))
  115. X          (progn
  116. X        (describe-room current-room)
  117. X        (setq room current-room)))
  118. X      (mprinc ">")
  119. X      (setq line (downcase (read-line)))
  120. X      (if (eq (parse ignore verblist line) -1)
  121. X          (mprinc "I don't understand that.\n"))))))
  122. X
  123. X(defun dos-interface ()
  124. X  (dos-boot-msg)
  125. X  (setq dungeon-mode 'dos)
  126. X  (while (eq dungeon-mode 'dos)
  127. X    (dos-prompt)
  128. X    (setq line (downcase (read-line)))
  129. X    (if (eq (parse2 nil dos-verbs line) -1)
  130. X    (progn
  131. X      (sleep-for 1)
  132. X      (mprincl "Bad command or file name"))))
  133. X  (goto-char (point-max))
  134. X  (mprinc "\n"))
  135. X
  136. X(defun unix-interface ()
  137. X    (login)
  138. X    (if logged-in
  139. X    (progn
  140. X      (setq dungeon-mode 'unix)
  141. X      (while (eq dungeon-mode 'unix)
  142. X        (mprinc "$ ")
  143. X        (setq line (downcase (read-line)))
  144. X        (if (eq (parse2 nil unix-verbs line) -1)
  145. X        (let (esign)
  146. X          (if (setq esign (string-match "=" line))
  147. X              (doassign line esign)        
  148. X            (mprinc (car line-list))
  149. X            (mprincl ": not found.")))))
  150. X      (goto-char (point-max))
  151. X      (mprinc "\n"))))
  152. X
  153. X(defun dungeon-nil (arg)
  154. X  "noop"
  155. X  (interactive "*p"))
  156. END_OF_FILE
  157. if test 2156 -ne `wc -c <'dun-batch.el'`; then
  158.     echo shar: \"'dun-batch.el'\" unpacked with wrong size!
  159. fi
  160. chmod +x 'dun-batch.el'
  161. # end of 'dun-batch.el'
  162. fi
  163. if test -f 'dun-commands.el' -a "${1}" != "-c" ; then 
  164.   echo shar: Will not clobber existing file \"'dun-commands.el'\"
  165. else
  166. echo shar: Extracting \"'dun-commands.el'\" \(32652 characters\)
  167. sed "s/^X//" >'dun-commands.el' <<'END_OF_FILE'
  168. X;;
  169. X;; This file contains all of the verbs and commands.
  170. X;;
  171. X
  172. X(require 'cl)
  173. X
  174. X(if nil
  175. X    (eval-and-compile (setq byte-compile-warnings nil)))
  176. X
  177. X;;;; Give long description of room if haven't been there yet.  Otherwise
  178. X;;;; short.  Also give long if we were called with negative room number.
  179. X
  180. X(defun describe-room (room)
  181. X  (if (and (not (member (abs room) light-rooms)) 
  182. X       (not (member obj-lamp inventory)))
  183. X      (mprincl "It is pitch dark.  You are likely to be eaten by a grue.")
  184. X    (mprincl (cadr (nth (abs room) rooms)))
  185. X    (if (and (and (or (member room visited) 
  186. X              (string= mode "superb")) (> room 0))
  187. X         (not (string= mode "long")))
  188. X    nil
  189. X      (mprinc (car (nth (abs room) rooms)))
  190. X    (mprinc "\n"))
  191. X    (if (not (string= mode "long"))
  192. X    (if (not (member (abs room) visited))
  193. X        (setq visited (append (list (abs room)) visited))))
  194. X    (dolist (xobjs (nth current-room room-objects))
  195. X      (if (= xobjs obj-special)
  196. X      (special-object)
  197. X    (if (>= xobjs 0)
  198. X        (mprincl (car (nth xobjs objects)))
  199. X      (if (not (and (= xobjs obj-bus) inbus))
  200. X          (progn
  201. X        (mprincl (car (nth (abs xobjs) perm-objects)))))))
  202. X      (if (and (= xobjs obj-jar) jar)
  203. X      (progn
  204. X        (mprincl "The jar contains:")
  205. X        (dolist (x jar)
  206. X          (mprinc "     ")
  207. X          (mprincl (car (nth x objects)))))))
  208. X    (if (and (member obj-bus (nth current-room room-objects)) inbus)
  209. X    (mprincl "You are on the bus."))))
  210. X
  211. X;;; There is a special object in the room.  This object's description,
  212. X;;; or lack thereof, depends on certain conditions.
  213. X
  214. X(defun special-object ()
  215. X  (if (= current-room computer-room)
  216. X      (if computer
  217. X      (mprincl 
  218. X"The panel lights are flashing in a seemingly organized pattern.")
  219. X    (mprincl "The panel lights are steady and motionless.")))
  220. X
  221. X  (if (and (= current-room red-room) 
  222. X       (not (member obj-towel (nth red-room room-objects))))
  223. X      (mprincl "There is a hole in the floor here."))
  224. X
  225. X  (if (and (= current-room marine-life-area) black)
  226. X      (mprincl 
  227. X"The room is lit by a black light, causing the fish, and some of 
  228. Xyour objects, to give off an eerie glow."))
  229. X  (if (and (= current-room fourth-vermont-intersection) hole)
  230. X      (progn
  231. X    (mprincl"You fall into a hole in the ground.")
  232. X    (setq current-room vermont-station)
  233. X    (describe-room vermont-station)))
  234. X
  235. X  (if (> current-room endgame-computer-room)
  236. X      (progn
  237. X    (if (not correct-answer)
  238. X        (endgame-question)
  239. X      (mprincl "Your question is:")
  240. X      (mprincl endgame-question))))
  241. X
  242. X  (if (= current-room sauna)
  243. X      (progn
  244. X    (mprincl (nth sauna-level '(
  245. X"It is normal room temperature in here."
  246. X"It is luke warm in here."
  247. X"It is comfortably hot in here."
  248. X"It is refreshingly hot in here."
  249. X"You are dead now.")))
  250. X    (if (and (= sauna-level 3) 
  251. X         (or (member obj-rms inventory)
  252. X             (member obj-rms (nth current-room room-objects))))
  253. X        (progn
  254. X          (mprincl 
  255. X"You notice the wax on your statuette beginning to melt, until it completely
  256. Xmelts off.  You are left with a beautiful diamond!")
  257. X          (if (member obj-rms inventory)
  258. X          (progn
  259. X            (remove-obj-from-inven obj-rms)
  260. X            (setq inventory (append inventory (list obj-diamond))))
  261. X        (remove-obj-from-room current-room obj-rms)
  262. X        (replace room-objects current-room
  263. X             (append (nth current-room room-objects)
  264. X                 (list obj-diamond))))
  265. X          (if (member obj-floppy inventory)
  266. X          (progn
  267. X            (mprincl
  268. X"You notice your floppy disk beginning to melt.  As you grab for it, the 
  269. Xdisk bursts into flames, and disintegrates.")
  270. X            (remove-obj-from-inven obj-floppy)
  271. X            (remove-obj-from-room current-room obj-floppy)))))))
  272. X)
  273. X
  274. X;;;;;;;;;;;;;;;;;;;;;; Commands start here
  275. X
  276. X(defun die (murderer)
  277. X  (mprinc "\n")
  278. X  (if murderer
  279. X      (mprincl "You are dead."))
  280. X  (do-logfile 'die murderer)
  281. X  (score nil)
  282. X  (setq dead t))
  283. X
  284. X(defun quit (args)
  285. X  (die nil))
  286. X
  287. X;; Print every object in player's inventory.  Special case for the jar,
  288. X;; as we must also print what is in it.
  289. X
  290. X(defun inven (args)
  291. X  (mprinc "You currently have:")
  292. X  (mprinc "\n")
  293. X  (dolist (curobj inventory)
  294. X    (if curobj
  295. X    (progn
  296. X      (mprincl (cadr (nth curobj objects)))
  297. X      (if (and (= curobj obj-jar) jar)
  298. X          (progn
  299. X        (mprincl "The jar contains:")
  300. X        (dolist (x jar)
  301. X          (mprinc "     ")
  302. X          (mprincl (cadr (nth x objects))))))))))
  303. X
  304. X(defun shake (obj)
  305. X  (let (objnum)
  306. X    (when (setq objnum (objnum-from-args-std obj))
  307. X      (if (member objnum inventory)
  308. X      (progn
  309. X;;;    If shaking anything will do anything, put here.
  310. X        (mprinc "Shaking ")
  311. X        (mprinc (downcase (cadr (nth objnum objects))))
  312. X        (mprinc " seems to have no effect.")
  313. X        (mprinc "\n")
  314. X        )
  315. X    (if (and (not (member objnum (nth current-room room-silents)))
  316. X         (not (member objnum (nth current-room room-objects))))
  317. X        (mprincl "I don't see that here.")
  318. X;;;     Shaking trees can be deadly
  319. X      (if (= objnum obj-tree)
  320. X          (progn
  321. X        (mprinc
  322. X "You begin to shake a tree, and notice a coconut begin to fall from the air.
  323. XAs you try to get your hand up to block it, you feel the impact as it lands
  324. Xon your head.")
  325. X        (die "a coconut"))
  326. X        (if (= objnum obj-bear)
  327. X        (progn
  328. X          (mprinc
  329. X"As you go up to the bear, it removes your head and places it on the ground.")
  330. X          (die "a bear"))
  331. X          (if (< objnum 0)
  332. X          (mprincl "You cannot shake that.")
  333. X        (mprincl "You don't have that.")))))))))
  334. X
  335. X
  336. X(defun drop (obj)
  337. X  (if inbus
  338. X      (mprincl "You can't drop anything while on the bus.")
  339. X  (let (objnum ptr)
  340. X    (when (setq objnum (objnum-from-args-std obj))
  341. X      (if (not (setq ptr (member objnum inventory)))
  342. X      (mprincl "You don't have that.")
  343. X    (progn
  344. X      (remove-obj-from-inven objnum)
  345. X      (replace room-objects current-room
  346. X           (append (nth current-room room-objects)
  347. X               (list objnum)))
  348. X      (mprincl "Done.")
  349. X      (if (member objnum (list obj-food obj-weight obj-jar))
  350. X          (drop-check objnum))))))))
  351. X
  352. X;; Dropping certain things causes things to happen.
  353. X
  354. X(defun drop-check (objnum)
  355. X  (if (and (= objnum obj-food) (= room bear-hangout)
  356. X       (member obj-bear (nth bear-hangout room-objects)))
  357. X      (progn
  358. X    (mprincl
  359. X"The bear takes the food and runs away with it. He left something behind.")
  360. X    (remove-obj-from-room current-room obj-bear)
  361. X    (remove-obj-from-room current-room obj-food)
  362. X    (replace room-objects current-room
  363. X         (append (nth current-room room-objects)
  364. X             (list obj-key)))))
  365. X
  366. X  (if (and (= objnum obj-jar) (member obj-nitric jar) 
  367. X       (member obj-glycerine jar))
  368. X      (progn
  369. X    (mprincl "As the jar impacts the ground it explodes into many pieces.")
  370. X    (setq jar nil)
  371. X    (remove-obj-from-room current-room obj-jar)
  372. X    (if (= current-room fourth-vermont-intersection)
  373. X        (progn
  374. X          (setq hole t)
  375. X          (setq current-room vermont-station)
  376. X          (mprincl 
  377. X"The explosion causes a hole to open up in the ground, which you fall
  378. Xthrough.")))))
  379. X
  380. X  (if (and (= objnum obj-weight) (= current-room maze-button-room))
  381. X      (mprincl "A passageway opens.")))
  382. X
  383. X;;; Give long description of current room, or an object.
  384. X      
  385. X(defun examine (obj)
  386. X  (let (objnum)
  387. X    (setq objnum (objnum-from-args obj))
  388. X    (if (eq objnum obj-special)
  389. X    (describe-room (* current-room -1))
  390. X      (if (and (eq objnum obj-computer)
  391. X           (member obj-pc (nth current-room room-silents)))
  392. X      (examine '("pc"))
  393. X    (if (eq objnum nil)
  394. X        (mprincl "I don't know what that is.")
  395. X      (if (and (not (member objnum (nth current-room room-objects)))
  396. X           (not (member objnum (nth current-room room-silents)))
  397. X           (not (member objnum inventory)))
  398. X          (mprincl "I don't see that here.")
  399. X        (if (>= objnum 0)
  400. X        (if (and (= objnum obj-bone) 
  401. X             (= current-room marine-life-area) black)
  402. X            (mprincl 
  403. X"In this light you can see some writing on the bone.  It says:
  404. XFor an explosive time, go to Fourth St. and Vermont.")
  405. X          (if (nth objnum physobj-desc)
  406. X              (mprincl (nth objnum physobj-desc))
  407. X            (mprincl "I see nothing special about that.")))
  408. X          (if (nth (abs objnum) permobj-desc)
  409. X          (progn
  410. X            (mprincl (nth (abs objnum) permobj-desc)))
  411. X        (mprincl "I see nothing special about that.")))))))))
  412. X
  413. X(defun take (obj)
  414. X  (if inbus
  415. X      (mprincl "You can't take anything while on the bus.")
  416. X  (setq obj (firstword obj))
  417. X  (if (not obj)
  418. X      (mprincl "You must supply an object.")
  419. X    (if (string= obj "all")
  420. X    (let (gotsome)
  421. X      (setq gotsome nil)
  422. X      (dolist (x (nth current-room room-objects))
  423. X        (if (and (>= x 0) (not (= x obj-special)))
  424. X        (progn
  425. X          (setq gotsome t)
  426. X          (mprinc (cadr (nth x objects)))
  427. X          (mprinc ": ")
  428. X          (take-object x))))
  429. X      (if (not gotsome)
  430. X          (mprincl "Nothing to take.")))
  431. X      (let (objnum)
  432. X    (setq objnum (cdr (assq (intern obj) objnames)))
  433. X    (if (eq objnum nil)
  434. X        (progn
  435. X          (mprinc "I don't know what that is.")
  436. X          (mprinc "\n"))
  437. X      (take-object objnum)))))))
  438. X
  439. X(defun take-object (objnum)
  440. X  (if (and (member objnum jar) (member obj-jar inventory))
  441. X      (let (newjar)
  442. X    (mprincl "You remove it from the jar.")
  443. X    (setq newjar nil)
  444. X    (dolist (x jar)
  445. X      (if (not (= x objnum))
  446. X          (setq newjar (append newjar (list x)))))
  447. X    (setq jar newjar)
  448. X    (setq inventory (append inventory (list objnum))))
  449. X    (if (not (member objnum (nth current-room room-objects)))
  450. X    (if (not (member objnum (nth current-room room-silents)))
  451. X        (mprinc "I do not see that here.")
  452. X      (try-take objnum))
  453. X      (if (>= objnum 0)
  454. X      (progn
  455. X        (if (and (car inventory) 
  456. X             (> (+ (inven-weight) (nth objnum object-lbs)) 11))
  457. X        (mprinc "Your load would be too heavy.")
  458. X          (setq inventory (append inventory (list objnum)))
  459. X          (remove-obj-from-room current-room objnum)
  460. X          (mprinc "Taken.  ")
  461. X          (if (and (= objnum obj-towel) (= current-room red-room))
  462. X          (mprinc "Taking the towel reveals a hole in the floor."))))
  463. X    (try-take objnum)))
  464. X    (mprinc "\n")))
  465. X
  466. X(defun inven-weight ()
  467. X  (let (total)
  468. X    (setq total 0)
  469. X    (dolist (x jar)
  470. X      (setq total (+ total (nth x object-lbs))))
  471. X    (dolist (x inventory)
  472. X      (setq total (+ total (nth x object-lbs)))) total))
  473. X
  474. X;;; We try to take an object that is untakable.  Print a message
  475. X;;; depending on what it is.
  476. X
  477. X(defun try-take (obj)
  478. X  (mprinc "You cannot take that."))
  479. X
  480. X(defun dig (args)
  481. X  (if inbus
  482. X      (mprincl "You can't dig while on the bus.")
  483. X  (if (not (member 0 inventory))
  484. X      (mprincl "You have nothing with which to dig.")
  485. X    (if (not (nth current-room diggables))
  486. X    (mprincl "Digging here reveals nothing.")
  487. X      (mprincl "I think you found something.")
  488. X      (replace room-objects current-room
  489. X           (append (nth current-room room-objects)
  490. X               (nth current-room diggables)))
  491. X      (replace diggables current-room nil)))))
  492. X
  493. X(defun climb (obj)
  494. X  (let (objnum)
  495. X    (setq objnum (objnum-from-args obj))
  496. X    (if (and (not (= objnum obj-special))
  497. X         (not (member objnum (nth current-room room-objects)))
  498. X         (not (member objnum (nth current-room room-silents)))
  499. X         (not (member objnum inventory)))
  500. X    (mprincl "I don't see that here.")
  501. X      (if (and (= objnum obj-special)
  502. X           (not (member obj-tree (nth current-room room-silents))))
  503. X      (mprincl "There is nothing here to climb.")
  504. X    (if (and (not (= objnum obj-tree)) (not (= objnum obj-special)))
  505. X        (mprincl "You can't climb that.")
  506. X      (mprincl
  507. X"You manage to get about two feet up the tree and fall back down.  You
  508. Xnotice that the tree is very unsteady."))))))
  509. X
  510. X(defun eat (obj)
  511. X  (let (objnum)
  512. X    (when (setq objnum (objnum-from-args-std obj))
  513. X      (if (not (member objnum inventory))
  514. X      (mprincl "You don't have that.")
  515. X    (if (not (= objnum obj-food))
  516. X        (progn
  517. X          (mprinc "You forcefully shove ")
  518. X          (mprinc (downcase (cadr (nth objnum objects))))
  519. X          (mprincl " down your throat, and start choking.")
  520. X          (die "choking"))
  521. X      (mprincl "That tasted horrible.")
  522. X      (remove-obj-from-inven obj-food))))))
  523. X
  524. X(defun dput (args)
  525. X  (if inbus
  526. X      (mprincl "You can't do that while on the bus")
  527. X    (let (newargs objnum objnum2 obj)
  528. X      (setq newargs (firstwordl args))
  529. X      (if (not newargs)
  530. X      (mprincl "You must supply an object")
  531. X    (setq obj (intern (car newargs)))
  532. X    (setq objnum (cdr (assq obj objnames)))
  533. X    (if (not objnum)
  534. X        (mprincl "I don't know what that object is.")
  535. X      (if (not (member objnum inventory))
  536. X          (mprincl "You don't have that.")
  537. X        (setq newargs (firstwordl (cdr newargs)))
  538. X        (setq newargs (firstwordl (cdr newargs)))
  539. X        (if (not newargs)
  540. X        (mprincl "You must supply an indirect object.")
  541. X          (setq objnum2 (cdr (assq (intern (car newargs)) objnames)))
  542. X          (if (and (eq objnum2 obj-computer) (= current-room pc-area))
  543. X          (setq objnum2 obj-pc))
  544. X          (if (not objnum2)
  545. X          (mprincl "I don't know what that indirect object is.")
  546. X        (if (and (not (member objnum2 (nth current-room room-objects)))
  547. X             (not (member objnum2 (nth current-room room-silents)))
  548. X             (not (member objnum2 inventory)))
  549. X            (mprincl "That indirect object is not here.")
  550. X          (put-objs objnum objnum2))))))))))
  551. X
  552. X(defun put-objs (obj1 obj2)
  553. X  (if (and (= obj2 obj-drop) (not nomail))
  554. X      (setq obj2 obj-chute))
  555. X
  556. X  (if (= obj2 obj-disposal) (setq obj2 obj-chute))
  557. X
  558. X  (if (and (= obj1 obj-cpu) (= obj2 obj-computer))
  559. X      (progn
  560. X    (remove-obj-from-inven obj-cpu)
  561. X    (setq computer t)
  562. X    (mprincl
  563. X"As you put the CPU board in the computer, it immediately springs to life.
  564. XThe lights start flashing, and the fans seem to startup."))
  565. X    (if (and (= obj1 obj-weight) (= obj2 obj-button))
  566. X    (drop '("weight"))
  567. X      (if (= obj2 obj-jar)                 ;; Put something in jar
  568. X      (if (not (member obj1 (list obj-paper obj-diamond obj-emerald
  569. X                      obj-license obj-coins obj-egg
  570. X                      obj-nitric obj-glycerine)))
  571. X          (mprincl "That will not fit in the jar.")
  572. X        (remove-obj-from-inven obj1)
  573. X        (setq jar (append jar (list obj1)))
  574. X        (mprincl "Done."))
  575. X    (if (= obj2 obj-chute)                 ;; Put something in chute
  576. X        (progn
  577. X          (remove-obj-from-inven obj1)
  578. X          (mprincl 
  579. X"You hear it slide down the chute and off into the distance.")
  580. X          (put-objs-in-treas (list obj1)))
  581. X      (if (= obj2 obj-box)              ;; Put key in key box
  582. X          (if (= obj1 obj-key)
  583. X          (progn
  584. X            (mprincl
  585. X"As you drop the key, the box begins to shake.  Finally it explodes
  586. Xwith a bang.  The key seems to have vanished!")
  587. X            (remove-obj-from-inven obj1)
  588. X            (replace room-objects computer-room (append
  589. X                            (nth computer-room
  590. X                                 room-objects)
  591. X                            (list obj1)))
  592. X            (remove-obj-from-room current-room obj-box)
  593. X            (setq key-level (1+ key-level)))
  594. X        (mprincl "You can't put that in the key box!"))
  595. X
  596. X        (if (and (= obj1 obj-floppy) (= obj2 obj-pc))
  597. X        (progn
  598. X          (setq floppy t)
  599. X          (remove-obj-from-inven obj1)
  600. X          (mprincl "Done."))
  601. X
  602. X          (if (= obj2 obj-urinal)                   ;; Put object in urinal
  603. X          (progn
  604. X            (remove-obj-from-inven obj1)
  605. X            (replace room-objects urinal (append 
  606. X                          (nth urinal room-objects)
  607. X                           (list obj1)))
  608. X            (mprincl
  609. X             "You hear it plop down in some water below."))
  610. X        (if (= obj2 obj-mail)
  611. X            (mprincl "The mail chute is locked.")
  612. X          (if (member obj1 inventory)
  613. X              (mprincl 
  614. X"I don't know how to combine those objects.  Perhaps you should
  615. Xjust try dropping it.")
  616. X            (mprincl"You can't put that there.")))))))))))
  617. X
  618. X(defun type (args)
  619. X  (if (not (= current-room computer-room))
  620. X      (mprincl "There is nothing here on which you could type.")
  621. X    (if (not computer)
  622. X    (mprincl 
  623. X"You type on the keyboard, but your characters do not even echo.")
  624. X      (unix-interface))))
  625. X
  626. X;;;; Various movement directions
  627. X
  628. X(defun n (args)
  629. X  (move north))
  630. X
  631. X(defun s (args)
  632. X  (move south))
  633. X
  634. X(defun e (args)
  635. X  (move east))
  636. X
  637. X(defun w (args)
  638. X  (move west))
  639. X
  640. X(defun ne (args)
  641. X  (move northeast))
  642. X
  643. X(defun se (args)
  644. X  (move southeast))
  645. X
  646. X(defun nw (args)
  647. X  (move northwest))
  648. X
  649. X(defun sw (args)
  650. X  (move southwest))
  651. X
  652. X(defun up (args)
  653. X  (move up))
  654. X
  655. X(defun down (args)
  656. X  (move down))
  657. X
  658. X(defun in (args)
  659. X  (move in))
  660. X
  661. X(defun out (args)
  662. X  (move out))
  663. X
  664. X(defun go (args)
  665. X  (if (or (not (car args)) 
  666. X      (eq (doverb ignore verblist (car args) (cdr (cdr args))) -1))
  667. X      (mprinc "I don't understand where you want me to go.\n")))
  668. X
  669. X;; Uses the dungeon-map to figure out where we are going.  If the
  670. X;; requested direction yields 255, we know something special is
  671. X;; supposed to happen, or perhaps you can't go that way unless
  672. X;; certain conditions are met.
  673. X
  674. X(defun move (dir)
  675. X  (if (and (not (member current-room light-rooms)) 
  676. X       (not (member obj-lamp inventory)))
  677. X      (progn
  678. X    (mprinc 
  679. X"You trip over a grue and fall into a pit and break every bone in your
  680. Xbody.")
  681. X    (die "a grue"))
  682. X    (let (newroom)
  683. X      (setq newroom (nth dir (nth current-room dungeon-map)))
  684. X      (if (eq newroom -1)
  685. X      (mprinc "You can't go that way.\n")
  686. X    (if (eq newroom 255)
  687. X        (special-move dir)
  688. X      (setq room -1)
  689. X      (setq lastdir dir)
  690. X      (if inbus
  691. X          (progn
  692. X        (if (or (< newroom 58) (> newroom 83))
  693. X            (mprincl "The bus cannot go this way.")
  694. X          (mprincl 
  695. X           "The bus lurches ahead and comes to a screeching halt.")
  696. X          (remove-obj-from-room current-room obj-bus)
  697. X          (setq current-room newroom)
  698. X          (replace room-objects newroom
  699. X               (append (nth newroom room-objects)
  700. X                   (list obj-bus)))))
  701. X        (setq current-room newroom)))))))
  702. X
  703. X;; Movement in this direction causes something special to happen if the
  704. X;; right conditions exist.  It may be that you can't go this way unless
  705. X;; you have a key, or a passage has been opened.
  706. X
  707. X;; coding note: Each check of the current room is on the same 'if' level,
  708. X;; i.e. there aren't else's.  If two rooms next to each other have
  709. X;; specials, and they are connected by specials, this could cause
  710. X;; a problem.  Be careful when adding them to consider this, and
  711. X;; perhaps use else's.
  712. X
  713. X(defun special-move (dir)
  714. X  (if (= current-room building-front)
  715. X      (if (not (member obj-key inventory))
  716. X      (mprincl "You don't have a key that can open this door.")
  717. X    (setq current-room old-building-hallway))
  718. X    (if (= current-room north-end-of-cave-passage)
  719. X    (let (combo)
  720. X      (mprincl 
  721. X"You must type a 3 digit combination code to enter this room.")
  722. X      (mprinc "Enter it here: ")
  723. X      (setq combo (read-line))
  724. X      (if (not batch-mode)
  725. X          (mprinc "\n"))
  726. X      (if (string= combo combination)
  727. X          (setq current-room gamma-computing-center)
  728. X        (mprincl "Sorry, that combination is incorrect."))))
  729. X
  730. X    (if (= current-room bear-hangout)
  731. X    (if (member obj-bear (nth bear-hangout room-objects))
  732. X        (progn
  733. X          (mprinc 
  734. X"The bear is very annoyed that you would be so presumptuous as to try
  735. Xand walk right by it.  He tells you so by tearing your head off.
  736. X")
  737. X          (die "a bear"))
  738. X      (mprincl "You can't go that way.")))
  739. X
  740. X    (if (= current-room vermont-station)
  741. X    (progn
  742. X      (mprincl
  743. X"As you board the train it immediately leaves the station.  It is a very
  744. Xbumpy ride.  It is shaking from side to side, and up and down.  You
  745. Xsit down in one of the chairs in order to be more comfortable.")
  746. X      (mprincl
  747. X"\nFinally the train comes to a sudden stop, and the doors open, and some
  748. Xforce throws you out.  The train speeds away.\n")
  749. X      (setq current-room museum-station)))
  750. X
  751. X    (if (= current-room old-building-hallway)
  752. X    (if (and (member obj-key inventory)
  753. X         (> key-level 0))
  754. X        (setq current-room meadow)
  755. X      (mprincl "You don't have a key that can open this door.")))
  756. X
  757. X    (if (and (= current-room maze-button-room) (= dir northwest))
  758. X    (if (member obj-weight (nth maze-button-room room-objects))
  759. X        (setq current-room 18)
  760. X      (mprincl "You can't go that way.")))
  761. X
  762. X    (if (and (= current-room maze-button-room) (= dir up))
  763. X    (if (member obj-weight (nth maze-button-room room-objects))
  764. X        (mprincl "You can't go that way.")
  765. X      (setq current-room weight-room)))
  766. X
  767. X    (if (= current-room classroom)
  768. X    (mprincl "The door is locked."))
  769. X
  770. X    (if (or (= current-room lakefront-north) (= current-room lakefront-south))
  771. X    (swim nil))
  772. X
  773. X    (if (= current-room reception-area)
  774. X    (if (not (= sauna-level 3))
  775. X        (setq current-room health-club-front)
  776. X      (mprincl
  777. X"As you exit the building, you notice some flames coming out of one of the
  778. Xwindows.  Suddenly, the building explodes in a huge ball of fire.  The flames
  779. Xengulf you, and you burn to death.")
  780. X      (die "burning")))
  781. X
  782. X    (if (= current-room red-room)
  783. X    (if (not (member obj-towel (nth red-room room-objects)))
  784. X        (setq current-room long-n-s-hallway)
  785. X      (mprincl "You can't go that way.")))
  786. X
  787. X    (if (and (> dir down) (> current-room gamma-computing-center) 
  788. X         (< current-room museum-lobby))
  789. X    (if (not (member obj-bus (nth current-room room-objects)))
  790. X        (mprincl "You can't go that way.")
  791. X      (if (= dir in)
  792. X          (if (member obj-license inventory)
  793. X          (progn
  794. X            (mprincl "You board the bus and get in the driver's seat.")
  795. X            (setq nomail t)
  796. X            (setq inbus t))
  797. X        (mprincl "You are not licensed for this type of vehicle."))
  798. X        (mprincl "You hop off the bus.")
  799. X        (setq inbus nil)))
  800. X      (if (= current-room fifth-oaktree-intersection)
  801. X      (if (not inbus)
  802. X          (progn
  803. X        (mprincl "You fall down the cliff and land on your head.")
  804. X        (die "a cliff"))
  805. X        (mprincl
  806. X"The bus flies off the cliff, and plunges to the bottom, where it explodes.")
  807. X        (die "a bus accident")))
  808. X      (if (= current-room main-maple-intersection)
  809. X      (progn
  810. X        (if (not inbus)
  811. X        (mprincl "The gate will not open.")
  812. X          (mprincl
  813. X"As the bus approaches, the gate opens and you drive through.")
  814. X          (remove-obj-from-room main-maple-intersection obj-bus)
  815. X          (replace room-objects museum-entrance 
  816. X               (append (nth museum-entrance room-objects)
  817. X                   (list obj-bus)))
  818. X          (setq current-room museum-entrance)))))
  819. X    (if (= current-room cave-entrance)
  820. X    (progn
  821. X      (mprincl
  822. X"As you enter the room you hear a rumbling noise.  You look back to see
  823. Xhuge rocks sliding down from the ceiling, and blocking your way out.\n")
  824. X      (setq current-room misty-room)))))
  825. X
  826. X(defun long (args)
  827. X  (setq mode "long"))
  828. X
  829. X(defun turn (obj)
  830. X  (let (objnum direction)
  831. X    (when (setq objnum (objnum-from-args-std obj))
  832. X      (if (not (or (member objnum (nth current-room room-objects))
  833. X           (member objnum (nth current-room room-silents))))
  834. X      (mprincl "I don't see that here.")
  835. X    (if (not (= objnum obj-dial))
  836. X        (mprincl "You can't turn that.")
  837. X      (setq direction (firstword (cdr obj)))
  838. X      (if (or (not direction) 
  839. X          (not (or (string= direction "clockwise")
  840. X               (string= direction "counterclockwise"))))
  841. X          (mprincl "You must indicate clockwise or counterclockwise.")
  842. X        (if (string= direction "clockwise")
  843. X        (setq sauna-level (+ sauna-level 1))
  844. X          (setq sauna-level (- sauna-level 1)))
  845. X        
  846. X        (if (< sauna-level 0)
  847. X        (progn
  848. X          (mprincl 
  849. X           "The dial will not turn further in that direction.")
  850. X          (setq sauna-level 0))
  851. X          (sauna-heat))))))))
  852. X
  853. X(defun sauna-heat ()
  854. X  (if (= sauna-level 0)
  855. X      (mprincl "The termperature has returned to normal room termperature."))
  856. X  (if (= sauna-level 1)
  857. X      (mprincl "It is now luke warm in here.  You begin to sweat."))
  858. X  (if (= sauna-level 2)
  859. X      (mprincl "It is pretty hot in here.  It is still very comfortable."))
  860. X  (if (= sauna-level 3)
  861. X      (progn
  862. X    (mprincl 
  863. X"It is now very hot.  There is something very refreshing about this.")
  864. X    (if (or (member obj-rms inventory) 
  865. X        (member obj-rms (nth current-room room-objects)))
  866. X        (progn
  867. X          (mprincl 
  868. X"You notice the wax on your statuette beginning to melt, until it completely
  869. Xmelts off.  You are left with a beautiful diamond!")
  870. X          (if (member obj-rms inventory)
  871. X          (progn
  872. X            (remove-obj-from-inven obj-rms)
  873. X            (setq inventory (append inventory (list obj-diamond))))
  874. X        (remove-obj-from-room current-room obj-rms)
  875. X        (replace room-objects current-room
  876. X             (append (nth current-room room-objects)
  877. X                 (list obj-diamond))))))
  878. X    (if (or (member obj-floppy inventory)
  879. X        (member obj-floppy (nth current-room room-objects)))
  880. X        (progn
  881. X          (mprincl
  882. X"You notice your floppy disk beginning to melt.  As you grab for it, the 
  883. Xdisk bursts into flames, and disintegrates.")
  884. X          (if (member obj-floppy inventory)
  885. X          (remove-obj-from-inven obj-floppy)
  886. X        (remove-obj-from-room current-room obj-floppy))))))
  887. X
  888. X  (if (= sauna-level 4)
  889. X      (progn
  890. X    (mprincl 
  891. X"As the dial clicks into place, you immediately burst into flames.")
  892. X    (die "burning"))))
  893. X
  894. X(defun press (obj)
  895. X  (let (objnum)
  896. X    (when (setq objnum (objnum-from-args-std obj))
  897. X      (if (not (or (member objnum (nth current-room room-objects))
  898. X           (member objnum (nth current-room room-silents))))
  899. X      (mprincl "I don't see that here.")
  900. X    (if (not (member objnum (list obj-button obj-switch)))
  901. X        (progn
  902. X          (mprinc "You can't ")
  903. X          (mprinc (car line-list))
  904. X          (mprincl " that."))
  905. X      (if (= objnum obj-button)
  906. X          (mprincl
  907. X"As you press the button, you notice a passageway open up, but
  908. Xas you release it, the passageway closes."))
  909. X      (if (= objnum obj-switch)
  910. X          (if black
  911. X          (progn
  912. X            (mprincl "The button is now in the off position.")
  913. X            (setq black nil))
  914. X        (mprincl "The button is now in the on position.")
  915. X        (setq black t))))))))
  916. X
  917. X(defun swim (args)
  918. X  (if (not (member current-room (list lakefront-north lakefront-south)))
  919. X      (mprincl "I see no water!")
  920. X    (if (not (member obj-life inventory))
  921. X    (progn
  922. X      (mprincl 
  923. X"You dive in the water, and at first notice it is quite cold.  You then
  924. Xstart to get used to it as you realize that you never really learned how
  925. Xto swim.")
  926. X      (die "drowning"))
  927. X      (if (= current-room lakefront-north)
  928. X      (setq current-room lakefront-south)
  929. X    (setq current-room lakefront-north)))))
  930. X
  931. X
  932. X(defun score (args)
  933. X  (if (not endgame)
  934. X      (let (total)
  935. X    (setq total (reg-score))
  936. X    (mprinc "You have scored ")
  937. X    (mprinc total)
  938. X    (mprincl " out of a possible 90 points.") total)
  939. X    (mprinc "You have scored ")
  940. X    (mprinc (endgame-score))
  941. X    (mprincl " endgame points out of a possible 110.")
  942. X    (if (= (endgame-score) 110)
  943. X    (mprincl 
  944. X"\n\nCongratulations.  You have won.  The wizard password is 'moby'"))))
  945. X
  946. X(defun help (args)
  947. X  (mprincl
  948. X"Welcome to dunnet (2.0), by Ron Schnell (ronnie@media.mit.edu).
  949. XHere is some useful information (read carefully because there are one
  950. Xor more clues in here):
  951. X
  952. X- If you have a key that can open a door, you do not need to explicitly
  953. X  open it.  You may just use 'in' or walk in the direction of the door.
  954. X
  955. X- If you have a lamp, it is always lit.
  956. X
  957. X- You will not get any points until you manage to get treasures to a certain
  958. X  place.  Simply finding the treasures is not good enough.  There is more
  959. X  than one way to get a treasure to the special place.  It is also
  960. X  important that the objects get to the special place *unharmed* and
  961. X  *untarnished*.  You can tell if you have successfully transported the
  962. X  object by looking at your score, as it changes immediately.  Note that
  963. X  an object can become harmed even after you have received points for it.
  964. X  If this happens, your score will decrease, and in many cases you can never
  965. X  get credit for it again.
  966. X
  967. X- You can save your game with the 'save' command, and use restore it
  968. X  with the 'restore' command.
  969. X
  970. X- There are no limits on lengths of object names.
  971. X
  972. X- Directions are: north,south,east,west,northeast,southeast,northwest,
  973. X                  southwest,up,down,in,out.
  974. X
  975. X- These can be abbreviated: n,s,e,w,ne,se,nw,sw,u,d,in,out.
  976. X
  977. X- If you go down a hole in the floor without an aid such as a ladder,
  978. X  you probably won't be able to get back up the way you came, if at all.
  979. X
  980. X- It is possible to get the maximum points.
  981. X
  982. XIf you have questions or comments, contact ronnie@media.mit.edu."))
  983. X
  984. X(defun flush (args)
  985. X  (if (not (= current-room bathroom))
  986. X      (mprincl "I see nothing to flush.")
  987. X    (mprincl "Whoooosh!!")
  988. X    (put-objs-in-treas (nth urinal room-objects))
  989. X    (replace room-objects urinal nil)))
  990. X
  991. X(defun piss (args)
  992. X  (if (not (= current-room bathroom))
  993. X      (mprincl "You can't do that here, don't even bother trying.")
  994. X    (if (not gottago)
  995. X    (mprincl "I'm afraid you don't have to go now.")
  996. X      (mprincl "That was refreshing.")
  997. X      (setq gottago nil)
  998. X      (replace room-objects urinal (append (nth urinal room-objects)
  999. X                       (list obj-URINE))))))
  1000. X
  1001. X
  1002. X(defun dsleep (args)
  1003. X  (if (not (= current-room bedroom))
  1004. X      (mprincl
  1005. X"You try to go to sleep while standing up here, but can't seem to do it.")
  1006. X    (setq gottago t)
  1007. X    (mprincl
  1008. X"As soon as you start to doze off you begin dreaming.  You see images of
  1009. Xworkers digging caves, slaving in the humid heat.  Then you see yourself
  1010. Xas one of these workers.  While no one is looking, you leave the group
  1011. Xand walk into a room.  The room is bare except for a horseshoe
  1012. Xshaped piece of stone in the center.  You see yourself digging a hole in
  1013. Xthe ground, then putting some kind of treasure in it, and filling the hole
  1014. Xwith dirt again.  After this, you immediately wake up.")))
  1015. X
  1016. X(defun break (obj)
  1017. X  (let (objnum)
  1018. X    (if (not (member obj-axe inventory))
  1019. X    (mprincl "You have nothing you can use to break things.")
  1020. X      (when (setq objnum (objnum-from-args-std obj))
  1021. X    (if (member objnum inventory)
  1022. X        (progn
  1023. X          (mprincl
  1024. X"You take the object in your hands and swing the axe.  Unfortunately, you miss
  1025. Xthe object and slice off your hand.  You bleed to death.")
  1026. X          (die "an axe"))
  1027. X      (if (not (or (member objnum (nth current-room room-objects))
  1028. X               (member objnum (nth current-room room-silents))))
  1029. X          (mprincl "I don't see that here.")
  1030. X        (if (= objnum obj-cable)
  1031. X        (progn
  1032. X          (mprincl 
  1033. X"As you break the ethernet cable, everything starts to blur.  You collapse
  1034. Xfor a moment, then straighten yourself up.
  1035. X")
  1036. X          (replace room-objects gamma-computing-center
  1037. X               (append (nth gamma-computing-center room-objects)
  1038. X                   inventory))
  1039. X          (if (member obj-key inventory)
  1040. X              (progn
  1041. X            (setq inventory (list obj-key))
  1042. X            (remove-obj-from-room gamma-computing-center obj-key))
  1043. X            (setq inventory nil))
  1044. X          (setq current-room computer-room)
  1045. X          (setq ethernet nil)
  1046. X          (mprincl "Connection closed.")
  1047. X          (unix-interface))
  1048. X          (if (< objnum 0)
  1049. X          (progn
  1050. X            (mprincl "Your axe shatters into a million pieces.")
  1051. X            (remove-obj-from-inven obj-axe))
  1052. X        (mprincl "Your axe breaks it into a million pieces.")
  1053. X        (remove-obj-from-room current-room objnum)))))))))
  1054. X
  1055. X(defun drive (args)
  1056. X  (if (not inbus)
  1057. X      (mprincl "You cannot drive when you aren't in a vehicle.")
  1058. X    (mprincl "To drive while you are in the bus, just give a direction.")))
  1059. X
  1060. X(defun superb (args)
  1061. X  (setq mode 'superb))
  1062. X
  1063. X(defun reg-score ()
  1064. X  (let (total)
  1065. X    (setq total 0)
  1066. X    (dolist (x (nth treasure-room room-objects))
  1067. X      (setq total (+ total (nth x object-pts))))
  1068. X    (if (member obj-URINE (nth treasure-room room-objects))
  1069. X    (setq total 0)) total))
  1070. X
  1071. X(defun endgame-score ()
  1072. X  (let (total)
  1073. X    (setq total 0)
  1074. X    (dolist (x (nth endgame-treasure-room room-objects))
  1075. X      (setq total (+ total (nth x object-pts)))) total))
  1076. X
  1077. X(defun answer (args)
  1078. X  (if (not correct-answer)
  1079. X      (mprincl "I don't believe anyone asked you anything.")
  1080. X    (setq args (car args))
  1081. X    (if (not args)
  1082. X    (mprincl "You must give the answer on the same line.")
  1083. X      (if (members args correct-answer)
  1084. X      (progn
  1085. X        (mprincl "Correct.")
  1086. X        (if (= lastdir 0)
  1087. X        (setq current-room (1+ current-room))
  1088. X          (setq current-room (- current-room 1)))
  1089. X        (setq correct-answer nil))
  1090. X    (mprincl "That answer is incorrect.")))))
  1091. X
  1092. X(defun endgame-question ()
  1093. X(if (not endgame-questions)
  1094. X    (progn
  1095. X      (mprincl "Your question is:")
  1096. X      (mprincl "No more questions, just do 'answer foo'.")
  1097. X      (setq correct-answer '("foo")))
  1098. X  (let (which i newques)
  1099. X    (setq i 0)
  1100. X    (setq newques nil)
  1101. X    (setq which (% (abs (random)) (length endgame-questions)))
  1102. X    (mprincl "Your question is:")
  1103. X    (mprincl (setq endgame-question (car (nth which endgame-questions))))
  1104. X    (setq correct-answer (cdr (nth which endgame-questions)))
  1105. X    (while (< i which)
  1106. X      (setq newques (append newques (list (nth i endgame-questions))))
  1107. X      (setq i (1+ i)))
  1108. X    (setq i (1+ which))
  1109. X    (while (< i (length endgame-questions))
  1110. X      (setq newques (append newques (list (nth i endgame-questions))))
  1111. X      (setq i (1+ i)))
  1112. X    (setq endgame-questions newques))))
  1113. X
  1114. X(defun dun-power (args)
  1115. X  (if (not (= current-room pc-area))
  1116. X      (mprincl "That operation is not applicable here.")
  1117. X    (if (not floppy)
  1118. X    (dos-no-disk)
  1119. X      (dos-interface))))
  1120. X
  1121. X(defun touka (args)
  1122. X  (setq current-room computer-room)
  1123. X  (setq logged-in t)
  1124. X  (setq computer t))
  1125. X
  1126. X(defun dun-feed (args)
  1127. X  (let (objnum)
  1128. X    (when (setq objnum (objnum-from-args-std args))
  1129. X      (if (and (= objnum obj-bear) 
  1130. X           (member obj-bear (nth current-room room-objects)))
  1131. X      (progn
  1132. X        (if (not (member obj-food inventory))
  1133. X        (mprincl "You have nothing with which to feed it.")
  1134. X          (drop '("food"))))
  1135. X    (if (not (or (member objnum (nth current-room room-objects))
  1136. X             (member objnum inventory)
  1137. X             (member objnum (nth current-room room-silents))))
  1138. X        (mprincl "I don't see that here.")
  1139. X      (mprincl "You cannot feed that."))))))
  1140. END_OF_FILE
  1141. if test 32652 -ne `wc -c <'dun-commands.el'`; then
  1142.     echo shar: \"'dun-commands.el'\" unpacked with wrong size!
  1143. fi
  1144. chmod +x 'dun-commands.el'
  1145. # end of 'dun-commands.el'
  1146. fi
  1147. if test -f 'dun-dos.el' -a "${1}" != "-c" ; then 
  1148.   echo shar: Will not clobber existing file \"'dun-dos.el'\"
  1149. else
  1150. echo shar: Extracting \"'dun-dos.el'\" \(2389 characters\)
  1151. sed "s/^X//" >'dun-dos.el' <<'END_OF_FILE'
  1152. X;;;;;;;;;;;;;;;;;;;
  1153. X;;;;
  1154. X;;;; DOS
  1155. X;;;;
  1156. X;;;;;;;;;;;;;;;;;;;
  1157. X
  1158. X(if nil
  1159. X    (eval-and-compile (setq byte-compile-warnings nil)))
  1160. X
  1161. X(defun dos-parse (args)
  1162. X  (interactive "*p")
  1163. X  (beginning-of-line)
  1164. X  (let (beg)
  1165. X    (setq beg (+ (point) 3))
  1166. X    (end-of-line)
  1167. X    (if (not (= beg (point)))
  1168. X    (let (line)
  1169. X      (setq line (downcase (buffer-substring beg (point))))
  1170. X      (princ line)
  1171. X      (if (eq (parse2 nil dos-verbs line) -1)
  1172. X          (progn
  1173. X        (sleep-for 1)
  1174. X        (mprincl "Bad command or file name"))))
  1175. X      (goto-char (point-max))
  1176. X      (mprinc "\n"))
  1177. X    (if (eq dungeon-mode 'dos)
  1178. X    (progn
  1179. X      (fix-screen)
  1180. X      (dos-prompt)))))
  1181. X
  1182. X(defun dos-interface ()
  1183. X  (dos-boot-msg)
  1184. X  (setq dungeon-mode 'dos)
  1185. X  (define-key dungeon-mode-map "\r" 'dos-parse)
  1186. X  (dos-prompt))
  1187. X
  1188. X(defun dos-type (args)
  1189. X  (sleep-for 2)
  1190. X  (if (setq args (car args))
  1191. X      (if (string= args "foo.txt")
  1192. X      (dos-show-combination)
  1193. X    (if (string= args "command.com")
  1194. X        (mprincl "Cannot type binary files")
  1195. X      (mprinc "File not found - ")
  1196. X      (mprincl (upcase args))))
  1197. X    (mprincl "Must supply file name")))
  1198. X
  1199. X(defun dos-invd (args)
  1200. X  (sleep-for 1)
  1201. X  (mprincl "Invalid drive specification"))
  1202. X
  1203. X(defun dos-dir (args)
  1204. X  (sleep-for 1)
  1205. X  (if (or (not (setq args (car args))) (string= args "\\"))
  1206. X      (mprincl "
  1207. X Volume in drive A is FOO        
  1208. X Volume Serial Number is 1A16-08C9
  1209. X Directory of A:\\
  1210. X
  1211. XCOMMAND  COM     47845 04-09-91   2:00a
  1212. XFOO      TXT        40 01-20-93   1:01a
  1213. X        2 file(s)      47845 bytes
  1214. X                     1065280 bytes free
  1215. X")
  1216. X    (mprincl "
  1217. X Volume in drive A is FOO        
  1218. X Volume Serial Number is 1A16-08C9
  1219. X Directory of A:\\
  1220. X
  1221. XFile not found")))
  1222. X
  1223. X
  1224. X(defun dos-prompt ()
  1225. X  (mprinc "A> "))
  1226. X
  1227. X(defun dos-boot-msg ()
  1228. X  (sleep-for 3)
  1229. X  (mprinc "Current time is ")
  1230. X  (mprincl (substring (current-time-string) 12 20))
  1231. X  (mprinc "Enter new time: ")
  1232. X  (read-line)
  1233. X  (if (not batch-mode)
  1234. X      (mprinc "\n")))
  1235. X
  1236. X(defun dos-spawn (args)
  1237. X  (sleep-for 1)
  1238. X  (mprincl "Cannot spawn subshell"))
  1239. X
  1240. X(defun dos-exit (args)
  1241. X  (setq dungeon-mode 'dungeon)
  1242. X  (mprincl "\nYou power down the machine and step back.")
  1243. X  (define-key dungeon-mode-map "\r" 'dungeon-parse)
  1244. X  (if (not batch-mode)
  1245. X      (dungeon-messages)))
  1246. X
  1247. X(defun dos-no-disk ()
  1248. X  (sleep-for 3)
  1249. X  (mprincl "Boot sector not found"))
  1250. X
  1251. X
  1252. X(defun dos-show-combination ()
  1253. X  (sleep-for 2)
  1254. X  (mprinc "\nThe combination is ")
  1255. X  (mprinc combination)
  1256. X  (mprinc ".\n"))
  1257. X
  1258. X(defun dos-nil (args))
  1259. END_OF_FILE
  1260. if test 2389 -ne `wc -c <'dun-dos.el'`; then
  1261.     echo shar: \"'dun-dos.el'\" unpacked with wrong size!
  1262. fi
  1263. chmod +x 'dun-dos.el'
  1264. # end of 'dun-dos.el'
  1265. fi
  1266. if test -f 'dun-unix.el' -a "${1}" != "-c" ; then 
  1267.   echo shar: Will not clobber existing file \"'dun-unix.el'\"
  1268. else
  1269. echo shar: Extracting \"'dun-unix.el'\" \(14344 characters\)
  1270. sed "s/^X//" >'dun-unix.el' <<'END_OF_FILE'
  1271. X;;;;;;;;;;;;;;;;;;;
  1272. X;;;;
  1273. X;;;; UNIX
  1274. X;;;;
  1275. X;;;;;;;;;;;;;;;;;;;
  1276. X
  1277. X(if nil
  1278. X    (eval-and-compile (setq byte-compile-warnings nil)))
  1279. X
  1280. X(defun unix-parse (args)
  1281. X  (interactive "*p")
  1282. X  (beginning-of-line)
  1283. X  (let (beg esign)
  1284. X    (setq beg (+ (point) 2))
  1285. X    (end-of-line)
  1286. X    (if (and (not (= beg (point)))
  1287. X         (string= "$" (buffer-substring (- beg 2) (- beg 1))))
  1288. X    (progn
  1289. X      (setq line (downcase (buffer-substring beg (point))))
  1290. X      (princ line)
  1291. X      (if (eq (parse2 nil unix-verbs line) -1)
  1292. X          (progn
  1293. X        (if (setq esign (string-match "=" line))
  1294. X            (doassign line esign)        
  1295. X          (mprinc (car line-list))
  1296. X          (mprincl ": not found.")))))
  1297. X      (goto-char (point-max))
  1298. X      (mprinc "\n"))
  1299. X    (if (eq dungeon-mode 'unix)
  1300. X    (progn
  1301. X      (fix-screen)
  1302. X      (mprinc "$ ")))))
  1303. X
  1304. X(defun doassign (line esign)
  1305. X  (if (not wizard)
  1306. X      (let (passwd)
  1307. X    (mprinc "Enter wizard password: ")
  1308. X    (setq passwd (read-line))
  1309. X    (if (not batch-mode)
  1310. X        (mprinc "\n"))
  1311. X    (if (string= passwd "moby")
  1312. X        (progn
  1313. X          (setq wizard t)
  1314. X          (doassign line esign))
  1315. X      (mprincl "Incorrect.")))
  1316. X
  1317. X    (let (varname epoint afterq i value)
  1318. X      (setq varname (substring line 0 esign))
  1319. X      (if (not (setq epoint (string-match ")" line)))
  1320. X      (if (string= (substring line (1+ esign) (+ esign 2))
  1321. X               "\"")
  1322. X          (progn
  1323. X        (setq afterq (substring line (+ esign 2)))
  1324. X        (setq epoint (+
  1325. X                  (string-match "\"" afterq)
  1326. X                  (+ esign 3))))
  1327. X        
  1328. X        (if (not (setq epoint (string-match " " line)))
  1329. X        (setq epoint (length line))))
  1330. X    (setq epoint (1+ epoint))
  1331. X    (while (and
  1332. X        (not (= epoint (length line)))
  1333. X        (setq i (string-match ")" (substring line epoint))))
  1334. X      (setq epoint (+ epoint i 1))))
  1335. X      (setq value (substring line (1+ esign) epoint))
  1336. X      (dungeon-eval varname value))))
  1337. X
  1338. X(defun dungeon-eval (varname value)
  1339. X  (let (eval-error)
  1340. X    (switch-to-buffer (get-buffer-create "*dungeon-eval*"))
  1341. X    (erase-buffer)
  1342. X    (insert "(setq ")
  1343. X    (insert varname)
  1344. X    (insert " ")
  1345. X    (insert value)
  1346. X    (insert ")")
  1347. X    (setq eval-error nil)
  1348. X    (condition-case nil
  1349. X    (eval-current-buffer)
  1350. X      (error (setq eval-error t)))
  1351. X    (kill-buffer (current-buffer))
  1352. X    (switch-to-buffer "*dungeon*")
  1353. X    (if eval-error
  1354. X    (mprincl "Invalid syntax."))))
  1355. X  
  1356. X
  1357. X(defun unix-interface ()
  1358. X  (login)
  1359. X  (if logged-in
  1360. X      (progn
  1361. X    (setq dungeon-mode 'unix)
  1362. X    (define-key dungeon-mode-map "\r" 'unix-parse)
  1363. X    (mprinc "$ "))))
  1364. X
  1365. X
  1366. X
  1367. X(defun login ()
  1368. X  (let (tries username password)
  1369. X    (setq tries 4)
  1370. X    (while (and (not logged-in) (> (setq tries (- tries 1)) 0))
  1371. X      (mprinc "\n\nUNIX System V, Release 2.2 (pokey)\n\nlogin: ")
  1372. X      (setq username (read-line))
  1373. X      (if (not batch-mode)
  1374. X      (mprinc "\n"))
  1375. X      (mprinc "password: ")
  1376. X      (setq password (read-line))
  1377. X      (if (not batch-mode)
  1378. X      (mprinc "\n"))
  1379. X      (if (or (not (string= username "toukmond"))
  1380. X          (not (string= password "robert")))
  1381. X      (mprincl "login incorrect")
  1382. X    (setq logged-in t)
  1383. X    (mprincl "
  1384. XWelcome to Unix\n
  1385. XPlease clean up your directories.  The filesystem is getting full.
  1386. XOur tcp/ip link to gamma is a little flakey, but seems to work.
  1387. XThe current version of ftp can only send files from the current
  1388. Xdirectory, and deletes them after they are sent!  Be careful.
  1389. X
  1390. XNote: Restricted bourne shell in use.\n")))
  1391. X  (setq dungeon-mode 'dungeon)))
  1392. X
  1393. X(defun ls (args)
  1394. X  (if (car args)
  1395. X      (let (ocdpath ocdroom)
  1396. X    (setq ocdpath cdpath)
  1397. X    (setq ocdroom cdroom)
  1398. X    (if (not (eq (dunnet-cd args) -2))
  1399. X        (ls nil))
  1400. X    (setq cdpath ocdpath)
  1401. X    (setq cdroom ocdroom))
  1402. X    (if (= cdroom -10)
  1403. X    (ls-inven))
  1404. X    (if (= cdroom -2)
  1405. X    (ls-rooms))
  1406. X    (if (= cdroom -3)
  1407. X    (ls-root))
  1408. X    (if (= cdroom -4)
  1409. X    (ls-usr))
  1410. X    (if (> cdroom 0)
  1411. X    (ls-room))))
  1412. X
  1413. X(defun ls-root ()
  1414. X  (mprincl "total 4
  1415. Xdrwxr-xr-x  3 root     staff           512 Jan 1 1970 .
  1416. Xdrwxr-xr-x  3 root     staff          2048 Jan 1 1970 ..
  1417. Xdrwxr-xr-x  3 root     staff          2048 Jan 1 1970 usr
  1418. Xdrwxr-xr-x  3 root     staff          2048 Jan 1 1970 rooms"))
  1419. X
  1420. X(defun ls-usr ()
  1421. X  (mprincl "total 4
  1422. Xdrwxr-xr-x  3 root     staff           512 Jan 1 1970 .
  1423. Xdrwxr-xr-x  3 root     staff          2048 Jan 1 1970 ..
  1424. Xdrwxr-xr-x  3 toukmond restricted      512 Jan 1 1970 toukmond"))
  1425. X
  1426. X(defun ls-rooms ()
  1427. X  (mprincl "total 16
  1428. Xdrwxr-xr-x  3 root     staff           512 Jan 1 1970 .
  1429. Xdrwxr-xr-x  3 root     staff          2048 Jan 1 1970 ..")
  1430. X  (dolist (x visited)
  1431. X    (mprinc
  1432. X"drwxr-xr-x  3 root     staff           512 Jan 1 1970 ")
  1433. X    (mprincl (nth x room-shorts))))
  1434. X
  1435. X(defun ls-room ()
  1436. X  (mprincl "total 4
  1437. Xdrwxr-xr-x  3 root     staff           512 Jan 1 1970 .
  1438. Xdrwxr-xr-x  3 root     staff          2048 Jan 1 1970 ..
  1439. X-rwxr-xr-x  3 root     staff          2048 Jan 1 1970 description")
  1440. X  (dolist (x (nth cdroom room-objects))
  1441. X    (if (and (>= x 0) (not (= x 255)))
  1442. X    (progn
  1443. X      (mprinc "-rwxr-xr-x  1 toukmond restricted        0 Jan 1 1970 ")
  1444. X      (mprincl (nth x objfiles))))))
  1445. X
  1446. X(defun ls-inven ()
  1447. X  (mprinc "total 467
  1448. Xdrwxr-xr-x  3 toukmond restricted      512 Jan 1 1970 .
  1449. Xdrwxr-xr-x  3 root     staff          2048 Jan 1 1970 ..")
  1450. X  (dolist (x unix-verbs)
  1451. X    (if (not (eq (car x) 'IMPOSSIBLE))
  1452. X    (progn
  1453. X      (mprinc"
  1454. X-rwxr-xr-x  1 toukmond restricted    10423 Jan 1 1970 ")
  1455. X      (mprinc (car x)))))
  1456. X  (mprinc "\n")
  1457. X  (if (not uncompressed)
  1458. X      (mprincl
  1459. X"-rwxr-xr-x  1 toukmond restricted        0 Jan 1 1970 paper.o.Z"))
  1460. X  (dolist (x inventory)
  1461. X    (mprinc 
  1462. X"-rwxr-xr-x  1 toukmond restricted        0 Jan 1 1970 ")
  1463. X    (mprincl (nth x objfiles))))
  1464. X
  1465. X(defun echo (args)
  1466. X  (let (nomore var)
  1467. X    (setq nomore nil)
  1468. X    (dolist (x args)
  1469. X        (if (not nomore)
  1470. X        (progn
  1471. X          (if (not (string= (substring x 0 1) "$"))
  1472. X              (progn
  1473. X            (mprinc x)
  1474. X            (mprinc " "))
  1475. X            (setq var (intern (substring x 1)))
  1476. X            (if (not (boundp var))
  1477. X            (mprinc " ")
  1478. X              (if (member var restricted)
  1479. X              (progn
  1480. X                (mprinc var)
  1481. X                (mprinc ": Permission denied")
  1482. X                (setq nomore t))
  1483. X            (eval (list 'mprinc var))
  1484. X            (mprinc " ")))))))
  1485. X        (mprinc "\n")))
  1486. X
  1487. X
  1488. X(defun ftp (args)
  1489. X  (let (host username passwd ident newlist)
  1490. X    (if (not (car args))
  1491. X    (mprincl "ftp: hostname required on command line.")
  1492. X      (setq host (intern (car args)))
  1493. X      (if (not (member host '(gamma endgame)))
  1494. X      (mprincl "ftp: Unknown host.")
  1495. X    (if (eq host 'endgame)
  1496. X        (mprincl "ftp: connection to endgame not allowed")
  1497. X      (if (not ethernet)
  1498. X          (mprincl "ftp: host not responding.")
  1499. X        (mprincl "Connected to gamma. FTP ver 0.9 00:00:00 01/01/70")
  1500. X        (mprinc "Username: ")
  1501. X        (setq username (read-line))
  1502. X        (if (string= username "toukmond")
  1503. X        (if batch-mode
  1504. X            (mprincl "toukmond ftp access not allowed.")
  1505. X          (mprincl "\ntoukmond ftp access not allowed."))
  1506. X          (if (string= username "anonymous")
  1507. X          (if batch-mode
  1508. X              (mprincl
  1509. X               "Guest login okay, send your user ident as password.")
  1510. X            (mprincl 
  1511. X             "\nGuest login okay, send your user ident as password."))
  1512. X        (if batch-mode
  1513. X            (mprinc "Password required for ")
  1514. X          (mprinc "\nPassword required for "))
  1515. X        (mprincl username))
  1516. X          (mprinc "Password: ")
  1517. X          (setq ident (read-line))
  1518. X          (if (not (string= username "anonymous"))
  1519. X          (if batch-mode
  1520. X              (mprincl "Login failed.")
  1521. X            (mprincl "\nLogin failed."))
  1522. X        (if batch-mode
  1523. X           (mprincl "Guest login okay, user access restrictions apply.")
  1524. X          (mprincl "\nGuest login okay, user access restrictions apply."))
  1525. X        (ftp-commands)
  1526. X        (setq newlist 
  1527. X'("What password did you use during anonymous ftp to gamma?"))
  1528. X        (setq newlist (append newlist (list ident)))
  1529. X        (rplaca (nthcdr 1 endgame-questions) newlist)))))))))
  1530. X  
  1531. X(defun ftp-commands ()
  1532. X    (setq exitf nil)
  1533. X    (let (line)
  1534. X      (while (not exitf)
  1535. X    (mprinc "ftp> ")
  1536. X    (setq line (read-line))
  1537. X    (if 
  1538. X        (eq
  1539. X         (parse2 nil 
  1540. X            '((type . ftptype) (binary . bin) (bin . bin) (send . send)
  1541. X              (put . send) (quit . ftpquit) (help . ftphelp)
  1542. X              (ascii . fascii)
  1543. X              ) line)
  1544. X         -1)
  1545. X        (mprincl "No such command.  Try help.")))
  1546. X      (setq ftptype 'ascii)))
  1547. X
  1548. X(defun ftptype (args)
  1549. X  (if (not (car args))
  1550. X      (mprincl "Usage: type [binary | ascii]")
  1551. X    (setq args (intern (car args)))
  1552. X    (if (eq args 'binary)
  1553. X    (bin nil)
  1554. X      (if (eq args 'ascii)
  1555. X      (fascii 'nil)
  1556. X    (mprincl "Unknown type.")))))
  1557. X
  1558. X(defun bin (args)
  1559. X  (mprincl "Type set to binary.")
  1560. X  (setq ftptype 'binary))
  1561. X
  1562. X(defun fascii (args)
  1563. X  (mprincl "Type set to ascii.")
  1564. X  (setq ftptype 'ascii))
  1565. X
  1566. X(defun ftpquit (args)
  1567. X  (setq exitf t))
  1568. X
  1569. X(defun send (args)
  1570. X  (if (not (car args))
  1571. X      (mprincl "Usage: send <filename>")
  1572. X    (setq args (car args))
  1573. X    (let (counter foo)
  1574. X      (setq foo nil)
  1575. X      (setq counter 0)
  1576. X
  1577. X;;; User can send commands!  Stupid user.
  1578. X
  1579. X
  1580. X      (if (assq (intern args) unix-verbs)
  1581. X      (progn
  1582. X        (rplaca (assq (intern args) unix-verbs) 'IMPOSSIBLE)
  1583. X        (mprinc "Sending ")
  1584. X        (mprinc ftptype)
  1585. X        (mprinc " file for ")
  1586. X        (mprincl args)
  1587. X        (mprincl "Transfer complete."))
  1588. X
  1589. X    (dolist (x objfiles)
  1590. X      (if (string= args x)
  1591. X          (progn
  1592. X        (if (not (member counter inventory))
  1593. X            (progn
  1594. X              (mprincl "No such file.")
  1595. X              (setq foo t))
  1596. X          (mprinc "Sending ")
  1597. X          (mprinc ftptype)
  1598. X          (mprinc " file for ")
  1599. X          (mprinc (downcase (cadr (nth counter objects))))
  1600. X          (mprincl ", (0 bytes)")
  1601. X          (if (not (eq ftptype 'binary))
  1602. X              (progn
  1603. X            (if (not (member obj-protoplasm
  1604. X                     (nth receiving-room room-objects)))
  1605. X                (replace room-objects receiving-room
  1606. X                     (append (nth receiving-room room-objects)
  1607. X                         (list obj-protoplasm))))
  1608. X            (remove-obj-from-inven counter))
  1609. X            (remove-obj-from-inven counter)
  1610. X            (replace room-objects receiving-room
  1611. X                 (append (nth receiving-room room-objects)
  1612. X                     (list counter))))
  1613. X          (setq foo t)
  1614. X          (mprincl "Transfer complete."))))
  1615. X      (setq counter (+ 1 counter)))
  1616. X    (if (not foo)
  1617. X        (mprincl "No such file."))))))
  1618. X
  1619. X(defun ftphelp (args)
  1620. X  (mprincl 
  1621. X   "Possible commands are:\nsend    quit    type   ascii  binary   help"))
  1622. X
  1623. X(defun uexit (args)
  1624. X  (setq dungeon-mode 'dungeon)
  1625. X  (mprincl "\nYou step back from the console.")
  1626. X  (define-key dungeon-mode-map "\r" 'dungeon-parse)
  1627. X  (if (not batch-mode)
  1628. X      (dungeon-messages)))
  1629. X
  1630. X(defun dunnet-pwd (args)
  1631. X  (mprincl cdpath))
  1632. X
  1633. X(defun uncompress (args)
  1634. X  (if (not (car args))
  1635. X      (mprincl "Usage: uncompress <filename>")
  1636. X    (setq args (car args))
  1637. X    (if (or uncompressed
  1638. X        (and (not (string= args "paper.o"))
  1639. X         (not (string= args "paper.o.z"))))
  1640. X    (mprincl "Uncompress command failed.")
  1641. X      (setq uncompressed t)
  1642. X      (setq inventory (append inventory (list obj-paper))))))
  1643. X
  1644. X(defun rlogin (args)
  1645. X  (let (passwd)
  1646. X    (if (not (car args))
  1647. X    (mprincl "Usage: rlogin <hostname>")
  1648. X      (setq args (car args))
  1649. X      (if (string= args "endgame")
  1650. X      (rlogin-endgame)
  1651. X    (if (not (string= args "gamma"))
  1652. X        (mprincl "No such host.")
  1653. X      (if (not ethernet)
  1654. X          (mprincl "Host not responding.")
  1655. X        (mprinc "Password: ")
  1656. X        (setq passwd (read-line))
  1657. X        (if (not (string= passwd "worms"))
  1658. X        (mprincl "\nlogin incorrect")
  1659. X          (mprinc 
  1660. X"\nYou begin to feel strange for a moment, and you lose your items."
  1661. X)
  1662. X          (replace room-objects computer-room 
  1663. X               (append (nth computer-room room-objects) inventory))
  1664. X          (setq inventory nil)
  1665. X          (setq current-room receiving-room)
  1666. X          (uexit nil))))))))
  1667. X  
  1668. X(defun dunnet-cd (args)
  1669. X  (let (tcdpath tcdroom path-elemants room-check)
  1670. X    (if (not (car args))
  1671. X    (mprincl "Usage: cd <path>")
  1672. X      (setq tcdpath cdpath)
  1673. X      (setq tcdroom cdroom)
  1674. X      (setq badcd nil)
  1675. X      (condition-case nil
  1676. X      (setq path-elements (get-path (car args) nil))
  1677. X    (error (mprincl "Invalid path.")
  1678. X           (setq badcd t)))
  1679. X      (dolist (pe path-elements)
  1680. X          (unless badcd
  1681. X              (if (not (string= pe "."))
  1682. X              (if (string= pe "..")
  1683. X                  (progn
  1684. X                (if (> tcdroom 0)                  ;In a room
  1685. X                    (progn
  1686. X                      (setq tcdpath "/rooms")
  1687. X                      (setq tcdroom -2))
  1688. X                    ;In /rooms,/usr,root
  1689. X                  (if (or 
  1690. X                       (= tcdroom -2) (= tcdroom -4) 
  1691. X                       (= tcdroom -3))
  1692. X                      (progn
  1693. X                    (setq tcdpath "/")
  1694. X                    (setq tcdroom -3))
  1695. X                    (if (= tcdroom -10)       ;In /usr/toukmond
  1696. X                    (progn
  1697. X                      (setq tcdpath "/usr")
  1698. X                      (setq tcdroom -4))))))
  1699. X                (if (string= pe "/")
  1700. X                (progn
  1701. X                  (setq tcdpath "/")
  1702. X                  (setq tcdroom -3))
  1703. X                  (if (= tcdroom -4)
  1704. X                  (if (string= pe "toukmond")
  1705. X                      (progn
  1706. X                    (setq tcdpath "/usr/toukmond")
  1707. X                    (setq tcdroom -10))
  1708. X                    (nosuchdir))
  1709. X                (if (= tcdroom -10)
  1710. X                    (nosuchdir)
  1711. X                  (if (> tcdroom 0)
  1712. X                      (nosuchdir)
  1713. X                    (if (= tcdroom -3)
  1714. X                    (progn
  1715. X                      (if (string= pe "rooms")
  1716. X                          (progn
  1717. X                        (setq tcdpath "/rooms")
  1718. X                        (setq tcdroom -2))
  1719. X                        (if (string= pe "usr")
  1720. X                        (progn
  1721. X                          (setq tcdpath "/usr")
  1722. X                          (setq tcdroom -4))
  1723. X                          (nosuchdir))))
  1724. X                      (if (= tcdroom -2)
  1725. X                      (progn
  1726. X                        (dolist (x visited)
  1727. X                            (setq room-check 
  1728. X                              (nth x room-shorts))
  1729. X                            (if (string= room-check pe)
  1730. X                            (progn
  1731. X                              (setq tcdpath 
  1732. X                         (concat "/rooms/" room-check))
  1733. X                              (setq tcdroom x))))
  1734. X                        (if (= tcdroom -2)
  1735. X                        (nosuchdir)))))))))))))
  1736. X      (if (not badcd)
  1737. X      (progn
  1738. X        (setq cdpath tcdpath)
  1739. X        (setq cdroom tcdroom)
  1740. X        0)
  1741. X      -2))))
  1742. X
  1743. X(defun nosuchdir ()
  1744. X  (mprincl "No such directory.")
  1745. X  (setq badcd t))
  1746. X
  1747. X(defun cat (args)
  1748. X  (let (doto checklist)
  1749. X    (if (not (setq args (car args)))
  1750. X    (mprincl "Usage: cat <ascii-file-name>")
  1751. X      (if (string-match "/" args)
  1752. X      (mprincl "cat: only files in current directory allowed.")
  1753. X    (if (and (> cdroom 0) (string= args "description"))
  1754. X        (mprincl (car (nth cdroom rooms)))
  1755. X      (if (setq doto (string-match "\\.o" args))
  1756. X          (progn
  1757. X        (if (= cdroom -10)
  1758. X            (setq checklist inventory)
  1759. X          (setq checklist (nth cdroom room-objects)))
  1760. X        (if (not (member (cdr 
  1761. X                  (assq (intern 
  1762. X                     (substring args 0 doto)) objnames))
  1763. X                 checklist))
  1764. X            (mprincl "File not found.")
  1765. X          (mprincl "Ascii files only.")))
  1766. X        (if (assq (intern args) unix-verbs)
  1767. X        (mprincl "Ascii files only.")
  1768. X          (mprincl "File not found."))))))))
  1769. X  
  1770. X(defun zippy (args)
  1771. X  (mprincl (yow)))
  1772. X
  1773. X(defun rlogin-endgame ()
  1774. X  (if (not (= (score nil) 90))
  1775. X      (mprincl "You have not achieved enough points to connect to endgame.")
  1776. X    (mprincl"\nWelcome to the endgame.  You are a truly noble adventurer.")
  1777. X    (setq current-room treasure-room)
  1778. X    (setq endgame t)
  1779. X    (replace room-objects endgame-treasure-room (list obj-bill))
  1780. X    (uexit nil)))
  1781. END_OF_FILE
  1782. if test 14344 -ne `wc -c <'dun-unix.el'`; then
  1783.     echo shar: \"'dun-unix.el'\" unpacked with wrong size!
  1784. fi
  1785. chmod +x 'dun-unix.el'
  1786. # end of 'dun-unix.el'
  1787. fi
  1788. echo shar: End of archive 2 \(of 3\).
  1789. cp /dev/null ark2isdone
  1790. MISSING=""
  1791. for I in 1 2 3 ; do
  1792.     if test ! -f ark${I}isdone ; then
  1793.     MISSING="${MISSING} ${I}"
  1794.     fi
  1795. done
  1796. if test "${MISSING}" = "" ; then
  1797.     echo You have unpacked all 3 archives.
  1798.     rm -f ark[1-9]isdone
  1799. else
  1800.     echo You still need to unpack the following archives:
  1801.     echo "        " ${MISSING}
  1802. fi
  1803. ##  End of shell archive.
  1804. exit 0
  1805.