home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!news.bbn.com!micro-heart-of-gold.mit.edu!mit-eddie!eddie.mit.edu!ronnie
- From: ronnie@eddie.mit.edu (Ron Schnell)
- Newsgroups: gnu.emacs.sources
- Subject: dunnet - text adventure for e-lisp (1/3)
- Message-ID: <1992Jul29.012337.19018@eddie.mit.edu>
- Date: 29 Jul 92 01:23:37 GMT
- Sender: news@eddie.mit.edu (Usenet News)
- Reply-To: ronnie@eddie.mit.edu (Ron Schnell)
- Organization: MIT EECS/ECF Facility, Cambridge Mass
- Lines: 1023
-
- This is dunnet - a text adventure written for emacs-lisp. It requires
- gnu-emacs and its associated lisp libraries. You can also find it in the
- elisp-archive on archive.cis.ohio-state.edu in games/dunnet.tar.Z.
-
- Please e-mail me any questions or comments, especially if you find it
- too hard or too easy.
-
- -------
-
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create the files:
- # README
- # COPYRIGHT
- # LCD-entry
- # dun-commands.el
- # This archive created: Tue Jul 28 14:47:42 1992
- export PATH; PATH=/bin:$PATH
- if test -f 'README'
- then
- echo shar: will not over-write existing file "'README'"
- else
- cat << \SHAR_EOF > 'README'
- This is "dunnet", a text adventure game written in emacs-lisp. I decided it
- would be interesting to write an elisp program, so for fun I wrote this
- one. Try to play it without looking at the code, for two reasons:
-
- 1. It's more fun if you don't cheat.
- 2. Since I haven't written much lisp, I'm not confident of the quality
- of the code.
-
- You'll notice some really different things about this dungeon. Without
- giving anything away, let's just say that like much lisp code seems to
- be, this dungeon is sort of recursive in a way. A minimal knowledge of
- UNIX, and some internet experience is assumed.
-
- INSTALLATION
- ------------
-
- Modify the first line of dun-main.el to have a logfile that is writable
- by all. You only need to do this if you want to log where everyone died
- or saved, or won. You will also need to create this file as an empty file,
- if it doesn't already exist.
-
- You can use the 'makefile' to compile everything and encrypt the appropriate
- portions of dunnet. You may, of course, just run the code as-is. In either
- case, all of the files must be put in your load-path directory, or they
- must be in your current directory when it is run. If you do
- run make, all of the compiled/encrypted files are put in ../bin.
-
- *IMPORTANT*
-
- There are two ways to run the program:
-
- 1. dunnet
- 2. dunnet.window
-
- I strongly suggest using the non-window version, because otherwise stuff will
- scroll off the screen, and you'll need to be scrolling back a lot. These
- files are Unix shellscripts, and one of them should be put in a normal
- bin directory. If you are on a non-unix machine, it should be simple to
- set up similar script files.
-
- NOTE: It may be necessary to modify the script files in order to run out
- of the current directory. If it can't seem to find the load file,
- change the "-l dun-main" to "-l `pwd`/dun-main" for Unix. For other
- platforms, use whatever method appropriate to indicate the complete
- pathname.
-
- I have included part of crypt.el by Kyle E. Jones. It is needed in order to
- encrypt and decrypt save files and one of the data files.
-
- crypt.el assumes that you can run the "crypt" command. If you cannot,
- edit the file 'save.el', and replace the functions 'compile-save-out'
- and 'restore' with 'compile-save-out-nocrypt' and 'restore-nocrypt'. If
- you aren't using crypt you will also have to make sure to copy
- 'dun-globals.el' to the load-path or current directory if you are
- using 'make' to compile.
-
- This software assumes you have "cl.el" (necessary) and "yow.el" (not critical)
- in the load-path directory. These come standard with gnu-emacs.
-
- Some hints and tips.
-
- Read the help carefully.
- Save the game often.
- An abbreviation for examine is 'x'.
- You can use 'get all', but not 'drop all'.
-
- Questions or comments to ronnie@eddie.mit.edu.
-
- SHAR_EOF
- fi # end of overwriting check
- if test -f 'COPYRIGHT'
- then
- echo shar: will not over-write existing file "'COPYRIGHT'"
- else
- cat << \SHAR_EOF > 'COPYRIGHT'
-
- ;; dunnet - elisp text adventure game. The following applies to
- ;; these files contained in this archive:
- ;; dun-batch.el
- ;; dun-commands.el
- ;; dun-globals.el
- ;; dun-main.el
- ;; dun-save.el
- ;; dun-unix.el
- ;; dun-util.el
-
- ;; Copyright (C) 1992 by Ron Schnell
- ;; (ronnie@eddie.mit.edu)
-
- ;; This software is not part of GNU Emacs.
-
- ;; It is distributed in the hope that it will be fun.
- ;; It is without any warranty. No author or distributor
- ;; accepts responsibility to anyone for the consequences of using it
- ;; or for whether it serves any particular purpose, or works at all.
-
- ;; Everyone is granted permission to copy, modify, and redistribute
- ;; this software, but only so long as it is not for commercial
- ;; purposes.
-
- ;; This file must be distributed along with all copies, in an unmodified
- ;; form.
- SHAR_EOF
- fi # end of overwriting check
- if test -f 'LCD-entry'
- then
- echo shar: will not over-write existing file "'LCD-entry'"
- else
- cat << \SHAR_EOF > 'LCD-entry'
- ;; LCD Archive Entry:
- ;; dunnet|Ron Schnell|ronnie@eddie.mit.edu
- ;; |Text adventure.
- ;; |92-07-25|Version: 1.0|~/games/dunnet.tar.Z|
- SHAR_EOF
- fi # end of overwriting check
- if test -f 'dun-commands.el'
- then
- echo shar: will not over-write existing file "'dun-commands.el'"
- else
- cat << \SHAR_EOF > 'dun-commands.el'
- ;;
- ;; This file contains all of the verbs and commands.
- ;;
-
- (require 'cl)
- ;;;; Give long description of room if haven't been there yet. Otherwise
- ;;;; short. Also give long if we were called with negative room number.
-
- (defun describe-room (room)
- (if (and (not (member (abs room) light-rooms)) (not (member 1 inventory)))
- (mprincl "It is pitch dark. You are likely to be eaten by a grue.")
- (mprincl (cadr (nth (abs room) rooms)))
- (if (and (and (or (member room visited)
- (string= mode "superb")) (> room 0))
- (not (string= mode "long")))
- nil
- (mprinc (car (nth (abs room) rooms)))
- (mprinc "\n"))
- (if (not (string= mode "long"))
- (if (not (member (abs room) visited))
- (setq visited (append (list (abs room)) visited))))
- (dolist (xobjs (nth current-room room-objects))
- (if (= xobjs 255)
- (special-object)
- (if (>= xobjs 0)
- (mprincl (car (nth xobjs objects)))
- (if (not (and (= xobjs -18) inbus))
- (progn
- (mprincl (car (nth (abs xobjs) perm-objects)))))))
- (if (and (= xobjs 19) jar)
- (progn
- (mprincl "The jar contains:")
- (dolist (x jar)
- (mprinc " ")
- (mprincl (car (nth x objects)))))))
- (if (and (member -18 (nth current-room room-objects)) inbus)
- (mprincl "You are on the bus."))))
-
- ;;; There is a special object in the room. This object's description,
- ;;; or lack thereof, depends on certain conditions.
-
- (defun special-object ()
- (if (= current-room 10)
- (if computer
- (mprincl
- "The panel lights are flashing in a seemingly organized pattern.")
- (mprincl "The panel lights are steady and motionless.")))
- (if (and (= current-room 46) (not (member 13 (nth 46 room-objects))))
- (mprincl "There is a hole in the floor here."))
- (if (and (= current-room 86) black)
- (mprincl
- "The room is lit by a black light, causing the fish to give off an
- eerie glow."))
- (if (and (= current-room 77) hole)
- (progn
- (mprincl"You fall into a hole in the ground.")
- (setq current-room 89)
- (describe-room 89)))
-
- (if (> current-room 95)
- (progn
- (if (not correct-answer)
- (endgame-question)
- (mprincl "Your question is:")
- (mprincl endgame-question))))
-
- (if (= current-room 14)
- (progn
- (mprincl (nth sauna-level '(
- "It is normal room termperature in here."
- "It is luke warm in here."
- "It is comfortably hot in here."
- "It is refreshingly hot in here."
- "You are dead now.")))
- (if (and (= sauna-level 3)
- (or (member 6 inventory)
- (member 6 (nth current-room room-objects))))
- (progn
- (mprincl
- "You notice the wax on your statuette beginning to melt, until it completely
- melts off. You are left with a beautiful diamond!")
- (if (member 6 inventory)
- (progn
- (remove-obj-from-inven 6)
- (setq inventory (append inventory (list 7))))
- (remove-obj-from-room current-room 6)
- (replace room-objects current-room
- (append (nth current-room room-objects)
- (list 7))))))))
-
- )
-
- ;;;;;;;;;;;;;;;;;;;;;; Commands start here
-
- (defun die (murderer)
- (mprinc "\n")
- (if murderer
- (mprincl "You are dead."))
- (do-logfile 'die murderer)
- (score nil)
- (setq dead t))
-
- (defun quit (args)
- (die nil))
-
- ;; Print every object in player's inventory. Special case for the jar,
- ;; as we must also print what is in it.
-
- (defun inven (args)
- (mprinc "You currently have:")
- (mprinc "\n")
- (dolist (curobj inventory)
- (if curobj
- (progn
- (mprincl (cadr (nth curobj objects)))
- (if (and (= curobj 19) jar)
- (progn
- (mprincl "The jar contains:")
- (dolist (x jar)
- (mprinc " ")
- (mprincl (cadr (nth x objects))))))))))
-
- (defun shake (obj)
- (let (objnum)
- (when (setq objnum (objnum-from-args-std obj))
- (if (member objnum inventory)
- (progn
- ;;; If shaking anything will do anything, put here.
- (mprinc "Shaking ")
- (mprinc (downcase (cadr (nth objnum objects))))
- (mprinc " seems to have no effect.")
- (mprinc "\n")
- )
- (if (and (not (member objnum (nth current-room room-silents)))
- (not (member objnum (nth current-room room-objects))))
- (mprincl "I don't see that here.")
- ;;; Shaking trees can be deadly
- (if (= objnum -2)
- (progn
- (mprinc
- "You begin to shake a tree, and notice a coconut begin to fall from the air.
- As you try to get your hand up to block it, you feel the impact as it lands
- on your head.")
- (die "a coconut"))
- (if (= objnum -3)
- (progn
- (mprinc
- "As you go up to the bear, it removes your head and places it on the ground.")
- (die "a bear"))
- (if (< objnum 0)
- (mprincl "You cannot shake that.")
- (mprincl "You don't have that.")))))))))
-
-
- (defun drop (obj)
- (if inbus
- (mprincl "You can't drop anything while on the bus.")
- (let (objnum)
- (when (setq objnum (objnum-from-args-std obj))
- (if (not (setq ptr (member objnum inventory)))
- (mprincl "You don't have that.")
- (progn
- (remove-obj-from-inven objnum)
- (replace room-objects current-room
- (append (nth current-room room-objects)
- (list objnum)))
- (mprincl "Done.")
- (if (member objnum '(3 8 19))
- (drop-check objnum))))))))
-
- ;; Dropping certain things causes things to happen.
-
- (defun drop-check (objnum)
- (if (and (= objnum 3) (= room 7) (member -3 (nth 7 room-objects)))
- (progn
- (mprincl
- "The bear takes the food and runs away with it. He left something behind.")
- (remove-obj-from-room current-room -3)
- (remove-obj-from-room current-room 3)
- (replace room-objects current-room
- (append (nth current-room room-objects)
- (list 4)))))
-
- (if (and (= objnum 19) (member 21 jar) (member 22 jar))
- (progn
- (mprincl "As the jar impacts the ground it explodes into many pieces.")
- (setq jar nil)
- (remove-obj-from-room current-room 19)
- (if (= current-room 77)
- (progn
- (setq hole t)
- (setq current-room 89)
- (mprincl
- "The explosion causes a hole to open up in the ground, which you fall
- through.")))))
-
- (if (and (= objnum 8) (= current-room 17))
- (mprincl "A passageway opens.")))
-
- ;;; Give long description of current room, or an object.
-
- (defun examine (obj)
- (let (objnum)
- (setq objnum (objnum-from-args obj))
- (if (eq objnum 255)
- (describe-room (* current-room -1))
- (if (eq objnum nil)
- (mprincl "I don't know what that is.")
- (if (and (not (member objnum (nth current-room room-objects)))
- (not (member objnum (nth current-room room-silents)))
- (not (member objnum inventory)))
- (mprincl "I don't see that here.")
- (if (>= objnum 0)
- (if (and (= objnum 20) (= current-room 86) black)
- (mprincl
- "In this light you can see some writing on the bone. It says:
- For an explosive time, go to Fourth St. and Vermont.")
- (if (nth objnum physobj-desc)
- (mprincl (nth objnum physobj-desc))
- (mprincl "I see nothing special about that.")))
- (if (nth (abs objnum) permobj-desc)
- (progn
- (mprincl (nth (abs objnum) permobj-desc)))
- (mprincl "I see nothing special about that."))))))))
-
- (defun take (obj)
- (if inbus
- (mprincl "You can't take anything while on the bus.")
- (setq obj (firstword obj))
- (if (not obj)
- (mprincl "You must supply an object.")
- (if (string= obj "all")
- (let (gotsome)
- (setq gotsome nil)
- (dolist (x (nth current-room room-objects))
- (if (and (>= x 0) (not (= x 255)))
- (progn
- (setq gotsome t)
- (mprinc (cadr (nth x objects)))
- (mprinc ": ")
- (take-object x))))
- (if (not gotsome)
- (mprincl "Nothing to take.")))
- (progn
- (setq objnum (cdr (assq (intern obj) objnames)))
- (if (eq objnum nil)
- (progn
- (mprinc "I don't know what that is.")
- (mprinc "\n"))
- (take-object objnum)))))))
-
- (defun take-object (objnum)
- (if (and (member objnum jar) (member 19 inventory))
- (progn
- (mprincl "You remove it from the jar.")
- (setq newjar nil)
- (dolist (x jar)
- (if (not (= x objnum))
- (setq newjar (append newjar (list x)))))
- (setq jar newjar)
- (setq inventory (append inventory (list objnum))))
- (if (not (member objnum (nth current-room room-objects)))
- (if (not (member objnum (nth current-room room-silents)))
- (mprinc "I do not see that here.")
- (try-take objnum))
- (if (>= objnum 0)
- (progn
- (if (and (car inventory)
- (> (+ (inven-weight) (nth objnum object-lbs)) 11))
- (mprinc "Your load would be too heavy.")
- (setq inventory (append inventory (list objnum)))
- (remove-obj-from-room current-room objnum)
- (mprinc "Taken. ")
- (if (and (= objnum 13) (= current-room 46))
- (mprinc "Taking the towel reveals a hole in the floor."))))
- (try-take objnum)))
- (mprinc "\n")))
-
- (defun inven-weight ()
- (let (total)
- (setq total 0)
- (dolist (x jar)
- (setq total (+ total (nth x object-lbs))))
- (dolist (x inventory)
- (setq total (+ total (nth x object-lbs)))) total))
-
- ;;; We try to take an object that is untakable. Print a message
- ;;; depending on what it is.
-
- (defun try-take (obj)
- (mprinc "You cannot take that."))
-
-
- (defun dig (args)
- (if inbus
- (mprincl "You can't dig while on the bus.")
- (if (not (member 0 inventory))
- (mprincl "You have nothing with which to dig.")
- (if (not (nth current-room diggables))
- (mprincl "Digging here reveals nothing.")
- (mprincl "I think you found something.")
- (replace room-objects current-room
- (append (nth current-room room-objects)
- (nth current-room diggables)))
- (replace diggables current-room nil)))))
-
- (defun climb (args)
- (if (not (member -2 (nth current-room room-silents)))
- (mprincl "There is nothing here to climb.")
- (mprincl
- "You manage to get about two feet up the tree and fall back down. You
- notice that the tree is very unsteady.")))
-
- (defun eat (obj)
- (let (objnum)
- (when (setq objnum (objnum-from-args-std obj))
- (if (not (member objnum inventory))
- (mprincl "You don't have that.")
- (if (not (= objnum 3))
- (progn
- (mprinc "You forcefully shove ")
- (mprinc (downcase (cadr (nth objnum objects))))
- (mprincl " down your throat, and start choking.")
- (die "choking"))
- (mprincl "That tasted horrible.")
- (remove-obj-from-inven 3))))))
-
- (defun dput (args)
- (if inbus
- (mprincl "You can't do that while on the bus")
- (let (newargs objnum objnum2)
- (setq newargs (firstwordl args))
- (if (not newargs)
- (mprincl "You must supply an object")
- (setq obj (intern (car newargs)))
- (setq objnum (cdr (assq obj objnames)))
- (if (not objnum)
- (mprincl "I don't know what that object is.")
- (if (not (member objnum inventory))
- (mprincl "You don't have that.")
- (setq newargs (firstwordl (cdr newargs)))
- (setq newargs (firstwordl (cdr newargs)))
- (if (not newargs)
- (mprincl "You must supply an indirect object.")
- (setq objnum2 (cdr (assq (intern (car newargs)) objnames)))
- (if (not objnum2)
- (mprincl "I don't know what that indirect object is.")
- (if (and (not (member objnum2 (nth current-room room-objects)))
- (not (member objnum2 (nth current-room room-silents)))
- (not (member objnum2 inventory)))
- (mprincl "That indirect object is not here.")
- (put-objs objnum objnum2))))))))))
-
- (defun put-objs (obj1 obj2)
- (if (and (= obj2 -17) (not nomail))
- (setq obj2 -9))
-
- (if (= obj2 -26) (setq obj2 -9))
-
- (if (and (= obj1 2) (= obj2 -5)) ;; Put board in cabinet
- (progn
- (remove-obj-from-inven 2)
- (setq computer t)
- (mprincl
- "As you put the CPU board in the computer, it immediately springs to life.
- The lights start flashing, and the fans seem to startup."))
- (if (and (= obj1 8) (= obj2 -8)) ;; Put weight on button
- (drop '("weight"))
- (if (= obj2 19) ;; Put something in jar
- (if (not (member obj1 '(5 7 10 16 17 18 21 22)))
- (mprincl "That will not fit in the jar.")
- (remove-obj-from-inven obj1)
- (setq jar (append jar (list obj1)))
- (mprincl "Done."))
- (if (= obj2 -9) ;; Put something in chute
- (progn
- (remove-obj-from-inven obj1)
- (mprincl
- "You hear it slide down the chute and off into the distance.")
- (put-objs-in-treas (list obj1)))
- (if (= obj2 -15)
- (if (= obj1 4)
- (progn
- (mprincl
- "As you drop the key, the box begins to shake. Finally it explodes
- with a bang. The key seems to have vanished!")
- (remove-obj-from-inven obj1)
- (replace room-objects 10 (append
- (nth 10 room-objects)
- (list obj1)))
- (remove-obj-from-room current-room -15)
- (setq key-level (1+ key-level))))
- (if (= obj2 -12)
- (progn
- (remove-obj-from-inven obj1)
- (replace room-objects 36 (append (nth 36 room-objects)
- (list obj1)))
- (mprincl
- "You hear it plop down in some water below."))
- (if (= obj2 -17)
- (mprincl "The mail chute is locked.")
- (if (member obj1 inventory)
- (mprincl
- "I don't know how to combine those objects. Perhaps you should
- just try dropping it.")
- (mprincl"You can't put that there."))))))))))
-
- (defun type (args)
- (if (not (= current-room 10))
- (mprincl "There is nothing here on which you could type.")
- (if (not computer)
- (mprincl
- "You type on the keyboard, but your characters do not even echo.")
- (unix-interface))))
-
- ;;;; Various movement directions
-
- (defun n (args)
- (move 0))
-
- (defun s (args)
- (move 1))
-
- (defun e (args)
- (move 2))
-
- (defun w (args)
- (move 3))
-
- (defun ne (args)
- (move 4))
-
- (defun se (args)
- (move 5))
-
- (defun nw (args)
- (move 6))
-
- (defun sw (args)
- (move 7))
-
- (defun up (args)
- (move 8))
-
- (defun down (args)
- (move 9))
-
- (defun in (args)
- (move 10))
-
- (defun out (args)
- (move 11))
-
- (defun go (args)
- (if (or (not (car args))
- (eq (doverb ignore verblist (car args) (cdr (cdr args))) -1))
- (mprinc "I don't understand where you want me to go.\n")))
-
- (defun move (dir)
- (if (and (not (member current-room light-rooms)) (not (member 1 inventory)))
- (progn
- (mprinc
- "You trip over a grue and fall into a pit and break every bone in your
- body.")
- (die "a grue"))
- (let (newroom)
- (setq newroom (nth dir (nth current-room dungeon-map)))
- (if (eq newroom -1)
- (mprinc "You can't go that way.\n")
- (if (eq newroom 255)
- (special-move dir)
- (setq room -1)
- (setq lastdir dir)
- (if inbus
- (progn
- (if (or (< newroom 58) (> newroom 83))
- (mprincl "The bus cannot go this way.")
- (mprincl
- "The bus lurches ahead and comes to a screeching halt.")
- (remove-obj-from-room current-room -18)
- (setq current-room newroom)
- (replace room-objects newroom
- (append (nth newroom room-objects) (list -18)))))
- (setq current-room newroom)))))))
-
- ;; Movement in this direction causes something special to happen if the
- ;; right conditions exist. It may be that you can't go this way unless
- ;; you have a key, or a passage has been opened.
-
- ;; coding note: Each check of the current room is on the same 'if' level,
- ;; i.e. there aren't else's. If two rooms next to each other have
- ;; specials, and they are connected by specials, this could cause
- ;; a problem. Be careful when adding them to consider this, and
- ;; perhaps use else's.
-
- (defun special-move (dir)
- (if (= current-room 5)
- (if (not (member 4 inventory))
- (mprincl "You don't have a key that can open this door.")
- (setq current-room 8))
- (if (= current-room 7)
- (if (member -3 (nth 7 room-objects))
- (progn
- (mprinc
- "The bear is very annoyed that you would be so presumptuous as to try
- and walk right by it. He tells you so by tearing your head off.
- ")
- (die "a bear"))
- (mprincl "You can't go that way.")))
-
- (if (= current-room 89)
- (progn
- (mprincl
- "As you board the train it immediately leaves the station. It is a very
- bumpy ride. It is shaking from side to side, and up and down. You
- sit down in one of the chairs in order to be more comfortable.")
- (mprincl
- "\nFinally the train comes to a sudden stop, and the doors open, and some
- force throws you out. The train speeds away.\n")
- (setq current-room 90)))
-
- (if (= current-room 8)
- (if (and (member 4 inventory)
- (> key-level 0))
- (setq current-room 11)
- (mprincl "You don't have a key that can open this door.")))
-
- (if (and (= current-room 17) (= dir 6))
- (if (member 8 (nth 17 room-objects))
- (setq current-room 18)
- (mprincl "You can't go that way.")))
-
- (if (and (= current-room 17) (= dir 8))
- (if (member 8 (nth 17 room-objects))
- (mprincl "You can't go that way.")
- (setq current-room 16)))
-
- (if (= current-room 88)
- (mprincl "The door is locked."))
-
- (if (or (= current-room 25) (= current-room 26))
- (swim nil))
-
- (if (= current-room 32)
- (if (> key-level 0)
- (setq current-room 57)
- (mprincl "You don't have a key that can open that door.")))
-
- (if (= current-room 23)
- (if (not (= sauna-level 3))
- (setq current-room 24)
- (mprincl
- "As you exit the building, you notice some flames coming out of one of the
- windows. Suddenly, the building explodes in a huge ball of fire. The flames
- engulf you, and you burn to death.")
- (die "burning")))
-
- (if (= current-room 46)
- (if (not (member 13 (nth 46 room-objects)))
- (setq current-room 47)
- (mprincl "You can't go that way.")))
-
- (if (and (> dir 9) (> current-room 57) (< current-room 84))
- (if (not (member -18 (nth current-room room-objects)))
- (mprincl "You can't go that way.")
- (if (= dir 10)
- (if (member 16 inventory)
- (progn
- (mprincl "You board the bus and get in the driver's seat.")
- (setq nomail t)
- (setq inbus t))
- (mprincl "You are not licensed for this type of vehicle."))
- (mprincl "You hop off the bus.")
- (setq inbus nil)))
- (if (= current-room 80)
- (if (not inbus)
- (progn
- (mprincl "You fall down the cliff and land on your head.")
- (die "a cliff"))
- (mprincl
- "The bus flies off the cliff, and plunges to the bottom, where it explodes.")
- (die "a bus accident")))
- (if (= current-room 59)
- (progn
- (if (not inbus)
- (mprincl "The gate will not open.")
- (mprincl
- "As the bus approaches, the gate opens and you drive through.")
- (remove-obj-from-room 59 -18)
- (replace room-objects 83 (append (nth 83 room-objects)
- (list -18)))
- (setq current-room 83)))))
- (if (= current-room 28)
- (progn
- (mprincl
- "As you enter the room you hear a rumbling noise. You look back to see
- huge rocks sliding down from the ceiling, and blocking your way out.\n")
- (setq current-room 29)))))
-
- (defun long (args)
- (setq mode "long"))
-
- (defun turn (obj)
- (let (objnum direction)
- (when (setq objnum (objnum-from-args-std obj))
- (if (not (or (member objnum (nth current-room room-objects))
- (member objnum (nth current-room room-silents))))
- (mprincl "I don't see that here.")
- (if (not (= objnum -7))
- (mprincl "You can't turn that.")
- (setq direction (firstword (cdr obj)))
- (if (or (not direction)
- (not (or (string= direction "clockwise")
- (string= direction "counterclockwise"))))
- (mprincl "You must indicate clockwise or counterclockwise.")
- (if (string= direction "clockwise")
- (setq sauna-level (+ sauna-level 1))
- (setq sauna-level (- sauna-level 1)))
-
- (if (< sauna-level 0)
- (progn
- (mprincl
- "The dial will not turn further in that direction.")
- (setq sauna-level 0))
- (sauna-heat))))))))
-
- (defun sauna-heat ()
- (if (= sauna-level 0)
- (mprincl "The termperature has returned to normal room termperature."))
- (if (= sauna-level 1)
- (mprincl "It is now luke warm in here. You begin to sweat."))
- (if (= sauna-level 2)
- (mprincl "It is pretty hot in here. It is still very comfortable."))
- (if (= sauna-level 3)
- (progn
- (mprincl
- "It is now very hot. There is something very refreshing about this.")
- (if (or (member 6 inventory)
- (member 6 (nth current-room room-objects)))
- (progn
- (mprincl
- "You notice the wax on your statuette beginning to melt, until it completely
- melts off. You are left with a beautiful diamond!")
- (if (member 6 inventory)
- (progn
- (remove-obj-from-inven 6)
- (setq inventory (append inventory (list 7))))
- (remove-obj-from-room current-room 6)
- (replace room-objects current-room
- (append (nth current-room room-objects)
- (list 7))))))))
- (if (= sauna-level 4)
- (progn
- (mprincl
- "As the dial clicks into place, you immediately burst into flames.")
- (die "burning"))))
-
- (defun press (obj)
- (let (objnum)
- (when (setq objnum (objnum-from-args-std obj))
- (if (not (or (member objnum (nth current-room room-objects))
- (member objnum (nth current-room room-silents))))
- (mprincl "I don't see that here.")
- (if (not (member objnum '(-8 -24)))
- (progn
- (mprinc "You can't ")
- (mprinc (car line-list))
- (mprincl " that."))
- (if (= objnum -8)
- (mprincl
- "As you press the button, you notice a passageway open up, but
- as you release it, the passageway closes."))
- (if (= objnum -24)
- (if black
- (progn
- (mprincl "The button is now in the off position.")
- (setq black nil))
- (mprincl "The button is now in the on position.")
- (setq black t))))))))
-
- (defun swim (args)
- (if (not (member current-room '(25 26)))
- (mprincl "I see no water!")
- (if (not (member 9 inventory))
- (progn
- (mprincl
- "You dive in the water, and at first notice it is quite cold. You then
- start to get used to it as you realize that you never really learned how
- to swim.")
- (die "drowning"))
- (if (= current-room 25)
- (setq current-room 26)
- (setq current-room 25)))))
-
-
- (defun score (args)
- (if (not endgame)
- (let (total)
- (setq total (reg-score))
- (mprinc "You have scored ")
- (mprinc total)
- (mprincl " out of a possible 90 points.") total)
- (mprinc "You have scored ")
- (mprinc (endgame-score))
- (mprincl " endgame points out of a possible 110.")
- (if (= (endgame-score) 110)
- (mprincl
- "\n\nCongratulations. You have won. The wizard password is 'moby'"))))
-
- (defun help (args)
- (mprincl
- "Welcome to dunnet (1.0), by Ron Schnell (ronnie@eddie.mit.edu).
- This is a pre-release version. Here is some useful information (read
- carefully because there are one or more clues in here):
-
- - If you have a key that can open a door, you do not need to explicitly
- open it. You may just use 'in' or walk in the direction of the door.
-
- - If you have a lamp, it is always lit.
-
- - You will not get any points until you manage to get treasures to a certain
- place. Simply finding the treasures is not good enough. There is more
- than one way to get a treasure to the special place. It is also
- important that the objects get to the special place *unharmed* and
- *untarnished*. You can tell if you have successfully transported the
- object by looking at your score, as it changes immediately. Note that
- an object can become harmed even after you have received points for it.
- If this happens, your score will decrease, and in many cases you can never
- get credit for it again.
-
- - You can save your game with the 'save' command, and use restore it
- with the 'restore' command.
-
- - There are no limits on lengths of object names.
-
- - Directions are: north,south,east,west,northeast,southeast,northwest,
- southwest,up,down,in,out.
-
- - These can be abbreviated: n,s,e,w,ne,se,nw,sw,u,d,in,out.
-
- - If you go down a hole in the floor without an aid such as a ladder,
- you probably won't be able to get back up the way you came, if at all.
-
- - It is possible to get the maximum points.
-
- If you have questions or comments, contact ronnie@eddie.mit.edu."))
-
- (defun flush (args)
- (if (not (= current-room 35))
- (mprincl "I see nothing to flush.")
- (mprincl "Whoooosh!!")
- (put-objs-in-treas (nth 36 room-objects))
- (replace room-objects 36 nil)))
-
- (defun piss (args)
- (if (not (= current-room 35))
- (mprincl "You can't do that here, don't even bother trying.")
- (if (not gottago)
- (mprincl "I'm afraid you don't have to go now.")
- (mprincl "That was refreshing.")
- (setq gottago nil)
- (replace room-objects 36 (append (nth 36 room-objects) (list -13))))))
-
-
- (defun sleep (args)
- (if (not (= current-room 34))
- (mprincl
- "You try to go to sleep while standing up here, but can't seem to do it.")
- (setq gottago t)
- (mprincl
- "As soon as you start to doze off you begin dreaming. You see images of
- workers digging caves, slaving in the humid heat. Then you see yourself
- as one of these workers. While no one is looking, you leave the group
- and walk into a room. The room is bare except for a horseshoe
- shaped piece of stone in the center. You see yourself digging a hole in
- the ground, then putting some kind of treasure in it, and filling the hole
- with dirt again. After this, you immediately wake up.")))
-
- (defun break (obj)
- (let (objnum)
- (if (not (member 14 inventory))
- (mprincl "You have nothing you can use to break things.")
- (when (setq objnum (objnum-from-args-std obj))
- (if (member objnum inventory)
- (progn
- (mprincl
- "You take the object in your hands and swing the axe. Unfortunately, you miss
- the object and slice off your hand. You bleed to death.")
- (die "an axe"))
- (if (not (or (member objnum (nth current-room room-objects))
- (member objnum (nth current-room room-silents))))
- (mprincl "I don't see that here.")
- (if (= objnum -16)
- (progn
- (mprincl
- "As you break the ethernet cable, everything starts to blur. You collapse
- for a moment, then straighten yourself up.
- ")
- (replace room-objects 57 (append (nth 36 room-objects)
- inventory))
- (if (member 4 inventory)
- (progn
- (setq inventory '(4))
- (remove-obj-from-room 57 4))
- (setq inventory nil))
- (setq current-room 10)
- (setq ethernet nil)
- (mprincl "Connection closed.")
- (unix-interface))
- (if (< objnum 0)
- (progn
- (mprincl "Your axe shatters into a million pieces.")
- (remove-obj-from-inven 14))
- (mprincl "Your axe breaks it into a million pieces.")
- (remove-obj-from-room current-room objnum)))))))))
-
- (defun drive (args)
- (if (not inbus)
- (mprincl "You cannot drive when you aren't in a vehicle.")
- (mprincl "To drive while you are in the bus, just give a direction.")))
-
- (defun superb (args)
- (setq mode 'superb))
-
- (defun reg-score ()
- (let (total)
- (setq total 0)
- (dolist (x (nth 0 room-objects))
- (setq total (+ total (nth x object-pts))))
- (if (member -13 (nth 0 room-objects))
- (setq total 0)) total))
-
- (defun endgame-score ()
- (let (total)
- (setq total 0)
- (dolist (x (nth 102 room-objects))
- (setq total (+ total (nth x object-pts)))) total))
-
- (defun answer (args)
- (if (not correct-answer)
- (mprincl "I don't believe anyone asked you anything.")
- (setq args (car args))
- (if (not args)
- (mprincl "You must give the answer on the same line.")
- (if (members args correct-answer)
- (progn
- (mprincl "Correct.")
- (if (= lastdir 0)
- (setq current-room (1+ current-room))
- (setq current-room (- current-room 1)))
- (setq correct-answer nil))
- (mprincl "That answer is incorrect.")))))
-
- (defun endgame-question ()
- (if (not endgame-questions)
- (progn
- (mprincl "Your question is:")
- (mprincl "No more questions, just do 'answer foo'.")
- (setq correct-answer '("foo")))
- (let (which i newques)
- (setq i 0)
- (setq newques nil)
- (setq which (% (abs (random)) (length endgame-questions)))
- (mprincl "Your question is:")
- (mprincl (setq endgame-question (car (nth which endgame-questions))))
- (setq correct-answer (cdr (nth which endgame-questions)))
- (while (< i which)
- (setq newques (append newques (list (nth i endgame-questions))))
- (setq i (1+ i)))
- (setq i (1+ which))
- (while (< i (length endgame-questions))
- (setq newques (append newques (list (nth i endgame-questions))))
- (setq i (1+ i)))
- (setq endgame-questions newques))))
- SHAR_EOF
- fi # end of overwriting check
- # End of shell archive
- exit 0
-