-;;; dunnet.el --- Text adventure for Emacs
+;;; dunnet.el --- text adventure for Emacs
-;; Copyright (C) 1992, 1993 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
-;; Author: Ron Schnell <ronnie@media.mit.edu>
+;; Author: Ron Schnell <ronnie@driver-aces.com>
;; Created: 25 Jul 1992
-;; Version: 2.0
+;; Version: 2.01
;; Keywords: games
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; This game can be run in batch mode. To do this, use:
;; emacs -batch -l dunnet
-;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;;; The log file should be set for your system, and it must
;;; be writable by all.
+;;; Code:
- (defvar dun-log-file "/usr/local/dunnet.score"
- "Name of file to store score information for dunnet.")
+(defgroup dunnet nil
+ "Text adventure for Emacs."
+ :prefix "dun-"
+ :group 'games)
+
+(defcustom dun-log-file "/usr/local/dunnet.score"
+ "Name of file to store score information for dunnet."
+ :type 'file
+ :group 'dunnet)
(if nil
(eval-and-compile (setq byte-compile-warnings nil)))
-(require 'cl)
+(eval-when-compile
+ (require 'cl))
;;;; Mode definitions for interactive mode
-(defun dun-mode ()
+(define-derived-mode dun-mode text-mode "Dungeon"
"Major mode for running dunnet."
- (interactive)
- (text-mode)
- (use-local-map dungeon-mode-map)
- (setq major-mode 'dungeon-mode)
- (setq mode-name "Dungeon"))
+ (make-local-variable 'scroll-step)
+ (setq scroll-step 2))
(defun dun-parse (arg)
"Function called when return is pressed in interactive mode to parse line."
(goto-char (point-max))
(dun-mprinc "\n"))
(dun-messages))
-
+
(defun dun-messages ()
(if dun-dead
(text-mode)
"Switch to *dungeon* buffer and start game."
(interactive)
(switch-to-buffer "*dungeon*")
- (insert "This version of Dunnet has been censored for your protection
-in accord with the Communications Decency Act.\n\n")
(dun-mode)
(setq dun-dead nil)
(setq room 0)
;;; short. Also give long if we were called with negative room number.
(defun dun-describe-room (room)
- (if (and (not (member (abs room) dun-light-rooms))
+ (if (and (not (member (abs room) dun-light-rooms))
(not (member obj-lamp dun-inventory)))
(dun-mprincl "It is pitch dark. You are likely to be eaten by a grue.")
(dun-mprincl (cadr (nth (abs room) dun-rooms)))
- (if (and (and (or (member room dun-visited)
+ (if (and (and (or (member room dun-visited)
(string= dun-mode "dun-superb")) (> room 0))
(not (string= dun-mode "long")))
nil
(defun dun-special-object ()
(if (= dun-current-room computer-room)
(if dun-computer
- (dun-mprincl
+ (dun-mprincl
"The panel lights are flashing in a seemingly organized pattern.")
(dun-mprincl "The panel lights are steady and motionless.")))
- (if (and (= dun-current-room red-room)
+ (if (and (= dun-current-room red-room)
(not (member obj-towel (nth red-room dun-room-objects))))
(dun-mprincl "There is a hole in the floor here."))
(if (and (= dun-current-room marine-life-area) dun-black)
- (dun-mprincl
-"The room is lit by a black light, causing the fish, and some of
+ (dun-mprincl
+"The room is lit by a black light, causing the fish, and some of
your objects, to give off an eerie glow."))
(if (and (= dun-current-room fourth-vermont-intersection) dun-hole)
(progn
(setq dun-current-room vermont-station)
(dun-describe-room vermont-station))
(progn
- (dun-mprincl
+ (dun-mprincl
"The bus falls down a hole in the ground and explodes.")
(dun-die "burning")))))
"It is comfortably hot in here."
"It is refreshingly hot in here."
"You are dead now.")))
- (if (and (= dun-sauna-level 3)
- (or (member obj-rms dun-inventory)
- (member obj-rms (nth dun-current-room dun-room-objects))))
+ (if (= dun-sauna-level 3)
(progn
- (dun-mprincl
+ (if (or (member obj-rms dun-inventory)
+ (member obj-rms (nth dun-current-room dun-room-objects)))
+ (progn
+ (dun-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 obj-rms dun-inventory)
- (progn
- (dun-remove-obj-from-inven obj-rms)
- (setq dun-inventory (append dun-inventory
- (list obj-diamond))))
- (dun-remove-obj-from-room dun-current-room obj-rms)
- (dun-replace dun-room-objects dun-current-room
- (append (nth dun-current-room dun-room-objects)
- (list obj-diamond))))
- (if (member obj-floppy dun-inventory)
+ (if (member obj-rms dun-inventory)
+ (progn
+ (dun-remove-obj-from-inven obj-rms)
+ (setq dun-inventory (append dun-inventory
+ (list obj-diamond))))
+ (dun-remove-obj-from-room dun-current-room obj-rms)
+ (dun-replace dun-room-objects dun-current-room
+ (append (nth dun-current-room dun-room-objects)
+ (list obj-diamond))))))
+ (if (or (member obj-floppy dun-inventory)
+ (member obj-floppy (nth dun-current-room dun-room-objects)))
(progn
(dun-mprincl
-"You notice your floppy disk beginning to melt. As you grab for it, the
+"You notice your floppy disk beginning to melt. As you grab for it, the
disk bursts into flames, and disintegrates.")
(dun-remove-obj-from-inven obj-floppy)
- (dun-remove-obj-from-room dun-current-room obj-floppy)))))
- )))
+ (dun-remove-obj-from-room dun-current-room obj-floppy))))))))
+
(defun dun-die (murderer)
(dun-mprinc "\n")
(append (nth dun-current-room dun-room-objects)
(list obj-key)))))
- (if (and (= objnum obj-jar) (member obj-nitric dun-jar)
+ (if (and (= objnum obj-jar) (member obj-nitric dun-jar)
(member obj-glycerine dun-jar))
(progn
- (dun-mprincl
+ (dun-mprincl
"As the jar impacts the ground it explodes into many pieces.")
(setq dun-jar nil)
(dun-remove-obj-from-room dun-current-room obj-jar)
(progn
(setq dun-hole t)
(setq dun-current-room vermont-station)
- (dun-mprincl
+ (dun-mprincl
"The explosion causes a hole to open up in the ground, which you fall
through.")))))
(dun-mprincl "A passageway opens.")))
;;; Give long description of current room, or an object.
-
+
(defun dun-examine (obj)
(let (objnum)
(setq objnum (dun-objnum-from-args obj))
(dun-examine '("pc"))
(if (eq objnum nil)
(dun-mprincl "I don't know what that is.")
- (if (and (not (member objnum
+ (if (and (not (member objnum
(nth dun-current-room dun-room-objects)))
- (not (member objnum
+ (not (and (member obj-jar dun-inventory)
+ (member objnum dun-jar)))
+ (not (member objnum
(nth dun-current-room dun-room-silents)))
(not (member objnum dun-inventory)))
(dun-mprincl "I don't see that here.")
(if (>= objnum 0)
- (if (and (= objnum obj-bone)
+ (if (and (= objnum obj-bone)
(= dun-current-room marine-life-area) dun-black)
- (dun-mprincl
+ (dun-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 dun-physobj-desc)
(dun-mprincl "I see nothing special about that.")))))))))
(defun dun-take (obj)
- (if dun-inbus
- (dun-mprincl "You can't take anything while on the bus.")
- (setq obj (dun-firstword obj))
- (if (not obj)
- (dun-mprincl "You must supply an object.")
- (if (string= obj "all")
- (let (gotsome)
- (setq gotsome nil)
- (dolist (x (nth dun-current-room dun-room-objects))
- (if (and (>= x 0) (not (= x obj-special)))
- (progn
- (setq gotsome t)
- (dun-mprinc (cadr (nth x dun-objects)))
- (dun-mprinc ": ")
- (dun-take-object x))))
- (if (not gotsome)
- (dun-mprincl "Nothing to take.")))
- (let (objnum)
- (setq objnum (cdr (assq (intern obj) dun-objnames)))
- (if (eq objnum nil)
- (progn
- (dun-mprinc "I don't know what that is.")
- (dun-mprinc "\n"))
- (dun-take-object objnum)))))))
+ (setq obj (dun-firstword obj))
+ (if (not obj)
+ (dun-mprincl "You must supply an object.")
+ (if (string= obj "all")
+ (let (gotsome)
+ (if dun-inbus
+ (dun-mprincl "You can't take anything while on the bus.")
+ (setq gotsome nil)
+ (dolist (x (nth dun-current-room dun-room-objects))
+ (if (and (>= x 0) (not (= x obj-special)))
+ (progn
+ (setq gotsome t)
+ (dun-mprinc (cadr (nth x dun-objects)))
+ (dun-mprinc ": ")
+ (dun-take-object x))))
+ (if (not gotsome)
+ (dun-mprincl "Nothing to take."))))
+ (let (objnum)
+ (setq objnum (cdr (assq (intern obj) dun-objnames)))
+ (if (eq objnum nil)
+ (progn
+ (dun-mprinc "I don't know what that is.")
+ (dun-mprinc "\n"))
+ (if (and dun-inbus (not (and (member objnum dun-jar)
+ (member obj-jar dun-inventory))))
+ (dun-mprincl "You can't take anything while on the bus.")
+ (dun-take-object objnum)))))))
(defun dun-take-object (objnum)
(if (and (member objnum dun-jar) (member obj-jar dun-inventory))
(dun-try-take objnum))
(if (>= objnum 0)
(progn
- (if (and (car dun-inventory)
+ (if (and (car dun-inventory)
(> (+ (dun-inven-weight) (nth objnum dun-object-lbs)) 11))
(dun-mprinc "Your load would be too heavy.")
(setq dun-inventory (append dun-inventory (list objnum)))
(dun-remove-obj-from-room dun-current-room objnum)
(dun-mprinc "Taken. ")
(if (and (= objnum obj-towel) (= dun-current-room red-room))
- (dun-mprinc
+ (dun-mprinc
"Taking the towel reveals a hole in the floor."))))
(dun-try-take objnum)))
(dun-mprinc "\n")))
(defun dun-dig (args)
(if dun-inbus
- (dun-mprincl "You can't dig while on the bus.")
+ (dun-mprincl "Digging here reveals nothing.")
(if (not (member 0 dun-inventory))
(dun-mprincl "You have nothing with which to dig.")
(if (not (nth dun-current-room dun-diggables))
(defun dun-climb (obj)
(let (objnum)
(setq objnum (dun-objnum-from-args obj))
- (cond ((null objnum)
- (dun-mprincl "I don't know that name."))
+ (cond ((not objnum)
+ (dun-mprincl "I don't know what that object is."))
((and (not (eq objnum obj-special))
(not (member objnum (nth dun-current-room dun-room-objects)))
(not (member objnum (nth dun-current-room dun-room-silents)))
+ (not (and (member objnum dun-jar) (member obj-jar dun-inventory)))
(not (member objnum dun-inventory)))
(dun-mprincl "I don't see that here."))
((and (eq objnum obj-special)
(dun-remove-obj-from-inven obj-food))))))
(defun dun-put (args)
- (if dun-inbus
- (dun-mprincl "You can't do that while on the bus")
(let (newargs objnum objnum2 obj)
(setq newargs (dun-firstwordl args))
(if (not newargs)
(setq objnum2 obj-pc))
(if (not objnum2)
(dun-mprincl "I don't know what that indirect object is.")
- (if (and (not (member objnum2
+ (if (and (not (member objnum2
(nth dun-current-room dun-room-objects)))
- (not (member objnum2
+ (not (member objnum2
(nth dun-current-room dun-room-silents)))
(not (member objnum2 dun-inventory)))
(dun-mprincl "That indirect object is not here.")
- (dun-put-objs objnum objnum2))))))))))
+ (dun-put-objs objnum objnum2)))))))))
(defun dun-put-objs (obj1 obj2)
(if (and (= obj2 obj-drop) (not dun-nomail))
(if (= obj2 obj-chute) ;; Put something in chute
(progn
(dun-remove-obj-from-inven obj1)
- (dun-mprincl
+ (dun-mprincl
"You hear it slide down the chute and off into the distance.")
(dun-put-objs-in-treas (list obj1)))
(if (= obj2 obj-box) ;; Put key in key box
(if (= obj2 obj-urinal) ;; Put object in urinal
(progn
(dun-remove-obj-from-inven obj1)
- (dun-replace dun-room-objects urinal (append
+ (dun-replace dun-room-objects urinal (append
(nth urinal dun-room-objects)
(list obj1)))
(dun-mprincl
(if (= obj2 obj-mail)
(dun-mprincl "The mail chute is locked.")
(if (member obj1 dun-inventory)
- (dun-mprincl
+ (dun-mprincl
"I don't know how to combine those objects. Perhaps you should
just try dropping it.")
(dun-mprincl"You can't put that there.")))))))))))
(if (not (= dun-current-room computer-room))
(dun-mprincl "There is nothing here on which you could type.")
(if (not dun-computer)
- (dun-mprincl
+ (dun-mprincl
"You type on the keyboard, but your characters do not even echo.")
(dun-unix-interface))))
(dun-move out))
(defun dun-go (args)
- (if (or (not (car args))
- (eq (dun-doverb dun-ignore dun-verblist (car args)
+ (if (or (not (car args))
+ (eq (dun-doverb dun-ignore dun-verblist (car args)
(cdr (cdr args))) -1))
(dun-mprinc "I don't understand where you want me to go.\n")))
;;; certain conditions are met.
(defun dun-move (dir)
- (if (and (not (member dun-current-room dun-light-rooms))
+ (if (and (not (member dun-current-room dun-light-rooms))
(not (member obj-lamp dun-inventory)))
(progn
- (dun-mprinc
+ (dun-mprinc
"You trip over a grue and fall into a pit and break every bone in your
body.")
(dun-die "a grue"))
(progn
(if (or (< newroom 58) (> newroom 83))
(dun-mprincl "The bus cannot go this way.")
- (dun-mprincl
+ (dun-mprincl
"The bus lurches ahead and comes to a screeching halt.")
(dun-remove-obj-from-room dun-current-room obj-bus)
(setq dun-current-room newroom)
(setq dun-current-room old-building-hallway))
(if (= dun-current-room north-end-of-cave-passage)
(let (combo)
- (dun-mprincl
+ (dun-mprincl
"You must type a 3 digit combination code to enter this room.")
(dun-mprinc "Enter it here: ")
(setq combo (dun-read-line))
(if (= dun-current-room bear-hangout)
(if (member obj-bear (nth bear-hangout dun-room-objects))
(progn
- (dun-mprinc
+ (dun-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.
")
(if (= dun-current-room classroom)
(dun-mprincl "The door is locked."))
- (if (or (= dun-current-room lakefront-north)
+ (if (or (= dun-current-room lakefront-north)
(= dun-current-room lakefront-south))
(dun-swim nil))
(setq dun-current-room long-n-s-hallway)
(dun-mprincl "You can't go that way.")))
- (if (and (> dir down) (> dun-current-room gamma-computing-center)
+ (if (and (> dir down) (> dun-current-room gamma-computing-center)
(< dun-current-room museum-lobby))
(if (not (member obj-bus (nth dun-current-room dun-room-objects)))
(dun-mprincl "You can't go that way.")
(if (= dir in)
- (if (member obj-license dun-inventory)
- (progn
- (dun-mprincl
- "You board the bus and get in the driver's seat.")
- (setq dun-nomail t)
- (setq dun-inbus t))
- (dun-mprincl "You are not licensed for this type of vehicle."))
- (dun-mprincl "You hop off the bus.")
- (setq dun-inbus nil)))
+ (if dun-inbus
+ (dun-mprincl
+ "You are already in the bus!")
+ (if (member obj-license dun-inventory)
+ (progn
+ (dun-mprincl
+ "You board the bus and get in the driver's seat.")
+ (setq dun-nomail t)
+ (setq dun-inbus t))
+ (dun-mprincl "You are not licensed for this type of vehicle.")))
+ (if (not dun-inbus)
+ (dun-mprincl "You are already off the bus!")
+ (dun-mprincl "You hop off the bus.")
+ (setq dun-inbus nil))))
(if (= dun-current-room fifth-oaktree-intersection)
(if (not dun-inbus)
(progn
(dun-mprincl
"As the bus approaches, the gate opens and you drive through.")
(dun-remove-obj-from-room main-maple-intersection obj-bus)
- (dun-replace dun-room-objects museum-entrance
+ (dun-replace dun-room-objects museum-entrance
(append (nth museum-entrance dun-room-objects)
(list obj-bus)))
(setq dun-current-room museum-entrance)))))
(if (not (= objnum obj-dial))
(dun-mprincl "You can't turn that.")
(setq direction (dun-firstword (cdr obj)))
- (if (or (not direction)
+ (if (or (not direction)
(not (or (string= direction "clockwise")
(string= direction "counterclockwise"))))
(dun-mprincl "You must indicate clockwise or counterclockwise.")
(if (string= direction "clockwise")
(setq dun-sauna-level (+ dun-sauna-level 1))
(setq dun-sauna-level (- dun-sauna-level 1)))
-
+
(if (< dun-sauna-level 0)
(progn
- (dun-mprincl
+ (dun-mprincl
"The dial will not turn further in that direction.")
(setq dun-sauna-level 0))
(dun-sauna-heat))))))))
(defun dun-sauna-heat ()
(if (= dun-sauna-level 0)
- (dun-mprincl
+ (dun-mprincl
"The temperature has returned to normal room temperature."))
(if (= dun-sauna-level 1)
- (dun-mprincl "It is now luke warm in here. You begin to sweat."))
+ (dun-mprincl "It is now luke warm in here. You are perspiring."))
(if (= dun-sauna-level 2)
(dun-mprincl "It is pretty hot in here. It is still very comfortable."))
(if (= dun-sauna-level 3)
(progn
- (dun-mprincl
+ (dun-mprincl
"It is now very hot. There is something very refreshing about this.")
- (if (or (member obj-rms dun-inventory)
+ (if (or (member obj-rms dun-inventory)
(member obj-rms (nth dun-current-room dun-room-objects)))
(progn
- (dun-mprincl
+ (dun-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 obj-rms dun-inventory)
(progn
(dun-remove-obj-from-inven obj-rms)
- (setq dun-inventory (append dun-inventory
+ (setq dun-inventory (append dun-inventory
(list obj-diamond))))
(dun-remove-obj-from-room dun-current-room obj-rms)
(dun-replace dun-room-objects dun-current-room
(member obj-floppy (nth dun-current-room dun-room-objects)))
(progn
(dun-mprincl
-"You notice your floppy disk beginning to melt. As you grab for it, the
+"You notice your floppy disk beginning to melt. As you grab for it, the
disk bursts into flames, and disintegrates.")
(if (member obj-floppy dun-inventory)
(dun-remove-obj-from-inven obj-floppy)
(if (= dun-sauna-level 4)
(progn
- (dun-mprincl
+ (dun-mprincl
"As the dial clicks into place, you immediately burst into flames.")
(dun-die "burning"))))
(dun-mprincl "I see no water!")
(if (not (member obj-life dun-inventory))
(progn
- (dun-mprincl
+ (dun-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.")
(dun-mprinc (dun-endgame-score))
(dun-mprincl " endgame points out of a possible 110.")
(if (= (dun-endgame-score) 110)
- (dun-mprincl
+ (dun-mprincl
"\n\nCongratulations. You have won. The wizard password is 'moby'"))))
(defun dun-help (args)
(dun-mprincl
-"Welcome to dunnet (2.0), by Ron Schnell (ronnie@media.mit.edu).
+"Welcome to dunnet (2.01), by Ron Schnell (ronnie@driver-aces.com).
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
- 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.
-- To run this game in batch mode (no emacs window), use:
+- To run this game in batch mode (no Emacs window), use:
emacs -batch -l dunnet
+NOTE: This game *should* be run in batch mode!
-If you have questions or comments, please contact ronnie@media.mit.edu."))
+If you have questions or comments, please contact ronnie@driver-aces.com
+My home page is http://www.driver-aces.com/ronnie.html
+"))
(defun dun-flush (args)
(if (not (= dun-current-room bathroom))
(dun-put-objs-in-treas (nth urinal dun-room-objects))
(dun-replace dun-room-objects urinal nil)))
-(defun dun-urinate (args)
+(defun dun-piss (args)
(if (not (= dun-current-room bathroom))
(dun-mprincl "You can't do that here, don't even bother trying.")
(if (not dun-gottago)
(dun-mprincl "I'm afraid you don't have to go now.")
(dun-mprincl "That was refreshing.")
(setq dun-gottago nil)
- (dun-replace dun-room-objects urinal (append
+ (dun-replace dun-room-objects urinal (append
(nth urinal dun-room-objects)
(list obj-URINE))))))
the object and slice off your hand. You bleed to death.")
(dun-die "an axe"))
(if (not (or (member objnum (nth dun-current-room dun-room-objects))
- (member objnum
+ (member objnum
(nth dun-current-room dun-room-silents))))
(dun-mprincl "I don't see that here.")
(if (= objnum obj-cable)
(progn
- (dun-mprincl
+ (dun-mprincl
"As you break the ethernet cable, everything starts to blur. You collapse
for a moment, then straighten yourself up.
")
(dun-replace dun-room-objects gamma-computing-center
- (append
+ (append
(nth gamma-computing-center dun-room-objects)
dun-inventory))
(if (member obj-key dun-inventory)
(progn
(setq dun-inventory (list obj-key))
- (dun-remove-obj-from-room
+ (dun-remove-obj-from-room
gamma-computing-center obj-key))
(setq dun-inventory nil))
(setq dun-current-room computer-room)
(setq newques nil)
(setq which (random (length dun-endgame-questions)))
(dun-mprincl "Your question is:")
- (dun-mprincl (setq dun-endgame-question (car
- (nth which
+ (dun-mprincl (setq dun-endgame-question (car
+ (nth which
dun-endgame-questions))))
(setq dun-correct-answer (cdr (nth which dun-endgame-questions)))
(while (< i which)
(defun dun-feed (args)
(let (objnum)
(when (setq objnum (dun-objnum-from-args-std args))
- (if (and (= objnum obj-bear)
+ (if (and (= objnum obj-bear)
(member obj-bear (nth dun-current-room dun-room-objects)))
(progn
(if (not (member obj-food dun-inventory))
(while (setq end-pos (string-match "[ ,:;]" (substring strin pos)))
(setq end-pos (+ end-pos pos))
(if (not (= end-pos pos))
- (setq ret-list (append ret-list (list
+ (setq ret-list (append ret-list (list
(downcase
(substring strin pos end-pos))))))
(setq pos (+ end-pos 1))) ret-list))
(while (setq end-pos (string-match " " (substring strin pos)))
(setq end-pos (+ end-pos pos))
(if (not (= end-pos pos))
- (setq ret-list (append ret-list (list
+ (setq ret-list (append ret-list (list
(downcase
(substring strin pos end-pos))))))
(setq pos (+ end-pos 1))) ret-list))
(condition-case nil
(dun-rot13)
(error (yank)))
- (eval-current-buffer)
- (kill-buffer (current-buffer))
- (switch-to-buffer old-buffer))
+ (eval-buffer)
+ (kill-buffer (current-buffer)))
+ (switch-to-buffer old-buffer)
result))
;;; Functions to remove an object either from a room, or from inventory.
(aset dun-translate-table (+ ?a i) (aref lower (+ i 13)))
(aset dun-translate-table (+ ?A i) (aref upper (+ i 13)))
(setq i (1+ i))))
-
+
(defun dun-rot13 ()
(let (str len (i 0))
(setq str (buffer-substring (point-min) (point-max)))
(setq dun-current-room 1)
(setq dun-exitf nil)
(setq dun-badcd nil)
-(defvar dungeon-mode-map nil)
-(setq dungeon-mode-map (make-sparse-keymap))
-(define-key dungeon-mode-map "\r" 'dun-parse)
+(define-obsolete-variable-alias 'dungeon-mode-map 'dun-mode-map "22.1")
+(define-key dun-mode-map "\r" 'dun-parse)
(defvar dungeon-batch-map (make-keymap))
(if (string= (substring emacs-version 0 2) "18")
(let (n)
(setq dun-endgame-question nil)
(setq dun-logged-in nil)
(setq dungeon-mode 'dungeon)
-(setq dun-unix-verbs '((ls . dun-ls) (ftp . dun-ftp) (echo . dun-echo)
+(setq dun-unix-verbs '((ls . dun-ls) (ftp . dun-ftp) (echo . dun-echo)
(exit . dun-uexit) (cd . dun-cd) (pwd . dun-pwd)
(rlogin . dun-rlogin) (uncompress . dun-uncompress)
(cat . dun-cat) (zippy . dun-zippy)))
(setq dun-cdroom -10)
(setq dun-uncompressed nil)
(setq dun-ethernet t)
-(setq dun-restricted
- '(dun-room-objects dungeon-map dun-rooms
+(setq dun-restricted
+ '(dun-room-objects dungeon-map dun-rooms
dun-room-silents dun-combination))
(setq dun-ftptype 'ascii)
(setq dun-endgame nil)
(
"You are at the northeast end of a northeast/southwest passageway.
Stairs lead up out of sight."
- "Ne end of ne/sw cave passage" ;37
+ "NE end of NE/SW cave passage" ;37
)
(
"You are at the junction of northeast/southwest and east/west passages."
- "Ne/sw-e/w junction" ;38
+ "NE/SW-E/W junction" ;38
)
(
"You are at the southwest end of a northeast/southwest passageway."
- "Sw end of ne/sw cave passage" ;39
+ "SW end of NE/SW cave passage" ;39
)
(
-"You are at the east end of an e/w passage. There are stairs leading up
+"You are at the east end of an E/W passage. There are stairs leading up
to a room above."
- "East end of e/w cave passage" ;40
+ "East end of E/W cave passage" ;40
)
(
-"You are at the west end of an e/w passage. There is a hole on the ground
+"You are at the west end of an E/W passage. There is a hole on the ground
which leads down out of sight."
- "West end of e/w cave passage" ;41
+ "West end of E/W cave passage" ;41
)
(
"You are in a room which is bare, except for a horseshoe shaped boulder
)
(
"You are in a crawlway that leads northeast or southwest."
- "Ne crawlway" ;55
+ "NE crawlway" ;55
)
(
"You are in a small crawlspace. There is a hole in the ground here, and
(
"You are in the main lobby for the Museum of Natural History. In the center
of the room is the huge skeleton of a dinosaur. Doors lead out to the
-south and east."
+south and east."
"Museum lobby" ;84
)
(
"You are in the geological display. All of the objects that used to
-be on display are missing. There are rooms to the east, west, and
+be on display are missing. There are rooms to the east, west, and
north."
"Geological display" ;85
)
(
"You are at the north end of a north/south tunnel. Stairs lead up and
down from here. There is a garbage disposal here."
- "North end of n/s tunnel" ;92
+ "North end of N/S tunnel" ;92
)
(
"You are at the top of some stairs near the subway station. There is
)
(
"You are in a north/south hallway."
- "Endgame n/s hallway" ;96
+ "Endgame N/S hallway" ;96
)
(
"You have reached a question room. You must answer a question correctly in
)
(
"You are in a north/south hallway."
- "Endgame n/s hallway" ;98
+ "Endgame N/S hallway" ;98
)
(
"You are in a second question room."
)
(
"You are in a north/south hallway."
- "Endgame n/s hallway" ;100
+ "Endgame N/S hallway" ;100
)
(
"You are in a third question room."
(
"You have reached a dead end. There is a PC on the floor here. Above
it is a sign that reads:
- Type the 'reset' command to type on the PC.
+ Type the 'reset' command to type on the PC.
A hole leads north."
"PC area" ;104
- )
+ )
))
(setq dun-light-rooms '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 24 25 26 27 28 58 59
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
77 78 79 80 81 82 83))
-(setq dun-verblist '((die . dun-die) (ne . dun-ne) (north . dun-n)
+(setq dun-verblist '((die . dun-die) (ne . dun-ne) (north . dun-n)
(south . dun-s) (east . dun-e) (west . dun-w)
(u . dun-up) (d . dun-down) (i . dun-inven)
(inventory . dun-inven) (look . dun-examine) (n . dun-n)
(s . dun-s) (e . dun-e) (w . dun-w) (se . dun-se)
- (nw . dun-nw) (sw . dun-sw) (up . dun-up)
+ (nw . dun-nw) (sw . dun-sw) (up . dun-up)
(down . dun-down) (in . dun-in) (out . dun-out)
(go . dun-go) (drop . dun-drop) (southeast . dun-se)
(southwest . dun-sw) (northeast . dun-ne)
(northwest . dun-nw) (save . dun-save-game)
(restore . dun-restore) (long . dun-long) (dig . dun-dig)
(shake . dun-shake) (wave . dun-shake)
- (examine . dun-examine) (describe . dun-examine)
+ (examine . dun-examine) (describe . dun-examine)
(climb . dun-climb) (eat . dun-eat) (put . dun-put)
(type . dun-type) (insert . dun-put)
- (score . dun-score) (help . dun-help) (quit . dun-quit)
- (read . dun-examine) (verbose . dun-long)
- (urinate . dun-urinate)
- (flush . dun-flush) (sleep . dun-sleep) (lie . dun-sleep)
+ (score . dun-score) (help . dun-help) (quit . dun-quit)
+ (read . dun-examine) (verbose . dun-long)
+ (urinate . dun-piss) (piss . dun-piss)
+ (flush . dun-flush) (sleep . dun-sleep) (lie . dun-sleep)
(x . dun-examine) (break . dun-break) (drive . dun-drive)
(board . dun-in) (enter . dun-in) (turn . dun-turn)
(press . dun-press) (push . dun-press) (swim . dun-swim)
;;; How the user references *all* objects, permanent and regular.
(setq dun-objnames '(
- (shovel . 0)
+ (shovel . 0)
(lamp . 1)
- (cpu . 2) (board . 2) (card . 2)
- (food . 3)
- (key . 4)
- (paper . 5)
+ (cpu . 2) (board . 2) (card . 2) (chip . 2)
+ (food . 3)
+ (key . 4)
+ (paper . 5) (slip . 5)
(rms . 6) (statue . 6) (statuette . 6) (stallman . 6)
(diamond . 7)
(weight . 8)
(life . 9) (preserver . 9)
- (bracelet . 10) (emerald . 10)
+ (bracelet . 10) (emerald . 10)
(gold . 11)
(platinum . 12)
(towel . 13) (beach . 13)
(acid . 21) (nitric . 21)
(glycerine . 22)
(ruby . 23)
- (amethyst . 24)
+ (amethyst . 24)
(mona . 25)
- (bill . 26)
+ (bill . 26)
(floppy . 27) (disk . 27)
-
+
(boulder . -1)
- (tree . -2) (trees . -2) (palm . -2)
+ (tree . -2) (trees . -2) (palm . -2)
(bear . -3)
(bin . -4) (bins . -4)
- (cabinet . -5) (computer . -5) (vax . -5) (ibm . -5)
+ (cabinet . -5) (computer . -5) (vax . -5) (ibm . -5)
(protoplasm . -6)
- (dial . -7)
- (button . -8)
- (chute . -9)
+ (dial . -7)
+ (button . -8)
+ (chute . -9)
(painting . -10)
(bed . -11)
(urinal . -12)
(URINE . -13)
- (pipes . -14) (pipe . -14)
- (box . -15) (slit . -15)
- (cable . -16) (ethernet . -16)
+ (pipes . -14) (pipe . -14)
+ (box . -15) (slit . -15)
+ (cable . -16) (ethernet . -16)
(mail . -17) (drop . -17)
(bus . -18)
(gate . -19)
- (cliff . -20)
+ (cliff . -20)
(skeleton . -21) (dinosaur . -21)
(fish . -22)
- (tanks . -23)
+ (tanks . -23) (tank . -23)
(switch . -24)
(blackboard . -25)
(disposal . -26) (garbage . -26)
(ladder . -27)
- (subway . -28) (train . -28)
- (pc . -29) (drive . -29)
+ (subway . -28) (train . -28)
+ (pc . -29) (drive . -29) (coconut . -30) (coconuts . -30)
+ (lake . -32) (water . -32)
))
(dolist (x dun-objnames)
;;; Objects that cannot be taken but might move and are
;;; described during room description are negative.
;;; Stuff that is described and might change are 255, and are
-;;; handled specially by 'dun-describe-room.
+;;; handled specially by 'dun-describe-room.
-(setq dun-room-objects (list nil
+(setq dun-room-objects (list nil
(list obj-shovel) ;; treasure-room
(list obj-boulder) ;; dead-end
(list obj-lamp obj-license obj-silver);; meadow
nil nil
(list obj-special) ;; sauna
- nil
+ nil
(list obj-weight obj-life) ;; weight-room
nil nil
(list obj-rms obj-floppy) ;; thirsty-maze
- nil nil nil nil nil nil nil
+ nil nil nil nil nil nil nil
(list obj-emerald) ;; hidden-area
nil
(list obj-gold) ;; misty-room
;;; room description. They are permanent.
(setq dun-room-silents (list nil
- (list obj-tree) ;; dead-end
- (list obj-tree) ;; e-w-dirt-road
+ (list obj-tree obj-coconut) ;; dead-end
+ (list obj-tree obj-coconut) ;; e-w-dirt-road
nil nil nil nil nil nil
(list obj-bin) ;; mailroom
(list obj-computer) ;; computer-room
(list obj-ladder) ;; weight-room
(list obj-button obj-ladder) ;; maze-button-room
nil nil nil
- nil nil nil nil nil nil nil
+ nil nil nil nil
+ (list obj-lake) ;; lakefront-north
+ (list obj-lake) ;; lakefront-south
+ nil
(list obj-chute) ;; cave-entrance
nil nil nil nil nil
(list obj-painting obj-bed) ;; bedroom
(list obj-disposal) ;; north-end-of-n-s-tunnel
nil nil
(list obj-computer) ;; endgame-computer-room
- nil nil nil nil nil nil nil nil
+ nil nil nil nil nil nil nil nil
(list obj-pc) ;; pc-area
nil nil nil nil nil nil
))
;;; Weight of objects
-(setq dun-object-lbs
+(setq dun-object-lbs
'(2 1 1 1 1 0 2 2 10 3 1 1 1 0 1 1 0 1 1 1 1 0 0 2 2 1 0 0))
-(setq dun-object-pts
+(setq dun-object-pts
'(0 0 0 0 0 0 0 10 0 0 10 10 10 0 0 10 0 10 10 0 0 0 0 10 10 10 10 0))
"It has your picture on it!"
"They are old coins from the 19th century."
"It is a valuable Fabrege egg."
-"It is a a plain glass jar."
+"It is a plain glass jar."
nil
nil
nil
"The dial points to a temperature scale which has long since faded away."
nil
nil
-"It is a velvet painting of Elvis Presly. It seems to be nailed to the
+"It is a velvet painting of Elvis Presley. It seems to be nailed to the
wall, and you cannot move it."
"It is a queen sized bed, with a very firm mattress."
"The urinal is very clean compared with everything else in the cave. There
isn't even any rust. Upon close examination you realize that the drain at the
bottom is missing, and there is just a large hole leading down the
-pipes into nowhere. The hole is too small for a person to fit in. The
+pipes into nowhere. The hole is too small for a person to fit in. The
flush handle is so clean that you can see your reflection in it."
nil
nil
)
)
-(setq dun-diggables
+(setq dun-diggables
(list nil nil nil (list obj-cpu) nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil ;11-20
nil nil nil nil nil nil nil nil nil nil ;21-30
nil nil nil nil nil nil nil nil nil nil ;31-40
nil (list obj-platinum) nil nil nil nil nil nil nil nil))
-(setq scroll-step 2)
-
(setq dun-room-shorts nil)
(dolist (x dun-rooms)
- (setq dun-room-shorts
- (append dun-room-shorts (list (downcase
+ (setq dun-room-shorts
+ (append dun-room-shorts (list (downcase
(dun-space-to-hyphen
(cadr x)))))))
(if (eq (dun-parse2 nil dun-unix-verbs line) -1)
(progn
(if (setq esign (string-match "=" line))
- (dun-doassign line esign)
+ (dun-doassign line esign)
(dun-mprinc (car line-list))
(dun-mprincl ": not found.")))))
(goto-char (point-max))
(setq epoint (+
(string-match "\"" afterq)
(+ esign 3))))
-
+
(if (not (setq epoint (string-match " " line)))
(setq epoint (length line))))
(setq epoint (1+ epoint))
(insert ")")
(setq eval-error nil)
(condition-case nil
- (eval-current-buffer)
+ (eval-buffer)
(error (setq eval-error t)))
(kill-buffer (current-buffer))
(switch-to-buffer "*dungeon*")
(if eval-error
(dun-mprincl "Invalid syntax."))))
-
+
(defun dun-unix-interface ()
(dun-login)
(if dun-logged-in
(progn
(setq dungeon-mode 'unix)
- (define-key dungeon-mode-map "\r" 'dun-unix-parse)
+ (define-key dun-mode-map "\r" 'dun-unix-parse)
(dun-mprinc "$ "))))
(defun dun-login ()
Welcome to Unix\n
Please clean up your directories. The filesystem is getting full.
Our tcp/ip link to gamma is a little flaky, but seems to work.
-The current version of ftp can only send files from the current
+The current version of ftp can only send files from your home
directory, and deletes them after they are sent! Be careful.
Note: Restricted bourne shell in use.\n")))
(dun-mprincl
"-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 paper.o.Z"))
(dolist (x dun-inventory)
- (dun-mprinc
+ (dun-mprinc
"-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ")
(dun-mprincl (nth x dun-objfiles))))
(if dun-batch-mode
(dun-mprincl
"Guest login okay, send your user ident as password.")
- (dun-mprincl
+ (dun-mprincl
"\nGuest login okay, send your user ident as password."))
(if dun-batch-mode
(dun-mprinc "Password required for ")
(dun-mprincl "Login failed.")
(dun-mprincl "\nLogin failed."))
(if dun-batch-mode
- (dun-mprincl
+ (dun-mprincl
"Guest login okay, user access restrictions apply.")
- (dun-mprincl
+ (dun-mprincl
"\nGuest login okay, user access restrictions apply."))
(dun-ftp-commands)
- (setq newlist
+ (setq newlist
'("What password did you use during anonymous ftp to gamma?"))
(setq newlist (append newlist (list ident)))
(rplaca (nthcdr 1 dun-endgame-questions) newlist)))))))))
-
+
(defun dun-ftp-commands ()
(setq dun-exitf nil)
(let (line)
(while (not dun-exitf)
(dun-mprinc "ftp> ")
(setq line (dun-read-line))
- (if
+ (if
(eq
- (dun-parse2 nil
+ (dun-parse2 nil
'((type . dun-ftptype) (binary . dun-bin) (bin . dun-bin)
(send . dun-send) (put . dun-send) (quit . dun-ftpquit)
(help . dun-ftphelp)(ascii . dun-fascii)
(if (not (eq dun-ftptype 'binary))
(progn
(if (not (member obj-protoplasm
- (nth receiving-room
+ (nth receiving-room
dun-room-objects)))
(dun-replace dun-room-objects receiving-room
- (append (nth receiving-room
+ (append (nth receiving-room
dun-room-objects)
(list obj-protoplasm))))
(dun-remove-obj-from-inven counter))
(dun-mprincl "No such file."))))))
(defun dun-ftphelp (args)
- (dun-mprincl
+ (dun-mprincl
"Possible commands are:\nsend quit type ascii binary help"))
(defun dun-uexit (args)
(setq dungeon-mode 'dungeon)
(dun-mprincl "\nYou step back from the console.")
- (define-key dungeon-mode-map "\r" 'dun-parse)
+ (define-key dun-mode-map "\r" 'dun-parse)
(if (not dun-batch-mode)
(dun-messages)))
(if (string= args "endgame")
(dun-rlogin-endgame)
(if (not (string= args "gamma"))
- (dun-mprincl "No such host.")
+ (if (string= args "pokey")
+ (dun-mprincl "Can't rlogin back to localhost")
+ (dun-mprincl "No such host."))
(if (not dun-ethernet)
(dun-mprincl "Host not responding.")
(dun-mprinc "Password: ")
(setq passwd (dun-read-line))
(if (not (string= passwd "worms"))
(dun-mprincl "\nlogin incorrect")
- (dun-mprinc
+ (dun-mprinc
"\nYou begin to feel strange for a moment, and you lose your items."
)
- (dun-replace dun-room-objects computer-room
- (append (nth computer-room dun-room-objects)
+ (dun-replace dun-room-objects computer-room
+ (append (nth computer-room dun-room-objects)
dun-inventory))
(setq dun-inventory nil)
(setq dun-current-room receiving-room)
(dun-uexit nil))))))))
-
+
(defun dun-cd (args)
(let (tcdpath tcdroom path-elements room-check)
(if (not (car args))
(setq dun-badcd nil)
(condition-case nil
(setq path-elements (dun-get-path (car args) nil))
- (error (dun-mprincl "Invalid path.")
+ (error (dun-mprincl "Invalid path")
(setq dun-badcd t)))
(dolist (pe path-elements)
(unless dun-badcd
(setq tcdpath "/rooms")
(setq tcdroom -2))
;In /rooms,/usr,root
- (if (or
- (= tcdroom -2) (= tcdroom -4)
+ (if (or
+ (= tcdroom -2) (= tcdroom -4)
(= tcdroom -3))
(progn
(setq tcdpath "/")
(if (= tcdroom -2)
(progn
(dolist (x dun-visited)
- (setq room-check
- (nth x
+ (setq room-check
+ (nth x
dun-room-shorts))
(if (string= room-check pe)
(progn
- (setq tcdpath
+ (setq tcdpath
(concat "/rooms/" room-check))
(setq tcdroom x))))
(if (= tcdroom -2)
(if (= dun-cdroom -10)
(setq checklist dun-inventory)
(setq checklist (nth dun-cdroom dun-room-objects)))
- (if (not (member (cdr
- (assq (intern
- (substring args 0 doto))
+ (if (not (member (cdr
+ (assq (intern
+ (substring args 0 doto))
dun-objnames))
checklist))
(dun-mprincl "File not found.")
(if (assq (intern args) dun-unix-verbs)
(dun-mprincl "Ascii files only.")
(dun-mprincl "File not found."))))))))
-
+
(defun dun-zippy (args)
(dun-mprincl (yow)))
(defun dun-rlogin-endgame ()
(if (not (= (dun-score nil) 90))
- (dun-mprincl
+ (dun-mprincl
"You have not achieved enough points to connect to endgame.")
(dun-mprincl"\nWelcome to the endgame. You are a truly noble adventurer.")
(setq dun-current-room treasure-room)
(random t)
(setq tloc (+ 60 (random 18)))
-(dun-replace dun-room-objects tloc
+(dun-replace dun-room-objects tloc
(append (nth tloc dun-room-objects) (list 18)))
(setq tcomb (+ 100 (random 899)))
(defun dun-dos-interface ()
(dun-dos-boot-msg)
(setq dungeon-mode 'dos)
- (define-key dungeon-mode-map "\r" 'dun-dos-parse)
+ (define-key dun-mode-map "\r" 'dun-dos-parse)
(dun-dos-prompt))
(defun dun-dos-type (args)
(sleep-for 1)
(if (or (not (setq args (car args))) (string= args "\\"))
(dun-mprincl "
- Volume in drive A is FOO
+ Volume in drive A is FOO
Volume Serial Number is 1A16-08C9
Directory of A:\\
1065280 bytes free
")
(dun-mprincl "
- Volume in drive A is FOO
+ Volume in drive A is FOO
Volume Serial Number is 1A16-08C9
Directory of A:\\
(defun dun-dos-exit (args)
(setq dungeon-mode 'dungeon)
(dun-mprincl "\nYou power down the machine and step back.")
- (define-key dungeon-mode-map "\r" 'dun-parse)
+ (define-key dun-mode-map "\r" 'dun-parse)
(if (not dun-batch-mode)
(dun-messages)))
(error (setq ferror t)))
(kill-buffer (current-buffer))
ferror))
-
+
(defun dun-save-val (varname)
(let (value)
(if (eq (dun-parse2 nil dun-unix-verbs line) -1)
(let (esign)
(if (setq esign (string-match "=" line))
- (dun-doassign line esign)
+ (dun-doassign line esign)
(dun-mprinc (car line-list))
(dun-mprincl ": not found.")))))
(goto-char (point-max))
(defun dungeon-nil (arg)
"noop"
- (interactive "*p"))
+ (interactive "*p")
+ nil)
(defun dun-batch-dungeon ()
(load "dun-batch")
(setq dun-batch-mode t)
(dun-batch-loop))
+(provide 'dunnet)
+;;; arch-tag: 4cc8e47c-d9e1-4ef4-936b-578e7f529558
+;;; dunnet.el ends here