summaryrefslogtreecommitdiff
path: root/lisp/play
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-07-13 20:44:02 +0000
committerRichard M. Stallman <rms@gnu.org>1993-07-13 20:44:02 +0000
commita399c5363f07c16f67eb4a344fac9570b3531b32 (patch)
tree7f5869c3cddcdec3ba9e2895895069fc8f2409f5 /lisp/play
parent1b6bb250a6f41bd515a45d4437b1892ca88aa203 (diff)
downloademacs-a399c5363f07c16f67eb4a344fac9570b3531b32.tar.gz
*** empty log message ***
Diffstat (limited to 'lisp/play')
-rw-r--r--lisp/play/dunnet.el2446
1 files changed, 1229 insertions, 1217 deletions
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el
index 61e879a9cb2..09dc317c9c0 100644
--- a/lisp/play/dunnet.el
+++ b/lisp/play/dunnet.el
@@ -25,16 +25,15 @@
;;; Commentary:
;; This game can be run in batch mode. To do this, use:
-;; emacs -batch -l dunnet.el
+;; emacs -batch -l dunnet
;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;;; The log file should be set for your system, and it must
;;; be writeable by all.
- (setq log-file "/usr/local/dunscore")
-
-
+ (defvar dun-log-file "/usr/local/dunnet.score"
+ "Name of file to store score information for dunnet.")
(if nil
(eval-and-compile (setq byte-compile-warnings nil)))
@@ -43,16 +42,16 @@
;;;; Mode definitions for interactive mode
-(defun dungeon-mode ()
- "Major mode for running dungeon"
+(defun dun-mode ()
+ "Major mode for running dunnet."
(interactive)
(text-mode)
(use-local-map dungeon-mode-map)
(setq major-mode 'dungeon-mode)
(setq mode-name "Dungeon"))
-(defun dungeon-parse (arg)
- "foo"
+(defun dun-parse (arg)
+ "Function called when return is pressed in interactive mode to parse line."
(interactive "*p")
(beginning-of-line)
(setq beg (+ (point) 1))
@@ -62,23 +61,23 @@
(progn
(setq line (downcase (buffer-substring beg (point))))
(princ line)
- (if (eq (parse ignore verblist line) -1)
- (mprinc "I don't understand that.\n")))
+ (if (eq (dun-vparse dun-ignore dun-verblist line) -1)
+ (dun-mprinc "I don't understand that.\n")))
(goto-char (point-max))
- (mprinc "\n"))
- (dungeon-messages))
+ (dun-mprinc "\n"))
+ (dun-messages))
-(defun dungeon-messages ()
- (if dead
+(defun dun-messages ()
+ (if dun-dead
(text-mode)
(if (eq dungeon-mode 'dungeon)
(progn
- (if (not (= room current-room))
+ (if (not (= room dun-current-room))
(progn
- (describe-room current-room)
- (setq room current-room)))
- (fix-screen)
- (mprinc ">")))))
+ (dun-describe-room dun-current-room)
+ (setq room dun-current-room)))
+ (dun-fix-screen)
+ (dun-mprinc ">")))))
;;;###autoload
@@ -86,10 +85,10 @@
"Switch to *dungeon* buffer and start game."
(interactive)
(switch-to-buffer "*dungeon*")
- (dungeon-mode)
- (setq dead nil)
+ (dun-mode)
+ (setq dun-dead nil)
(setq room 0)
- (dungeon-messages))
+ (dun-messages))
;;;;
;;;; This section contains all of the verbs and commands.
@@ -98,526 +97,535 @@
;;; 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 obj-lamp 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")))
+(defun dun-describe-room (room)
+ (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)
+ (string= dun-mode "dun-superb")) (> room 0))
+ (not (string= dun-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))
+ (dun-mprinc (car (nth (abs room) dun-rooms)))
+ (dun-mprinc "\n"))
+ (if (not (string= dun-mode "long"))
+ (if (not (member (abs room) dun-visited))
+ (setq dun-visited (append (list (abs room)) dun-visited))))
+ (dolist (xobjs (nth dun-current-room dun-room-objects))
(if (= xobjs obj-special)
- (special-object)
+ (dun-special-object)
(if (>= xobjs 0)
- (mprincl (car (nth xobjs objects)))
- (if (not (and (= xobjs obj-bus) inbus))
+ (dun-mprincl (car (nth xobjs dun-objects)))
+ (if (not (and (= xobjs obj-bus) dun-inbus))
(progn
- (mprincl (car (nth (abs xobjs) perm-objects)))))))
- (if (and (= xobjs obj-jar) jar)
+ (dun-mprincl (car (nth (abs xobjs) dun-perm-objects)))))))
+ (if (and (= xobjs obj-jar) dun-jar)
(progn
- (mprincl "The jar contains:")
- (dolist (x jar)
- (mprinc " ")
- (mprincl (car (nth x objects)))))))
- (if (and (member obj-bus (nth current-room room-objects)) inbus)
- (mprincl "You are on the bus."))))
+ (dun-mprincl "The jar contains:")
+ (dolist (x dun-jar)
+ (dun-mprinc " ")
+ (dun-mprincl (car (nth x dun-objects)))))))
+ (if (and (member obj-bus (nth dun-current-room dun-room-objects)) dun-inbus)
+ (dun-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 computer-room)
- (if computer
- (mprincl
+(defun dun-special-object ()
+
+ (if (= dun-current-room computer-room)
+ (if dun-computer
+ (dun-mprincl
"The panel lights are flashing in a seemingly organized pattern.")
- (mprincl "The panel lights are steady and motionless.")))
+ (dun-mprincl "The panel lights are steady and motionless.")))
- (if (and (= current-room red-room)
- (not (member obj-towel (nth red-room room-objects))))
- (mprincl "There is a hole in the floor here."))
+ (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 (= current-room marine-life-area) black)
- (mprincl
+ (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
your objects, to give off an eerie glow."))
- (if (and (= current-room fourth-vermont-intersection) hole)
+ (if (and (= dun-current-room fourth-vermont-intersection) dun-hole)
(progn
- (mprincl"You fall into a hole in the ground.")
- (setq current-room vermont-station)
- (describe-room vermont-station)))
+ (dun-mprincl"You fall into a hole in the ground.")
+ (setq dun-current-room vermont-station)
+ (dun-describe-room vermont-station)))
- (if (> current-room endgame-computer-room)
+ (if (> dun-current-room endgame-computer-room)
(progn
- (if (not correct-answer)
- (endgame-question)
- (mprincl "Your question is:")
- (mprincl endgame-question))))
+ (if (not dun-correct-answer)
+ (dun-endgame-question)
+ (dun-mprincl "Your question is:")
+ (dun-mprincl dun-endgame-question))))
- (if (= current-room sauna)
+ (if (= dun-current-room sauna)
(progn
- (mprincl (nth sauna-level '(
+ (dun-mprincl (nth dun-sauna-level '(
"It is normal room temperature 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 obj-rms inventory)
- (member obj-rms (nth current-room room-objects))))
+ (if (and (= dun-sauna-level 3)
+ (or (member obj-rms dun-inventory)
+ (member obj-rms (nth dun-current-room dun-room-objects))))
(progn
- (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 inventory)
+ (if (member obj-rms dun-inventory)
(progn
- (remove-obj-from-inven obj-rms)
- (setq inventory (append inventory (list obj-diamond))))
- (remove-obj-from-room current-room obj-rms)
- (replace room-objects current-room
- (append (nth current-room room-objects)
+ (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 inventory)
+ (if (member obj-floppy dun-inventory)
(progn
- (mprincl
+ (dun-mprincl
"You notice your floppy disk beginning to melt. As you grab for it, the
disk bursts into flames, and disintegrates.")
- (remove-obj-from-inven obj-floppy)
- (remove-obj-from-room current-room obj-floppy)))))))
-)
+ (dun-remove-obj-from-inven obj-floppy)
+ (dun-remove-obj-from-room dun-current-room obj-floppy)))))
+ )))
-(defun die (murderer)
- (mprinc "\n")
+(defun dun-die (murderer)
+ (dun-mprinc "\n")
(if murderer
- (mprincl "You are dead."))
- (do-logfile 'die murderer)
- (score nil)
- (setq dead t))
+ (dun-mprincl "You are dead."))
+ (dun-do-logfile 'dun-die murderer)
+ (dun-score nil)
+ (setq dun-dead t))
-(defun quit (args)
- (die nil))
+(defun dun-quit (args)
+ (dun-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)
+(defun dun-inven (args)
+ (dun-mprinc "You currently have:")
+ (dun-mprinc "\n")
+ (dolist (curobj dun-inventory)
(if curobj
(progn
- (mprincl (cadr (nth curobj objects)))
- (if (and (= curobj obj-jar) jar)
+ (dun-mprincl (cadr (nth curobj dun-objects)))
+ (if (and (= curobj obj-jar) dun-jar)
(progn
- (mprincl "The jar contains:")
- (dolist (x jar)
- (mprinc " ")
- (mprincl (cadr (nth x objects))))))))))
+ (dun-mprincl "The jar contains:")
+ (dolist (x dun-jar)
+ (dun-mprinc " ")
+ (dun-mprincl (cadr (nth x dun-objects))))))))))
-(defun shake (obj)
+(defun dun-shake (obj)
(let (objnum)
- (when (setq objnum (objnum-from-args-std obj))
- (if (member objnum inventory)
+ (when (setq objnum (dun-objnum-from-args-std obj))
+ (if (member objnum dun-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")
+ (dun-mprinc "Shaking ")
+ (dun-mprinc (downcase (cadr (nth objnum dun-objects))))
+ (dun-mprinc " seems to have no effect.")
+ (dun-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.")
+ (if (and (not (member objnum (nth dun-current-room dun-room-silents)))
+ (not (member objnum (nth dun-current-room dun-room-objects))))
+ (dun-mprincl "I don't see that here.")
;;; Shaking trees can be deadly
(if (= objnum obj-tree)
(progn
- (mprinc
+ (dun-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"))
+ (dun-die "a coconut"))
(if (= objnum obj-bear)
(progn
- (mprinc
+ (dun-mprinc
"As you go up to the bear, it removes your head and places it on the ground.")
- (die "a bear"))
+ (dun-die "a bear"))
(if (< objnum 0)
- (mprincl "You cannot shake that.")
- (mprincl "You don't have that.")))))))))
+ (dun-mprincl "You cannot shake that.")
+ (dun-mprincl "You don't have that.")))))))))
-(defun drop (obj)
- (if inbus
- (mprincl "You can't drop anything while on the bus.")
+(defun dun-drop (obj)
+ (if dun-inbus
+ (dun-mprincl "You can't drop anything while on the bus.")
(let (objnum ptr)
- (when (setq objnum (objnum-from-args-std obj))
- (if (not (setq ptr (member objnum inventory)))
- (mprincl "You don't have that.")
+ (when (setq objnum (dun-objnum-from-args-std obj))
+ (if (not (setq ptr (member objnum dun-inventory)))
+ (dun-mprincl "You don't have that.")
(progn
- (remove-obj-from-inven objnum)
- (replace room-objects current-room
- (append (nth current-room room-objects)
+ (dun-remove-obj-from-inven objnum)
+ (dun-replace dun-room-objects dun-current-room
+ (append (nth dun-current-room dun-room-objects)
(list objnum)))
- (mprincl "Done.")
+ (dun-mprincl "Done.")
(if (member objnum (list obj-food obj-weight obj-jar))
- (drop-check objnum))))))))
+ (dun-drop-check objnum))))))))
;;; Dropping certain things causes things to happen.
-(defun drop-check (objnum)
+(defun dun-drop-check (objnum)
(if (and (= objnum obj-food) (= room bear-hangout)
- (member obj-bear (nth bear-hangout room-objects)))
+ (member obj-bear (nth bear-hangout dun-room-objects)))
(progn
- (mprincl
+ (dun-mprincl
"The bear takes the food and runs away with it. He left something behind.")
- (remove-obj-from-room current-room obj-bear)
- (remove-obj-from-room current-room obj-food)
- (replace room-objects current-room
- (append (nth current-room room-objects)
+ (dun-remove-obj-from-room dun-current-room obj-bear)
+ (dun-remove-obj-from-room dun-current-room obj-food)
+ (dun-replace dun-room-objects dun-current-room
+ (append (nth dun-current-room dun-room-objects)
(list obj-key)))))
- (if (and (= objnum obj-jar) (member obj-nitric jar)
- (member obj-glycerine jar))
+ (if (and (= objnum obj-jar) (member obj-nitric dun-jar)
+ (member obj-glycerine dun-jar))
(progn
- (mprincl "As the jar impacts the ground it explodes into many pieces.")
- (setq jar nil)
- (remove-obj-from-room current-room obj-jar)
- (if (= current-room fourth-vermont-intersection)
+ (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)
+ (if (= dun-current-room fourth-vermont-intersection)
(progn
- (setq hole t)
- (setq current-room vermont-station)
- (mprincl
+ (setq dun-hole t)
+ (setq dun-current-room vermont-station)
+ (dun-mprincl
"The explosion causes a hole to open up in the ground, which you fall
through.")))))
- (if (and (= objnum obj-weight) (= current-room maze-button-room))
- (mprincl "A passageway opens.")))
+ (if (and (= objnum obj-weight) (= dun-current-room maze-button-room))
+ (dun-mprincl "A passageway opens.")))
;;; Give long description of current room, or an object.
-(defun examine (obj)
+(defun dun-examine (obj)
(let (objnum)
- (setq objnum (objnum-from-args obj))
+ (setq objnum (dun-objnum-from-args obj))
(if (eq objnum obj-special)
- (describe-room (* current-room -1))
+ (dun-describe-room (* dun-current-room -1))
(if (and (eq objnum obj-computer)
- (member obj-pc (nth current-room room-silents)))
- (examine '("pc"))
+ (member obj-pc (nth dun-current-room dun-room-silents)))
+ (dun-examine '("pc"))
(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.")
+ (dun-mprincl "I don't know what that is.")
+ (if (and (not (member objnum
+ (nth dun-current-room dun-room-objects)))
+ (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)
- (= current-room marine-life-area) black)
- (mprincl
+ (= dun-current-room marine-life-area) dun-black)
+ (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 physobj-desc)
- (mprincl (nth objnum physobj-desc))
- (mprincl "I see nothing special about that.")))
- (if (nth (abs objnum) permobj-desc)
+ (if (nth objnum dun-physobj-desc)
+ (dun-mprincl (nth objnum dun-physobj-desc))
+ (dun-mprincl "I see nothing special about that.")))
+ (if (nth (abs objnum) dun-permobj-desc)
(progn
- (mprincl (nth (abs objnum) permobj-desc)))
- (mprincl "I see nothing special about that.")))))))))
+ (dun-mprincl (nth (abs objnum) dun-permobj-desc)))
+ (dun-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))
+(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)
- (mprincl "You must supply an object.")
+ (dun-mprincl "You must supply an object.")
(if (string= obj "all")
(let (gotsome)
(setq gotsome nil)
- (dolist (x (nth current-room room-objects))
+ (dolist (x (nth dun-current-room dun-room-objects))
(if (and (>= x 0) (not (= x obj-special)))
(progn
(setq gotsome t)
- (mprinc (cadr (nth x objects)))
- (mprinc ": ")
- (take-object x))))
+ (dun-mprinc (cadr (nth x dun-objects)))
+ (dun-mprinc ": ")
+ (dun-take-object x))))
(if (not gotsome)
- (mprincl "Nothing to take.")))
+ (dun-mprincl "Nothing to take.")))
(let (objnum)
- (setq objnum (cdr (assq (intern obj) objnames)))
+ (setq objnum (cdr (assq (intern obj) dun-objnames)))
(if (eq objnum nil)
(progn
- (mprinc "I don't know what that is.")
- (mprinc "\n"))
- (take-object objnum)))))))
+ (dun-mprinc "I don't know what that is.")
+ (dun-mprinc "\n"))
+ (dun-take-object objnum)))))))
-(defun take-object (objnum)
- (if (and (member objnum jar) (member obj-jar inventory))
+(defun dun-take-object (objnum)
+ (if (and (member objnum dun-jar) (member obj-jar dun-inventory))
(let (newjar)
- (mprincl "You remove it from the jar.")
+ (dun-mprincl "You remove it from the jar.")
(setq newjar nil)
- (dolist (x jar)
+ (dolist (x dun-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))
+ (setq dun-jar newjar)
+ (setq dun-inventory (append dun-inventory (list objnum))))
+ (if (not (member objnum (nth dun-current-room dun-room-objects)))
+ (if (not (member objnum (nth dun-current-room dun-room-silents)))
+ (dun-mprinc "I do not see that here.")
+ (dun-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 obj-towel) (= current-room red-room))
- (mprinc "Taking the towel reveals a hole in the floor."))))
- (try-take objnum)))
- (mprinc "\n")))
-
-(defun inven-weight ()
+ (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
+ "Taking the towel reveals a hole in the floor."))))
+ (dun-try-take objnum)))
+ (dun-mprinc "\n")))
+
+(defun dun-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))
+ (dolist (x dun-jar)
+ (setq total (+ total (nth x dun-object-lbs))))
+ (dolist (x dun-inventory)
+ (setq total (+ total (nth x dun-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 (obj)
+(defun dun-try-take (obj)
+ (dun-mprinc "You cannot take that."))
+
+(defun dun-dig (args)
+ (if dun-inbus
+ (dun-mprincl "You can't dig while on the bus.")
+ (if (not (member 0 dun-inventory))
+ (dun-mprincl "You have nothing with which to dig.")
+ (if (not (nth dun-current-room dun-diggables))
+ (dun-mprincl "Digging here reveals nothing.")
+ (dun-mprincl "I think you found something.")
+ (dun-replace dun-room-objects dun-current-room
+ (append (nth dun-current-room dun-room-objects)
+ (nth dun-current-room dun-diggables)))
+ (dun-replace dun-diggables dun-current-room nil)))))
+
+(defun dun-climb (obj)
(let (objnum)
- (setq objnum (objnum-from-args obj))
+ (setq objnum (dun-objnum-from-args obj))
(if (and (not (= objnum obj-special))
- (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.")
+ (not (member objnum (nth dun-current-room dun-room-objects)))
+ (not (member objnum (nth dun-current-room dun-room-silents)))
+ (not (member objnum dun-inventory)))
+ (dun-mprincl "I don't see that here.")
(if (and (= objnum obj-special)
- (not (member obj-tree (nth current-room room-silents))))
- (mprincl "There is nothing here to climb.")
+ (not (member obj-tree (nth dun-current-room dun-room-silents))))
+ (dun-mprincl "There is nothing here to climb.")
(if (and (not (= objnum obj-tree)) (not (= objnum obj-special)))
- (mprincl "You can't climb that.")
- (mprincl
+ (dun-mprincl "You can't climb that.")
+ (dun-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)
+(defun dun-eat (obj)
(let (objnum)
- (when (setq objnum (objnum-from-args-std obj))
- (if (not (member objnum inventory))
- (mprincl "You don't have that.")
+ (when (setq objnum (dun-objnum-from-args-std obj))
+ (if (not (member objnum dun-inventory))
+ (dun-mprincl "You don't have that.")
(if (not (= objnum obj-food))
(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 obj-food))))))
-
-(defun dput (args)
- (if inbus
- (mprincl "You can't do that while on the bus")
+ (dun-mprinc "You forcefully shove ")
+ (dun-mprinc (downcase (cadr (nth objnum dun-objects))))
+ (dun-mprincl " down your throat, and start choking.")
+ (dun-die "choking"))
+ (dun-mprincl "That tasted horrible.")
+ (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 (firstwordl args))
+ (setq newargs (dun-firstwordl args))
(if (not newargs)
- (mprincl "You must supply an object")
+ (dun-mprincl "You must supply an object")
(setq obj (intern (car newargs)))
- (setq objnum (cdr (assq obj objnames)))
+ (setq objnum (cdr (assq obj dun-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)))
+ (dun-mprincl "I don't know what that object is.")
+ (if (not (member objnum dun-inventory))
+ (dun-mprincl "You don't have that.")
+ (setq newargs (dun-firstwordl (cdr newargs)))
+ (setq newargs (dun-firstwordl (cdr newargs)))
(if (not newargs)
- (mprincl "You must supply an indirect object.")
- (setq objnum2 (cdr (assq (intern (car newargs)) objnames)))
- (if (and (eq objnum2 obj-computer) (= current-room pc-area))
+ (dun-mprincl "You must supply an indirect object.")
+ (setq objnum2 (cdr (assq (intern (car newargs)) dun-objnames)))
+ (if (and (eq objnum2 obj-computer) (= dun-current-room pc-area))
(setq objnum2 obj-pc))
(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 obj-drop) (not nomail))
+ (dun-mprincl "I don't know what that indirect object is.")
+ (if (and (not (member objnum2
+ (nth dun-current-room dun-room-objects)))
+ (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))))))))))
+
+(defun dun-put-objs (obj1 obj2)
+ (if (and (= obj2 obj-drop) (not dun-nomail))
(setq obj2 obj-chute))
(if (= obj2 obj-disposal) (setq obj2 obj-chute))
(if (and (= obj1 obj-cpu) (= obj2 obj-computer))
(progn
- (remove-obj-from-inven obj-cpu)
- (setq computer t)
- (mprincl
+ (dun-remove-obj-from-inven obj-cpu)
+ (setq dun-computer t)
+ (dun-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 obj-weight) (= obj2 obj-button))
- (drop '("weight"))
+ (dun-drop '("weight"))
(if (= obj2 obj-jar) ;; Put something in jar
(if (not (member obj1 (list obj-paper obj-diamond obj-emerald
obj-license obj-coins obj-egg
obj-nitric obj-glycerine)))
- (mprincl "That will not fit in the jar.")
- (remove-obj-from-inven obj1)
- (setq jar (append jar (list obj1)))
- (mprincl "Done."))
+ (dun-mprincl "That will not fit in the jar.")
+ (dun-remove-obj-from-inven obj1)
+ (setq dun-jar (append dun-jar (list obj1)))
+ (dun-mprincl "Done."))
(if (= obj2 obj-chute) ;; Put something in chute
(progn
- (remove-obj-from-inven obj1)
- (mprincl
+ (dun-remove-obj-from-inven obj1)
+ (dun-mprincl
"You hear it slide down the chute and off into the distance.")
- (put-objs-in-treas (list obj1)))
+ (dun-put-objs-in-treas (list obj1)))
(if (= obj2 obj-box) ;; Put key in key box
(if (= obj1 obj-key)
(progn
- (mprincl
+ (dun-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 computer-room (append
+ (dun-remove-obj-from-inven obj1)
+ (dun-replace dun-room-objects computer-room (append
(nth computer-room
- room-objects)
+ dun-room-objects)
(list obj1)))
- (remove-obj-from-room current-room obj-box)
- (setq key-level (1+ key-level)))
- (mprincl "You can't put that in the key box!"))
+ (dun-remove-obj-from-room dun-current-room obj-box)
+ (setq dun-key-level (1+ dun-key-level)))
+ (dun-mprincl "You can't put that in the key box!"))
(if (and (= obj1 obj-floppy) (= obj2 obj-pc))
(progn
- (setq floppy t)
- (remove-obj-from-inven obj1)
- (mprincl "Done."))
+ (setq dun-floppy t)
+ (dun-remove-obj-from-inven obj1)
+ (dun-mprincl "Done."))
(if (= obj2 obj-urinal) ;; Put object in urinal
(progn
- (remove-obj-from-inven obj1)
- (replace room-objects urinal (append
- (nth urinal room-objects)
+ (dun-remove-obj-from-inven obj1)
+ (dun-replace dun-room-objects urinal (append
+ (nth urinal dun-room-objects)
(list obj1)))
- (mprincl
+ (dun-mprincl
"You hear it plop down in some water below."))
(if (= obj2 obj-mail)
- (mprincl "The mail chute is locked.")
- (if (member obj1 inventory)
- (mprincl
+ (dun-mprincl "The mail chute is locked.")
+ (if (member obj1 dun-inventory)
+ (dun-mprincl
"I don't know how to combine those objects. Perhaps you should
just try dropping it.")
- (mprincl"You can't put that there.")))))))))))
+ (dun-mprincl"You can't put that there.")))))))))))
-(defun type (args)
- (if (not (= current-room computer-room))
- (mprincl "There is nothing here on which you could type.")
- (if (not computer)
- (mprincl
+(defun dun-type (args)
+ (if (not (= dun-current-room computer-room))
+ (dun-mprincl "There is nothing here on which you could type.")
+ (if (not dun-computer)
+ (dun-mprincl
"You type on the keyboard, but your characters do not even echo.")
- (unix-interface))))
+ (dun-unix-interface))))
;;; Various movement directions
-(defun n (args)
- (move north))
+(defun dun-n (args)
+ (dun-move north))
-(defun s (args)
- (move south))
+(defun dun-s (args)
+ (dun-move south))
-(defun e (args)
- (move east))
+(defun dun-e (args)
+ (dun-move east))
-(defun w (args)
- (move west))
+(defun dun-w (args)
+ (dun-move west))
-(defun ne (args)
- (move northeast))
+(defun dun-ne (args)
+ (dun-move northeast))
-(defun se (args)
- (move southeast))
+(defun dun-se (args)
+ (dun-move southeast))
-(defun nw (args)
- (move northwest))
+(defun dun-nw (args)
+ (dun-move northwest))
-(defun sw (args)
- (move southwest))
+(defun dun-sw (args)
+ (dun-move southwest))
-(defun up (args)
- (move up))
+(defun dun-up (args)
+ (dun-move up))
-(defun down (args)
- (move down))
+(defun dun-down (args)
+ (dun-move down))
-(defun in (args)
- (move in))
+(defun dun-in (args)
+ (dun-move in))
-(defun out (args)
- (move out))
+(defun dun-out (args)
+ (dun-move out))
-(defun go (args)
+(defun dun-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")))
+ (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")))
;;; Uses the dungeon-map to figure out where we are going. If the
;;; requested direction yields 255, we know something special is
;;; supposed to happen, or perhaps you can't go that way unless
;;; certain conditions are met.
-(defun move (dir)
- (if (and (not (member current-room light-rooms))
- (not (member obj-lamp inventory)))
+(defun dun-move (dir)
+ (if (and (not (member dun-current-room dun-light-rooms))
+ (not (member obj-lamp dun-inventory)))
(progn
- (mprinc
+ (dun-mprinc
"You trip over a grue and fall into a pit and break every bone in your
body.")
- (die "a grue"))
+ (dun-die "a grue"))
(let (newroom)
- (setq newroom (nth dir (nth current-room dungeon-map)))
+ (setq newroom (nth dir (nth dun-current-room dungeon-map)))
(if (eq newroom -1)
- (mprinc "You can't go that way.\n")
+ (dun-mprinc "You can't go that way.\n")
(if (eq newroom 255)
- (special-move dir)
+ (dun-special-move dir)
(setq room -1)
- (setq lastdir dir)
- (if inbus
+ (setq dun-lastdir dir)
+ (if dun-inbus
(progn
(if (or (< newroom 58) (> newroom 83))
- (mprincl "The bus cannot go this way.")
- (mprincl
+ (dun-mprincl "The bus cannot go this way.")
+ (dun-mprincl
"The bus lurches ahead and comes to a screeching halt.")
- (remove-obj-from-room current-room obj-bus)
- (setq current-room newroom)
- (replace room-objects newroom
- (append (nth newroom room-objects)
+ (dun-remove-obj-from-room dun-current-room obj-bus)
+ (setq dun-current-room newroom)
+ (dun-replace dun-room-objects newroom
+ (append (nth newroom dun-room-objects)
(list obj-bus)))))
- (setq current-room newroom)))))))
+ (setq dun-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
@@ -629,241 +637,245 @@ body.")
;;; a problem. Be careful when adding them to consider this, and
;;; perhaps use else's.
-(defun special-move (dir)
- (if (= current-room building-front)
- (if (not (member obj-key inventory))
- (mprincl "You don't have a key that can open this door.")
- (setq current-room old-building-hallway))
- (if (= current-room north-end-of-cave-passage)
+(defun dun-special-move (dir)
+ (if (= dun-current-room building-front)
+ (if (not (member obj-key dun-inventory))
+ (dun-mprincl "You don't have a key that can open this door.")
+ (setq dun-current-room old-building-hallway))
+ (if (= dun-current-room north-end-of-cave-passage)
(let (combo)
- (mprincl
+ (dun-mprincl
"You must type a 3 digit combination code to enter this room.")
- (mprinc "Enter it here: ")
- (setq combo (read-line))
- (if (not batch-mode)
- (mprinc "\n"))
- (if (string= combo combination)
- (setq current-room gamma-computing-center)
- (mprincl "Sorry, that combination is incorrect."))))
-
- (if (= current-room bear-hangout)
- (if (member obj-bear (nth bear-hangout room-objects))
+ (dun-mprinc "Enter it here: ")
+ (setq combo (dun-read-line))
+ (if (not dun-batch-mode)
+ (dun-mprinc "\n"))
+ (if (string= combo dun-combination)
+ (setq dun-current-room gamma-computing-center)
+ (dun-mprincl "Sorry, that combination is incorrect."))))
+
+ (if (= dun-current-room bear-hangout)
+ (if (member obj-bear (nth bear-hangout dun-room-objects))
(progn
- (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.
")
- (die "a bear"))
- (mprincl "You can't go that way.")))
+ (dun-die "a bear"))
+ (dun-mprincl "You can't go that way.")))
- (if (= current-room vermont-station)
+ (if (= dun-current-room vermont-station)
(progn
- (mprincl
+ (dun-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
+ (dun-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 museum-station)))
-
- (if (= current-room old-building-hallway)
- (if (and (member obj-key inventory)
- (> key-level 0))
- (setq current-room meadow)
- (mprincl "You don't have a key that can open this door.")))
-
- (if (and (= current-room maze-button-room) (= dir northwest))
- (if (member obj-weight (nth maze-button-room room-objects))
- (setq current-room 18)
- (mprincl "You can't go that way.")))
-
- (if (and (= current-room maze-button-room) (= dir up))
- (if (member obj-weight (nth maze-button-room room-objects))
- (mprincl "You can't go that way.")
- (setq current-room weight-room)))
-
- (if (= current-room classroom)
- (mprincl "The door is locked."))
-
- (if (or (= current-room lakefront-north) (= current-room lakefront-south))
- (swim nil))
-
- (if (= current-room reception-area)
- (if (not (= sauna-level 3))
- (setq current-room health-club-front)
- (mprincl
+ (setq dun-current-room museum-station)))
+
+ (if (= dun-current-room old-building-hallway)
+ (if (and (member obj-key dun-inventory)
+ (> dun-key-level 0))
+ (setq dun-current-room meadow)
+ (dun-mprincl "You don't have a key that can open this door.")))
+
+ (if (and (= dun-current-room maze-button-room) (= dir northwest))
+ (if (member obj-weight (nth maze-button-room dun-room-objects))
+ (setq dun-current-room 18)
+ (dun-mprincl "You can't go that way.")))
+
+ (if (and (= dun-current-room maze-button-room) (= dir up))
+ (if (member obj-weight (nth maze-button-room dun-room-objects))
+ (dun-mprincl "You can't go that way.")
+ (setq dun-current-room weight-room)))
+
+ (if (= dun-current-room classroom)
+ (dun-mprincl "The door is locked."))
+
+ (if (or (= dun-current-room lakefront-north)
+ (= dun-current-room lakefront-south))
+ (dun-swim nil))
+
+ (if (= dun-current-room reception-area)
+ (if (not (= dun-sauna-level 3))
+ (setq dun-current-room health-club-front)
+ (dun-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")))
+ (dun-die "burning")))
- (if (= current-room red-room)
- (if (not (member obj-towel (nth red-room room-objects)))
- (setq current-room long-n-s-hallway)
- (mprincl "You can't go that way.")))
+ (if (= dun-current-room red-room)
+ (if (not (member obj-towel (nth red-room dun-room-objects)))
+ (setq dun-current-room long-n-s-hallway)
+ (dun-mprincl "You can't go that way.")))
- (if (and (> dir down) (> current-room gamma-computing-center)
- (< current-room museum-lobby))
- (if (not (member obj-bus (nth current-room room-objects)))
- (mprincl "You can't go that way.")
+ (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 inventory)
+ (if (member obj-license dun-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 fifth-oaktree-intersection)
- (if (not inbus)
+ (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-current-room fifth-oaktree-intersection)
+ (if (not dun-inbus)
(progn
- (mprincl "You fall down the cliff and land on your head.")
- (die "a cliff"))
- (mprincl
+ (dun-mprincl "You fall down the cliff and land on your head.")
+ (dun-die "a cliff"))
+ (dun-mprincl
"The bus flies off the cliff, and plunges to the bottom, where it explodes.")
- (die "a bus accident")))
- (if (= current-room main-maple-intersection)
+ (dun-die "a bus accident")))
+ (if (= dun-current-room main-maple-intersection)
(progn
- (if (not inbus)
- (mprincl "The gate will not open.")
- (mprincl
+ (if (not dun-inbus)
+ (dun-mprincl "The gate will not open.")
+ (dun-mprincl
"As the bus approaches, the gate opens and you drive through.")
- (remove-obj-from-room main-maple-intersection obj-bus)
- (replace room-objects museum-entrance
- (append (nth museum-entrance room-objects)
+ (dun-remove-obj-from-room main-maple-intersection obj-bus)
+ (dun-replace dun-room-objects museum-entrance
+ (append (nth museum-entrance dun-room-objects)
(list obj-bus)))
- (setq current-room museum-entrance)))))
- (if (= current-room cave-entrance)
+ (setq dun-current-room museum-entrance)))))
+ (if (= dun-current-room cave-entrance)
(progn
- (mprincl
+ (dun-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 misty-room)))))
+ (setq dun-current-room misty-room)))))
-(defun long (args)
- (setq mode "long"))
+(defun dun-long (args)
+ (setq dun-mode "long"))
-(defun turn (obj)
+(defun dun-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.")
+ (when (setq objnum (dun-objnum-from-args-std obj))
+ (if (not (or (member objnum (nth dun-current-room dun-room-objects))
+ (member objnum (nth dun-current-room dun-room-silents))))
+ (dun-mprincl "I don't see that here.")
(if (not (= objnum obj-dial))
- (mprincl "You can't turn that.")
- (setq direction (firstword (cdr obj)))
+ (dun-mprincl "You can't turn that.")
+ (setq direction (dun-firstword (cdr obj)))
(if (or (not direction)
(not (or (string= direction "clockwise")
(string= direction "counterclockwise"))))
- (mprincl "You must indicate clockwise or counterclockwise.")
+ (dun-mprincl "You must indicate clockwise or counterclockwise.")
(if (string= direction "clockwise")
- (setq sauna-level (+ sauna-level 1))
- (setq sauna-level (- sauna-level 1)))
+ (setq dun-sauna-level (+ dun-sauna-level 1))
+ (setq dun-sauna-level (- dun-sauna-level 1)))
- (if (< sauna-level 0)
+ (if (< dun-sauna-level 0)
(progn
- (mprincl
+ (dun-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)
+ (setq dun-sauna-level 0))
+ (dun-sauna-heat))))))))
+
+(defun dun-sauna-heat ()
+ (if (= dun-sauna-level 0)
+ (dun-mprincl
+ "The termperature has returned to normal room termperature."))
+ (if (= dun-sauna-level 1)
+ (dun-mprincl "It is now luke warm in here. You begin to sweat."))
+ (if (= dun-sauna-level 2)
+ (dun-mprincl "It is pretty hot in here. It is still very comfortable."))
+ (if (= dun-sauna-level 3)
(progn
- (mprincl
+ (dun-mprincl
"It is now very hot. There is something very refreshing about this.")
- (if (or (member obj-rms inventory)
- (member obj-rms (nth current-room room-objects)))
+ (if (or (member obj-rms dun-inventory)
+ (member obj-rms (nth dun-current-room dun-room-objects)))
(progn
- (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 inventory)
+ (if (member obj-rms dun-inventory)
(progn
- (remove-obj-from-inven obj-rms)
- (setq inventory (append inventory (list obj-diamond))))
- (remove-obj-from-room current-room obj-rms)
- (replace room-objects current-room
- (append (nth current-room room-objects)
+ (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 inventory)
- (member obj-floppy (nth current-room room-objects)))
+ (if (or (member obj-floppy dun-inventory)
+ (member obj-floppy (nth dun-current-room dun-room-objects)))
(progn
- (mprincl
+ (dun-mprincl
"You notice your floppy disk beginning to melt. As you grab for it, the
disk bursts into flames, and disintegrates.")
- (if (member obj-floppy inventory)
- (remove-obj-from-inven obj-floppy)
- (remove-obj-from-room current-room obj-floppy))))))
+ (if (member obj-floppy dun-inventory)
+ (dun-remove-obj-from-inven obj-floppy)
+ (dun-remove-obj-from-room dun-current-room obj-floppy))))))
- (if (= sauna-level 4)
+ (if (= dun-sauna-level 4)
(progn
- (mprincl
+ (dun-mprincl
"As the dial clicks into place, you immediately burst into flames.")
- (die "burning"))))
+ (dun-die "burning"))))
-(defun press (obj)
+(defun dun-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.")
+ (when (setq objnum (dun-objnum-from-args-std obj))
+ (if (not (or (member objnum (nth dun-current-room dun-room-objects))
+ (member objnum (nth dun-current-room dun-room-silents))))
+ (dun-mprincl "I don't see that here.")
(if (not (member objnum (list obj-button obj-switch)))
(progn
- (mprinc "You can't ")
- (mprinc (car line-list))
- (mprincl " that."))
+ (dun-mprinc "You can't ")
+ (dun-mprinc (car line-list))
+ (dun-mprincl " that."))
(if (= objnum obj-button)
- (mprincl
+ (dun-mprincl
"As you press the button, you notice a passageway open up, but
as you release it, the passageway closes."))
(if (= objnum obj-switch)
- (if black
+ (if dun-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 (list lakefront-north lakefront-south)))
- (mprincl "I see no water!")
- (if (not (member obj-life inventory))
+ (dun-mprincl "The button is now in the off position.")
+ (setq dun-black nil))
+ (dun-mprincl "The button is now in the on position.")
+ (setq dun-black t))))))))
+
+(defun dun-swim (args)
+ (if (not (member dun-current-room (list lakefront-north lakefront-south)))
+ (dun-mprincl "I see no water!")
+ (if (not (member obj-life dun-inventory))
(progn
- (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.")
- (die "drowning"))
- (if (= current-room lakefront-north)
- (setq current-room lakefront-south)
- (setq current-room lakefront-north)))))
+ (dun-die "drowning"))
+ (if (= dun-current-room lakefront-north)
+ (setq dun-current-room lakefront-south)
+ (setq dun-current-room lakefront-north)))))
-(defun score (args)
- (if (not endgame)
+(defun dun-score (args)
+ (if (not dun-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
+ (setq total (dun-reg-score))
+ (dun-mprinc "You have scored ")
+ (dun-mprinc total)
+ (dun-mprincl " out of a possible 90 points.") total)
+ (dun-mprinc "You have scored ")
+ (dun-mprinc (dun-endgame-score))
+ (dun-mprincl " endgame points out of a possible 110.")
+ (if (= (dun-endgame-score) 110)
+ (dun-mprincl
"\n\nCongratulations. You have won. The wizard password is 'moby'"))))
-(defun help (args)
- (mprincl
+(defun dun-help (args)
+ (dun-mprincl
"Welcome to dunnet (2.0), by Ron Schnell (ronnie@media.mit.edu).
Here is some useful information (read carefully because there are one
or more clues in here):
@@ -896,34 +908,35 @@ or more clues in here):
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:
- emacs -batch -l dunnet.el
+ emacs -batch -l dunnet
If you have questions or comments, please contact ronnie@media.mit.edu."))
-(defun flush (args)
- (if (not (= current-room bathroom))
- (mprincl "I see nothing to flush.")
- (mprincl "Whoooosh!!")
- (put-objs-in-treas (nth urinal room-objects))
- (replace room-objects urinal nil)))
-
-(defun piss (args)
- (if (not (= current-room bathroom))
- (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 urinal (append (nth urinal room-objects)
- (list obj-URINE))))))
-
-
-(defun dsleep (args)
- (if (not (= current-room bedroom))
- (mprincl
+(defun dun-flush (args)
+ (if (not (= dun-current-room bathroom))
+ (dun-mprincl "I see nothing to flush.")
+ (dun-mprincl "Whoooosh!!")
+ (dun-put-objs-in-treas (nth urinal dun-room-objects))
+ (dun-replace dun-room-objects urinal nil)))
+
+(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
+ (nth urinal dun-room-objects)
+ (list obj-URINE))))))
+
+
+(defun dun-sleep (args)
+ (if (not (= dun-current-room bedroom))
+ (dun-mprincl
"You try to go to sleep while standing up here, but can't seem to do it.")
- (setq gottago t)
- (mprincl
+ (setq dun-gottago t)
+ (dun-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
@@ -932,130 +945,130 @@ 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)
+(defun dun-break (obj)
(let (objnum)
- (if (not (member obj-axe inventory))
- (mprincl "You have nothing you can use to break things.")
- (when (setq objnum (objnum-from-args-std obj))
- (if (member objnum inventory)
+ (if (not (member obj-axe dun-inventory))
+ (dun-mprincl "You have nothing you can use to break things.")
+ (when (setq objnum (dun-objnum-from-args-std obj))
+ (if (member objnum dun-inventory)
(progn
- (mprincl
+ (dun-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.")
+ (dun-die "an axe"))
+ (if (not (or (member objnum (nth dun-current-room dun-room-objects))
+ (member objnum
+ (nth dun-current-room dun-room-silents))))
+ (dun-mprincl "I don't see that here.")
(if (= objnum obj-cable)
(progn
- (mprincl
+ (dun-mprincl
"As you break the ethernet cable, everything starts to blur. You collapse
for a moment, then straighten yourself up.
")
- (replace room-objects gamma-computing-center
- (append (nth gamma-computing-center room-objects)
- inventory))
- (if (member obj-key inventory)
+ (dun-replace dun-room-objects gamma-computing-center
+ (append
+ (nth gamma-computing-center dun-room-objects)
+ dun-inventory))
+ (if (member obj-key dun-inventory)
(progn
- (setq inventory (list obj-key))
- (remove-obj-from-room gamma-computing-center obj-key))
- (setq inventory nil))
- (setq current-room computer-room)
- (setq ethernet nil)
- (mprincl "Connection closed.")
- (unix-interface))
+ (setq dun-inventory (list obj-key))
+ (dun-remove-obj-from-room
+ gamma-computing-center obj-key))
+ (setq dun-inventory nil))
+ (setq dun-current-room computer-room)
+ (setq dun-ethernet nil)
+ (dun-mprincl "Connection closed.")
+ (dun-unix-interface))
(if (< objnum 0)
(progn
- (mprincl "Your axe shatters into a million pieces.")
- (remove-obj-from-inven obj-axe))
- (mprincl "Your axe breaks it into a million pieces.")
- (remove-obj-from-room current-room objnum)))))))))
+ (dun-mprincl "Your axe shatters into a million pieces.")
+ (dun-remove-obj-from-inven obj-axe))
+ (dun-mprincl "Your axe breaks it into a million pieces.")
+ (dun-remove-obj-from-room dun-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 dun-drive (args)
+ (if (not dun-inbus)
+ (dun-mprincl "You cannot drive when you aren't in a vehicle.")
+ (dun-mprincl "To drive while you are in the bus, just give a direction.")))
-(defun superb (args)
- (setq mode 'superb))
+(defun dun-superb (args)
+ (setq dun-mode 'dun-superb))
-(defun reg-score ()
+(defun dun-reg-score ()
(let (total)
(setq total 0)
- (dolist (x (nth treasure-room room-objects))
- (setq total (+ total (nth x object-pts))))
- (if (member obj-URINE (nth treasure-room room-objects))
+ (dolist (x (nth treasure-room dun-room-objects))
+ (setq total (+ total (nth x dun-object-pts))))
+ (if (member obj-URINE (nth treasure-room dun-room-objects))
(setq total 0)) total))
-(defun endgame-score ()
+(defun dun-endgame-score ()
(let (total)
(setq total 0)
- (dolist (x (nth endgame-treasure-room room-objects))
- (setq total (+ total (nth x object-pts)))) total))
+ (dolist (x (nth endgame-treasure-room dun-room-objects))
+ (setq total (+ total (nth x dun-object-pts)))) total))
-(defun answer (args)
- (if (not correct-answer)
- (mprincl "I don't believe anyone asked you anything.")
+(defun dun-answer (args)
+ (if (not dun-correct-answer)
+ (dun-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)
+ (dun-mprincl "You must give the answer on the same line.")
+ (if (dun-members args dun-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)
+ (dun-mprincl "Correct.")
+ (if (= dun-lastdir 0)
+ (setq dun-current-room (1+ dun-current-room))
+ (setq dun-current-room (- dun-current-room 1)))
+ (setq dun-correct-answer nil))
+ (dun-mprincl "That answer is incorrect.")))))
+
+(defun dun-endgame-question ()
+(if (not dun-endgame-questions)
(progn
- (mprincl "Your question is:")
- (mprincl "No more questions, just do 'answer foo'.")
- (setq correct-answer '("foo")))
+ (dun-mprincl "Your question is:")
+ (dun-mprincl "No more questions, just do 'answer foo'.")
+ (setq dun-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)))
+ (setq which (% (abs (random)) (length dun-endgame-questions)))
+ (dun-mprincl "Your question is:")
+ (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)
- (setq newques (append newques (list (nth i endgame-questions))))
+ (setq newques (append newques (list (nth i dun-endgame-questions))))
(setq i (1+ i)))
(setq i (1+ which))
- (while (< i (length endgame-questions))
- (setq newques (append newques (list (nth i endgame-questions))))
+ (while (< i (length dun-endgame-questions))
+ (setq newques (append newques (list (nth i dun-endgame-questions))))
(setq i (1+ i)))
- (setq endgame-questions newques))))
+ (setq dun-endgame-questions newques))))
(defun dun-power (args)
- (if (not (= current-room pc-area))
- (mprincl "That operation is not applicable here.")
- (if (not floppy)
- (dos-no-disk)
- (dos-interface))))
-
-(defun touka (args)
- (setq current-room computer-room)
- (setq logged-in t)
- (setq computer t))
+ (if (not (= dun-current-room pc-area))
+ (dun-mprincl "That operation is not applicable here.")
+ (if (not dun-floppy)
+ (dun-dos-no-disk)
+ (dun-dos-interface))))
(defun dun-feed (args)
(let (objnum)
- (when (setq objnum (objnum-from-args-std args))
+ (when (setq objnum (dun-objnum-from-args-std args))
(if (and (= objnum obj-bear)
- (member obj-bear (nth current-room room-objects)))
+ (member obj-bear (nth dun-current-room dun-room-objects)))
(progn
- (if (not (member obj-food inventory))
- (mprincl "You have nothing with which to feed it.")
- (drop '("food"))))
- (if (not (or (member objnum (nth current-room room-objects))
- (member objnum inventory)
- (member objnum (nth current-room room-silents))))
- (mprincl "I don't see that here.")
- (mprincl "You cannot feed that."))))))
+ (if (not (member obj-food dun-inventory))
+ (dun-mprincl "You have nothing with which to feed it.")
+ (dun-drop '("food"))))
+ (if (not (or (member objnum (nth dun-current-room dun-room-objects))
+ (member objnum dun-inventory)
+ (member objnum (nth dun-current-room dun-room-silents))))
+ (dun-mprincl "I don't see that here.")
+ (dun-mprincl "You cannot feed that."))))))
;;;;
@@ -1067,20 +1080,20 @@ for a moment, then straighten yourself up.
;;; Function which takes a verb and a list of other words. Calls proper
;;; function associated with the verb, and passes along the other words.
-(defun doverb (ignore verblist verb rest)
+(defun dun-doverb (dun-ignore dun-verblist verb rest)
(if (not verb)
nil
- (if (member (intern verb) ignore)
+ (if (member (intern verb) dun-ignore)
(if (not (car rest)) -1
- (doverb ignore verblist (car rest) (cdr rest)))
- (if (not (cdr (assq (intern verb) verblist))) -1
- (setq numcmds (1+ numcmds))
- (eval (list (cdr (assq (intern verb) verblist)) (quote rest)))))))
+ (dun-doverb dun-ignore dun-verblist (car rest) (cdr rest)))
+ (if (not (cdr (assq (intern verb) dun-verblist))) -1
+ (setq dun-numcmds (1+ dun-numcmds))
+ (eval (list (cdr (assq (intern verb) dun-verblist)) (quote rest)))))))
;;; Function to take a string and change it into a list of lowercase words.
-(defun listify-string (strin)
+(defun dun-listify-string (strin)
(let (pos ret-list end-pos)
(setq pos 0)
(setq ret-list nil)
@@ -1092,7 +1105,7 @@ for a moment, then straighten yourself up.
(substring strin pos end-pos))))))
(setq pos (+ end-pos 1))) ret-list))
-(defun listify-string2 (strin)
+(defun dun-listify-string2 (strin)
(let (pos ret-list end-pos)
(setq pos 0)
(setq ret-list nil)
@@ -1104,56 +1117,56 @@ for a moment, then straighten yourself up.
(substring strin pos end-pos))))))
(setq pos (+ end-pos 1))) ret-list))
-(defun replace (list n number)
+(defun dun-replace (list n number)
(rplaca (nthcdr n list) number))
;;; Get the first non-ignored word from a list.
-(defun firstword (list)
+(defun dun-firstword (list)
(if (not (car list))
nil
- (while (and list (member (intern (car list)) ignore))
+ (while (and list (member (intern (car list)) dun-ignore))
(setq list (cdr list)))
(car list)))
-(defun firstwordl (list)
+(defun dun-firstwordl (list)
(if (not (car list))
nil
- (while (and list (member (intern (car list)) ignore))
+ (while (and list (member (intern (car list)) dun-ignore))
(setq list (cdr list)))
list))
;;; parse a line passed in as a string Call the proper verb with the
;;; rest of the line passed in as a list.
-(defun parse (ignore verblist line)
- (mprinc "\n")
- (setq line-list (listify-string (concat line " ")))
- (doverb ignore verblist (car line-list) (cdr line-list)))
+(defun dun-vparse (dun-ignore dun-verblist line)
+ (dun-mprinc "\n")
+ (setq line-list (dun-listify-string (concat line " ")))
+ (dun-doverb dun-ignore dun-verblist (car line-list) (cdr line-list)))
-(defun parse2 (ignore verblist line)
- (mprinc "\n")
- (setq line-list (listify-string2 (concat line " ")))
- (doverb ignore verblist (car line-list) (cdr line-list)))
+(defun dun-parse2 (dun-ignore dun-verblist line)
+ (dun-mprinc "\n")
+ (setq line-list (dun-listify-string2 (concat line " ")))
+ (dun-doverb dun-ignore dun-verblist (car line-list) (cdr line-list)))
;;; Read a line, in window mode
-(defun read-line ()
+(defun dun-read-line ()
(let (line)
(setq line (read-string ""))
- (mprinc line) line))
+ (dun-mprinc line) line))
;;; Insert something into the window buffer
-(defun minsert (string)
+(defun dun-minsert (string)
(if (stringp string)
(insert string)
(insert (prin1-to-string string))))
;;; Print something out, in window mode
-(defun mprinc (string)
+(defun dun-mprinc (string)
(if (stringp string)
(insert string)
(insert (prin1-to-string string))))
@@ -1161,7 +1174,7 @@ for a moment, then straighten yourself up.
;;; In window mode, keep screen from jumping by keeping last line at
;;; the bottom of the screen.
-(defun fix-screen ()
+(defun dun-fix-screen ()
(interactive)
(forward-line (- 0 (- (window-height) 2 )))
(set-window-start (selected-window) (point))
@@ -1169,65 +1182,65 @@ for a moment, then straighten yourself up.
;;; Insert something into the buffer, followed by newline.
-(defun minsertl (string)
- (minsert string)
- (minsert "\n"))
+(defun dun-minsertl (string)
+ (dun-minsert string)
+ (dun-minsert "\n"))
;;; Print something, followed by a newline.
-(defun mprincl (string)
- (mprinc string)
- (mprinc "\n"))
+(defun dun-mprincl (string)
+ (dun-mprinc string)
+ (dun-mprinc "\n"))
;;; Function which will get an object number given the list of
;;; words in the command, except for the verb.
-(defun objnum-from-args (obj)
+(defun dun-objnum-from-args (obj)
(let (objnum)
- (setq obj (firstword obj))
+ (setq obj (dun-firstword obj))
(if (not obj)
obj-special
- (setq objnum (cdr (assq (intern obj) objnames))))))
+ (setq objnum (cdr (assq (intern obj) dun-objnames))))))
-(defun objnum-from-args-std (obj)
+(defun dun-objnum-from-args-std (obj)
(let (result)
- (if (eq (setq result (objnum-from-args obj)) obj-special)
- (mprincl "You must supply an object."))
+ (if (eq (setq result (dun-objnum-from-args obj)) obj-special)
+ (dun-mprincl "You must supply an object."))
(if (eq result nil)
- (mprincl "I don't know what that is."))
+ (dun-mprincl "I don't know what that is."))
(if (eq result obj-special)
nil
result)))
;;; Take a short room description, and change spaces and slashes to dashes.
-(defun space-to-hyphen (string)
+(defun dun-space-to-hyphen (string)
(let (space)
(if (setq space (string-match "[ /]" string))
(progn
(setq string (concat (substring string 0 space) "-"
(substring string (1+ space))))
- (space-to-hyphen string))
+ (dun-space-to-hyphen string))
string)))
;;; Given a unix style pathname, build a list of path components (recursive)
-(defun get-path (dirstring startlist)
+(defun dun-get-path (dirstring startlist)
(let (slash pos)
(if (= (length dirstring) 0)
startlist
(if (string= (substring dirstring 0 1) "/")
- (get-path (substring dirstring 1) (append startlist (list "/")))
+ (dun-get-path (substring dirstring 1) (append startlist (list "/")))
(if (not (setq slash (string-match "/" dirstring)))
(append startlist (list dirstring))
- (get-path (substring dirstring (1+ slash))
+ (dun-get-path (substring dirstring (1+ slash))
(append startlist
(list (substring dirstring 0 slash)))))))))
;;; Is a string a member of a string list?
-(defun members (string string-list)
+(defun dun-members (string string-list)
(let (found)
(setq found nil)
(dolist (x string-list)
@@ -1237,17 +1250,17 @@ for a moment, then straighten yourself up.
;;; Function to put objects in the treasure room. Also prints current
;;; score to let user know he has scored.
-(defun put-objs-in-treas (objlist)
+(defun dun-put-objs-in-treas (objlist)
(let (oscore newscore)
- (setq oscore (reg-score))
- (replace room-objects 0 (append (nth 0 room-objects) objlist))
- (setq newscore (reg-score))
+ (setq oscore (dun-reg-score))
+ (dun-replace dun-room-objects 0 (append (nth 0 dun-room-objects) objlist))
+ (setq newscore (dun-reg-score))
(if (not (= oscore newscore))
- (score nil))))
+ (dun-score nil))))
;;; Load an encrypted file, and eval it.
-(defun load-d (filename)
+(defun dun-load-d (filename)
(let (old-buffer result)
(setq result t)
(setq old-buffer (current-buffer))
@@ -1265,59 +1278,36 @@ for a moment, then straighten yourself up.
(switch-to-buffer old-buffer))
result))
-;;; Rotate the globals file, and save it for later loading.
-
-(defun compile-globals ()
- (let
- (switch-to-buffer (get-buffer-create "*compd*"))
- (erase-buffer)
- (insert-file-contents "dun-globals.el")
- (dun-rot13)
- (goto-char (point-min))
- (write-region 1 (point-max) "dun-globals.dat")
- (kill-buffer (current-buffer))))
-
;;; Functions to remove an object either from a room, or from inventory.
-(defun remove-obj-from-room (room objnum)
+(defun dun-remove-obj-from-room (room objnum)
(let (newroom)
(setq newroom nil)
- (dolist (x (nth room room-objects))
+ (dolist (x (nth room dun-room-objects))
(if (not (= x objnum))
(setq newroom (append newroom (list x)))))
- (rplaca (nthcdr room room-objects) newroom)))
+ (rplaca (nthcdr room dun-room-objects) newroom)))
-(defun remove-obj-from-inven (objnum)
+(defun dun-remove-obj-from-inven (objnum)
(let (new-inven)
(setq new-inven nil)
- (dolist (x inventory)
+ (dolist (x dun-inventory)
(if (not (= x objnum))
(setq new-inven (append new-inven (list x)))))
- (setq inventory new-inven)))
+ (setq dun-inventory new-inven)))
-;;; Find the global data file.
-
-(defun get-glob-dat ()
- (let (result)
- (setq result nil)
- (dolist (x load-path)
- (if (file-exists-p (concat x "/dun-globals.dat"))
- (setq result (concat x "/dun-globals.dat"))))
- result))
-
-;;; rotate current buffer 13 characters
(let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper)
- (setq translate-table (make-vector 256 0))
+ (setq dun-translate-table (make-vector 256 0))
(while (< i 256)
- (aset translate-table i i)
+ (aset dun-translate-table i i)
(setq i (1+ i)))
(setq lower (concat lower lower))
(setq upper (upcase lower))
(setq i 0)
(while (< i 26)
- (aset translate-table (+ ?a i) (aref lower (+ i 13)))
- (aset translate-table (+ ?A i) (aref upper (+ i 13)))
+ (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 ()
@@ -1325,7 +1315,7 @@ for a moment, then straighten yourself up.
(setq str (buffer-substring (point-min) (point-max)))
(setq len (length str))
(while (< i len)
- (aset str i (aref translate-table (aref str i)))
+ (aset str i (aref dun-translate-table (aref str i)))
(setq i (1+ i)))
(erase-buffer)
(insert str)))
@@ -1337,13 +1327,13 @@ for a moment, then straighten yourself up.
;;;; All globals which can change must be saved from 'save-game. Add
;;;; all new globals to bottom of file.
-(setq visited '(27))
-(setq current-room 1)
-(setq exitf nil)
-(setq badcd nil)
+(setq dun-visited '(27))
+(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" 'dungeon-parse)
+(define-key dungeon-mode-map "\r" 'dun-parse)
(defvar dungeon-batch-map (make-keymap))
(if (string= (substring emacs-version 0 2) "18")
(let (n)
@@ -1356,43 +1346,47 @@ for a moment, then straighten yourself up.
(aset (car (cdr dungeon-batch-map)) n 'dungeon-nil))))
(define-key dungeon-batch-map "\r" 'exit-minibuffer)
(define-key dungeon-batch-map "\n" 'exit-minibuffer)
-(setq computer nil)
-(setq floppy nil)
-(setq door1 'locked)
-(setq key-level 0)
-(setq hole nil)
-(setq correct-answer nil)
-(setq lastdir 0)
-(setq numsaves 0)
-(setq jar nil)
-(setq numcmds 0)
-(setq wizard nil)
-(setq endgame-question nil)
-(setq logged-in nil)
+(setq dun-computer nil)
+(setq dun-floppy nil)
+(setq dun-key-level 0)
+(setq dun-hole nil)
+(setq dun-correct-answer nil)
+(setq dun-lastdir 0)
+(setq dun-numsaves 0)
+(setq dun-jar nil)
+(setq dun-dead nil)
+(setq room 0)
+(setq dun-numcmds 0)
+(setq dun-wizard nil)
+(setq dun-endgame-question nil)
+(setq dun-logged-in nil)
(setq dungeon-mode 'dungeon)
-(setq unix-verbs '((ls . ls) (ftp . ftp) (echo . echo) (exit . uexit)
- (cd . dunnet-cd) (pwd . dunnet-pwd) (rlogin . rlogin)
- (uncompress . uncompress) (cat . cat) (zippy . zippy)))
+(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 dos-verbs '((dir . dos-dir) (type . dos-type) (exit . dos-exit)
- (command . dos-spawn) (b: . dos-invd) (c: . dos-invd)
- (a: . dos-nil)))
+(setq dun-dos-verbs '((dir . dun-dos-dir) (type . dun-dos-type)
+ (exit . dun-dos-exit) (command . dun-dos-spawn)
+ (b: . dun-dos-invd) (c: . dun-dos-invd)
+ (a: . dun-dos-nil)))
-(setq batch-mode nil)
+(setq dun-batch-mode nil)
-(setq cdpath "/usr/toukmond")
-(setq cdroom -10)
-(setq uncompressed nil)
-(setq ethernet t)
-(setq restricted '(room-objects dungeon-map rooms room-silents combination))
-(setq path "/usr/toukmond")
-(setq ftptype 'ascii)
-(setq endgame nil)
-(setq gottago t)
-(setq black nil)
+(setq dun-cdpath "/usr/toukmond")
+(setq dun-cdroom -10)
+(setq dun-uncompressed nil)
+(setq dun-ethernet t)
+(setq dun-restricted
+ '(dun-room-objects dungeon-map dun-rooms
+ dun-room-silents dun-combination))
+(setq dun-ftptype 'ascii)
+(setq dun-endgame nil)
+(setq dun-gottago t)
+(setq dun-black nil)
-(setq rooms '(
+(setq dun-rooms '(
(
"You are in the treasure room. A door leads out to the north."
"Treasure room"
@@ -1901,36 +1895,44 @@ A hole leads north."
)
))
-(setq light-rooms '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 24 25 26 27 28 58 59
+(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 verblist '((die . die) (ne . ne) (north . n) (south . s) (east . e)
- (west . w) (u . up) (d . down) (i . inven)
- (inventory . inven) (look . examine) (n . n) (s . s) (e . e)
- (w . w) (se . se) (nw . nw) (sw . sw) (up . up)
- (down . down) (in . in) (out . out) (go . go) (drop . drop)
- (southeast . se) (southwest . sw) (northeast . ne)
- (northwest . nw) (save . save-game) (restore . restore)
- (long . long) (dig . dig) (shake . shake) (wave . shake)
- (examine . examine) (describe . examine) (climb . climb)
- (eat . eat) (put . dput) (type . type) (insert . dput)
- (score . score) (help . help) (quit . quit) (read . examine)
- (verbose . long) (urinate . piss) (piss . piss)
- (flush . flush) (sleep . dsleep) (lie . dsleep) (x . examine)
- (break . break) (drive . drive) (board . in) (enter . in)
- (turn . turn) (press . press) (push . press) (swim . swim)
- (on . in) (off . out) (chop . break) (switch . press)
- (cut . break) (exit . out) (leave . out) (reset . dun-power)
- (flick . press) (superb . superb) (answer . answer)
- (throw . drop) (l . examine) (take . take) (get . take)
- (feed . dun-feed)))
-
-(setq inbus nil)
-(setq nomail nil)
-(setq ignore '(the to at))
-(setq mode 'moby)
-(setq sauna-level 0)
+(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)
+ (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)
+ (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-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)
+ (on . dun-in) (off . dun-out) (chop . dun-break)
+ (switch . dun-press) (cut . dun-break) (exit . dun-out)
+ (leave . dun-out) (reset . dun-power) (flick . dun-press)
+ (superb . dun-superb) (answer . dun-answer)
+ (throw . dun-drop) (l . dun-examine) (take . dun-take)
+ (get . dun-take) (feed . dun-feed)))
+
+(setq dun-inbus nil)
+(setq dun-nomail nil)
+(setq dun-ignore '(the to at))
+(setq dun-mode 'moby)
+(setq dun-sauna-level 0)
(defconst north 0)
(defconst south 1)
@@ -2058,7 +2060,7 @@ A hole leads north."
;;; How the user references *all* objects, permanent and regular.
-(setq objnames '(
+(setq dun-objnames '(
(shovel . 0)
(lamp . 1)
(cpu . 2) (board . 2) (card . 2)
@@ -2119,7 +2121,7 @@ A hole leads north."
(pc . -29) (drive . -29)
))
-(dolist (x objnames)
+(dolist (x dun-objnames)
(let (name)
(setq name (concat "obj-" (prin1-to-string (car x))))
(eval (list 'defconst (intern name) (cdr x)))))
@@ -2131,9 +2133,9 @@ A hole leads north."
;;; 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 'describe-room.
+;;; handled specially by 'dun-describe-room.
-(setq room-objects (list nil
+(setq dun-room-objects (list nil
(list obj-shovel) ;; treasure-room
(list obj-boulder) ;; dead-end
@@ -2190,7 +2192,7 @@ nil))
;;; These are objects in a room that are only described in the
;;; room description. They are permanent.
-(setq room-silents (list nil
+(setq dun-room-silents (list nil
(list obj-tree) ;; dead-end
(list obj-tree) ;; e-w-dirt-road
nil nil nil nil nil nil
@@ -2231,12 +2233,12 @@ nil))
(list obj-pc) ;; pc-area
nil nil nil nil nil nil
))
-(setq inventory '(1))
+(setq dun-inventory '(1))
;;; Descriptions of objects, as they appear in the room description, and
;;; the inventory.
-(setq objects '(
+(setq dun-objects '(
("There is a shovel here." "A shovel") ;0
("There is a lamp nearby." "A lamp") ;1
("There is a CPU card here." "A computer board") ;2
@@ -2271,12 +2273,14 @@ nil))
;;; Weight of objects
-(setq 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 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))
+(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
+ '(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))
;;; Unix representation of objects.
-(setq objfiles '(
+(setq dun-objfiles '(
"shovel.o" "lamp.o" "cpu.o" "food.o" "key.o" "paper.o"
"rms.o" "diamond.o" "weight.o" "preserver.o" "bracelet.o"
"gold.o" "platinum.o" "towel.o" "axe.o" "silver.o" "license.o"
@@ -2285,9 +2289,9 @@ nil))
))
;;; These are the descriptions for the negative numbered objects from
-;;; room-objects
+;;; dun-room-objects
-(setq perm-objects '(
+(setq dun-perm-objects '(
nil
("There is a large boulder here.")
nil
@@ -2318,7 +2322,7 @@ nil))
;;; These are the descriptions the user gets when regular objects are
;;; examined.
-(setq physobj-desc '(
+(setq dun-physobj-desc '(
"It is a normal shovel with a price tag attached that says $19.99."
"The lamp is hand-crafted by Geppetto."
"The CPU board has a VAX chip on it. It seems to have
@@ -2353,7 +2357,7 @@ nil
;;; These are the descriptions the user gets when non-regular objects
;;; are examined.
-(setq permobj-desc '(
+(setq dun-permobj-desc '(
nil
"It is just a boulder. It cannot be moved."
"They are palm trees with a bountiful supply of coconuts in them."
@@ -2401,20 +2405,23 @@ nil
)
)
-(setq diggables (list nil nil nil (list obj-cpu) nil nil nil nil nil nil nil
+(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 room-shorts nil)
-(dolist (x rooms)
- (setq room-shorts
- (append room-shorts (list (downcase (space-to-hyphen
- (cadr x)))))))
-(setq endgame-questions '(
+(setq dun-room-shorts nil)
+(dolist (x dun-rooms)
+ (setq dun-room-shorts
+ (append dun-room-shorts (list (downcase
+ (dun-space-to-hyphen
+ (cadr x)))))))
+
+(setq dun-endgame-questions '(
(
"What is your password on the machine called 'pokey'?" "robert")
(
@@ -2458,7 +2465,7 @@ treasures for points?" "4" "four")
(let (a)
(setq a 0)
- (dolist (x room-shorts)
+ (dolist (x dun-room-shorts)
(eval (list 'defconst (intern x) a))
(setq a (+ a 1))))
@@ -2468,7 +2475,7 @@ treasures for points?" "4" "four")
;;;; This section defines the UNIX emulation functions for dunnet.
;;;;
-(defun unix-parse (args)
+(defun dun-unix-parse (args)
(interactive "*p")
(beginning-of-line)
(let (beg esign)
@@ -2479,31 +2486,31 @@ treasures for points?" "4" "four")
(progn
(setq line (downcase (buffer-substring beg (point))))
(princ line)
- (if (eq (parse2 nil unix-verbs line) -1)
+ (if (eq (dun-parse2 nil dun-unix-verbs line) -1)
(progn
(if (setq esign (string-match "=" line))
- (doassign line esign)
- (mprinc (car line-list))
- (mprincl ": not found.")))))
+ (dun-doassign line esign)
+ (dun-mprinc (car line-list))
+ (dun-mprincl ": not found.")))))
(goto-char (point-max))
- (mprinc "\n"))
+ (dun-mprinc "\n"))
(if (eq dungeon-mode 'unix)
(progn
- (fix-screen)
- (mprinc "$ ")))))
+ (dun-fix-screen)
+ (dun-mprinc "$ ")))))
-(defun doassign (line esign)
- (if (not wizard)
+(defun dun-doassign (line esign)
+ (if (not dun-wizard)
(let (passwd)
- (mprinc "Enter wizard password: ")
- (setq passwd (read-line))
- (if (not batch-mode)
- (mprinc "\n"))
+ (dun-mprinc "Enter wizard password: ")
+ (setq passwd (dun-read-line))
+ (if (not dun-batch-mode)
+ (dun-mprinc "\n"))
(if (string= passwd "moby")
(progn
- (setq wizard t)
- (doassign line esign))
- (mprincl "Incorrect.")))
+ (setq dun-wizard t)
+ (dun-doassign line esign))
+ (dun-mprincl "Incorrect.")))
(let (varname epoint afterq i value)
(setq varname (substring line 0 esign))
@@ -2524,9 +2531,9 @@ treasures for points?" "4" "four")
(setq i (string-match ")" (substring line epoint))))
(setq epoint (+ epoint i 1))))
(setq value (substring line (1+ esign) epoint))
- (dungeon-eval varname value))))
+ (dun-eval varname value))))
-(defun dungeon-eval (varname value)
+(defun dun-eval (varname value)
(let (eval-error)
(switch-to-buffer (get-buffer-create "*dungeon-eval*"))
(erase-buffer)
@@ -2542,36 +2549,34 @@ treasures for points?" "4" "four")
(kill-buffer (current-buffer))
(switch-to-buffer "*dungeon*")
(if eval-error
- (mprincl "Invalid syntax."))))
+ (dun-mprincl "Invalid syntax."))))
-(defun unix-interface ()
- (login)
- (if logged-in
+(defun dun-unix-interface ()
+ (dun-login)
+ (if dun-logged-in
(progn
(setq dungeon-mode 'unix)
- (define-key dungeon-mode-map "\r" 'unix-parse)
- (mprinc "$ "))))
+ (define-key dungeon-mode-map "\r" 'dun-unix-parse)
+ (dun-mprinc "$ "))))
-
-
-(defun login ()
+(defun dun-login ()
(let (tries username password)
(setq tries 4)
- (while (and (not logged-in) (> (setq tries (- tries 1)) 0))
- (mprinc "\n\nUNIX System V, Release 2.2 (pokey)\n\nlogin: ")
- (setq username (read-line))
- (if (not batch-mode)
- (mprinc "\n"))
- (mprinc "password: ")
- (setq password (read-line))
- (if (not batch-mode)
- (mprinc "\n"))
+ (while (and (not dun-logged-in) (> (setq tries (- tries 1)) 0))
+ (dun-mprinc "\n\nUNIX System V, Release 2.2 (pokey)\n\nlogin: ")
+ (setq username (dun-read-line))
+ (if (not dun-batch-mode)
+ (dun-mprinc "\n"))
+ (dun-mprinc "password: ")
+ (setq password (dun-read-line))
+ (if (not dun-batch-mode)
+ (dun-mprinc "\n"))
(if (or (not (string= username "toukmond"))
(not (string= password "robert")))
- (mprincl "login incorrect")
- (setq logged-in t)
- (mprincl "
+ (dun-mprincl "login incorrect")
+ (setq dun-logged-in t)
+ (dun-mprincl "
Welcome to Unix\n
Please clean up your directories. The filesystem is getting full.
Our tcp/ip link to gamma is a little flakey, but seems to work.
@@ -2581,79 +2586,79 @@ directory, and deletes them after they are sent! Be careful.
Note: Restricted bourne shell in use.\n")))
(setq dungeon-mode 'dungeon)))
-(defun ls (args)
+(defun dun-ls (args)
(if (car args)
(let (ocdpath ocdroom)
- (setq ocdpath cdpath)
- (setq ocdroom cdroom)
- (if (not (eq (dunnet-cd args) -2))
- (ls nil))
- (setq cdpath ocdpath)
- (setq cdroom ocdroom))
- (if (= cdroom -10)
- (ls-inven))
- (if (= cdroom -2)
- (ls-rooms))
- (if (= cdroom -3)
- (ls-root))
- (if (= cdroom -4)
- (ls-usr))
- (if (> cdroom 0)
- (ls-room))))
-
-(defun ls-root ()
- (mprincl "total 4
+ (setq ocdpath dun-cdpath)
+ (setq ocdroom dun-cdroom)
+ (if (not (eq (dun-cd args) -2))
+ (dun-ls nil))
+ (setq dun-cdpath ocdpath)
+ (setq dun-cdroom ocdroom))
+ (if (= dun-cdroom -10)
+ (dun-ls-inven))
+ (if (= dun-cdroom -2)
+ (dun-ls-rooms))
+ (if (= dun-cdroom -3)
+ (dun-ls-root))
+ (if (= dun-cdroom -4)
+ (dun-ls-usr))
+ (if (> dun-cdroom 0)
+ (dun-ls-room))))
+
+(defun dun-ls-root ()
+ (dun-mprincl "total 4
drwxr-xr-x 3 root staff 512 Jan 1 1970 .
drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..
drwxr-xr-x 3 root staff 2048 Jan 1 1970 usr
drwxr-xr-x 3 root staff 2048 Jan 1 1970 rooms"))
-(defun ls-usr ()
- (mprincl "total 4
+(defun dun-ls-usr ()
+ (dun-mprincl "total 4
drwxr-xr-x 3 root staff 512 Jan 1 1970 .
drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..
drwxr-xr-x 3 toukmond restricted 512 Jan 1 1970 toukmond"))
-(defun ls-rooms ()
- (mprincl "total 16
+(defun dun-ls-rooms ()
+ (dun-mprincl "total 16
drwxr-xr-x 3 root staff 512 Jan 1 1970 .
drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
- (dolist (x visited)
- (mprinc
+ (dolist (x dun-visited)
+ (dun-mprinc
"drwxr-xr-x 3 root staff 512 Jan 1 1970 ")
- (mprincl (nth x room-shorts))))
+ (dun-mprincl (nth x dun-room-shorts))))
-(defun ls-room ()
- (mprincl "total 4
+(defun dun-ls-room ()
+ (dun-mprincl "total 4
drwxr-xr-x 3 root staff 512 Jan 1 1970 .
drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..
-rwxr-xr-x 3 root staff 2048 Jan 1 1970 description")
- (dolist (x (nth cdroom room-objects))
+ (dolist (x (nth dun-cdroom dun-room-objects))
(if (and (>= x 0) (not (= x 255)))
(progn
- (mprinc "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ")
- (mprincl (nth x objfiles))))))
+ (dun-mprinc "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ")
+ (dun-mprincl (nth x dun-objfiles))))))
-(defun ls-inven ()
- (mprinc "total 467
+(defun dun-ls-inven ()
+ (dun-mprinc "total 467
drwxr-xr-x 3 toukmond restricted 512 Jan 1 1970 .
drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
- (dolist (x unix-verbs)
+ (dolist (x dun-unix-verbs)
(if (not (eq (car x) 'IMPOSSIBLE))
(progn
- (mprinc"
+ (dun-mprinc"
-rwxr-xr-x 1 toukmond restricted 10423 Jan 1 1970 ")
- (mprinc (car x)))))
- (mprinc "\n")
- (if (not uncompressed)
- (mprincl
+ (dun-mprinc (car x)))))
+ (dun-mprinc "\n")
+ (if (not dun-uncompressed)
+ (dun-mprincl
"-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 paper.o.Z"))
- (dolist (x inventory)
- (mprinc
+ (dolist (x dun-inventory)
+ (dun-mprinc
"-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ")
- (mprincl (nth x objfiles))))
+ (dun-mprincl (nth x dun-objfiles))))
-(defun echo (args)
+(defun dun-echo (args)
(let (nomore var)
(setq nomore nil)
(dolist (x args)
@@ -2661,105 +2666,107 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
(progn
(if (not (string= (substring x 0 1) "$"))
(progn
- (mprinc x)
- (mprinc " "))
+ (dun-mprinc x)
+ (dun-mprinc " "))
(setq var (intern (substring x 1)))
(if (not (boundp var))
- (mprinc " ")
- (if (member var restricted)
+ (dun-mprinc " ")
+ (if (member var dun-restricted)
(progn
- (mprinc var)
- (mprinc ": Permission denied")
+ (dun-mprinc var)
+ (dun-mprinc ": Permission denied")
(setq nomore t))
- (eval (list 'mprinc var))
- (mprinc " ")))))))
- (mprinc "\n")))
+ (eval (list 'dun-mprinc var))
+ (dun-mprinc " ")))))))
+ (dun-mprinc "\n")))
-(defun ftp (args)
+(defun dun-ftp (args)
(let (host username passwd ident newlist)
(if (not (car args))
- (mprincl "ftp: hostname required on command line.")
+ (dun-mprincl "ftp: hostname required on command line.")
(setq host (intern (car args)))
- (if (not (member host '(gamma endgame)))
- (mprincl "ftp: Unknown host.")
- (if (eq host 'endgame)
- (mprincl "ftp: connection to endgame not allowed")
- (if (not ethernet)
- (mprincl "ftp: host not responding.")
- (mprincl "Connected to gamma. FTP ver 0.9 00:00:00 01/01/70")
- (mprinc "Username: ")
- (setq username (read-line))
+ (if (not (member host '(gamma dun-endgame)))
+ (dun-mprincl "ftp: Unknown host.")
+ (if (eq host 'dun-endgame)
+ (dun-mprincl "ftp: connection to endgame not allowed")
+ (if (not dun-ethernet)
+ (dun-mprincl "ftp: host not responding.")
+ (dun-mprincl "Connected to gamma. FTP ver 0.9 00:00:00 01/01/70")
+ (dun-mprinc "Username: ")
+ (setq username (dun-read-line))
(if (string= username "toukmond")
- (if batch-mode
- (mprincl "toukmond ftp access not allowed.")
- (mprincl "\ntoukmond ftp access not allowed."))
+ (if dun-batch-mode
+ (dun-mprincl "toukmond ftp access not allowed.")
+ (dun-mprincl "\ntoukmond ftp access not allowed."))
(if (string= username "anonymous")
- (if batch-mode
- (mprincl
+ (if dun-batch-mode
+ (dun-mprincl
"Guest login okay, send your user ident as password.")
- (mprincl
+ (dun-mprincl
"\nGuest login okay, send your user ident as password."))
- (if batch-mode
- (mprinc "Password required for ")
- (mprinc "\nPassword required for "))
- (mprincl username))
- (mprinc "Password: ")
- (setq ident (read-line))
+ (if dun-batch-mode
+ (dun-mprinc "Password required for ")
+ (dun-mprinc "\nPassword required for "))
+ (dun-mprincl username))
+ (dun-mprinc "Password: ")
+ (setq ident (dun-read-line))
(if (not (string= username "anonymous"))
- (if batch-mode
- (mprincl "Login failed.")
- (mprincl "\nLogin failed."))
- (if batch-mode
- (mprincl "Guest login okay, user access restrictions apply.")
- (mprincl "\nGuest login okay, user access restrictions apply."))
- (ftp-commands)
+ (if dun-batch-mode
+ (dun-mprincl "Login failed.")
+ (dun-mprincl "\nLogin failed."))
+ (if dun-batch-mode
+ (dun-mprincl
+ "Guest login okay, user access restrictions apply.")
+ (dun-mprincl
+ "\nGuest login okay, user access restrictions apply."))
+ (dun-ftp-commands)
(setq newlist
'("What password did you use during anonymous ftp to gamma?"))
(setq newlist (append newlist (list ident)))
- (rplaca (nthcdr 1 endgame-questions) newlist)))))))))
+ (rplaca (nthcdr 1 dun-endgame-questions) newlist)))))))))
-(defun ftp-commands ()
- (setq exitf nil)
+(defun dun-ftp-commands ()
+ (setq dun-exitf nil)
(let (line)
- (while (not exitf)
- (mprinc "ftp> ")
- (setq line (read-line))
+ (while (not dun-exitf)
+ (dun-mprinc "ftp> ")
+ (setq line (dun-read-line))
(if
(eq
- (parse2 nil
- '((type . ftptype) (binary . bin) (bin . bin) (send . send)
- (put . send) (quit . ftpquit) (help . ftphelp)
- (ascii . fascii)
+ (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)
) line)
-1)
- (mprincl "No such command. Try help.")))
- (setq ftptype 'ascii)))
+ (dun-mprincl "No such command. Try help.")))
+ (setq dun-ftptype 'ascii)))
-(defun ftptype (args)
+(defun dun-ftptype (args)
(if (not (car args))
- (mprincl "Usage: type [binary | ascii]")
+ (dun-mprincl "Usage: type [binary | ascii]")
(setq args (intern (car args)))
(if (eq args 'binary)
- (bin nil)
+ (dun-bin nil)
(if (eq args 'ascii)
- (fascii 'nil)
- (mprincl "Unknown type.")))))
+ (dun-fascii 'nil)
+ (dun-mprincl "Unknown type.")))))
-(defun bin (args)
- (mprincl "Type set to binary.")
- (setq ftptype 'binary))
+(defun dun-bin (args)
+ (dun-mprincl "Type set to binary.")
+ (setq dun-ftptype 'binary))
-(defun fascii (args)
- (mprincl "Type set to ascii.")
- (setq ftptype 'ascii))
+(defun dun-fascii (args)
+ (dun-mprincl "Type set to ascii.")
+ (setq dun-ftptype 'ascii))
-(defun ftpquit (args)
- (setq exitf t))
+(defun dun-ftpquit (args)
+ (setq dun-exitf t))
-(defun send (args)
+(defun dun-send (args)
(if (not (car args))
- (mprincl "Usage: send <filename>")
+ (dun-mprincl "Usage: send <filename>")
(setq args (car args))
(let (counter foo)
(setq foo nil)
@@ -2768,107 +2775,110 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
;;; User can send commands! Stupid user.
- (if (assq (intern args) unix-verbs)
+ (if (assq (intern args) dun-unix-verbs)
(progn
- (rplaca (assq (intern args) unix-verbs) 'IMPOSSIBLE)
- (mprinc "Sending ")
- (mprinc ftptype)
- (mprinc " file for ")
- (mprincl args)
- (mprincl "Transfer complete."))
-
- (dolist (x objfiles)
+ (rplaca (assq (intern args) dun-unix-verbs) 'IMPOSSIBLE)
+ (dun-mprinc "Sending ")
+ (dun-mprinc dun-ftptype)
+ (dun-mprinc " file for ")
+ (dun-mprincl args)
+ (dun-mprincl "Transfer complete."))
+
+ (dolist (x dun-objfiles)
(if (string= args x)
(progn
- (if (not (member counter inventory))
+ (if (not (member counter dun-inventory))
(progn
- (mprincl "No such file.")
+ (dun-mprincl "No such file.")
(setq foo t))
- (mprinc "Sending ")
- (mprinc ftptype)
- (mprinc " file for ")
- (mprinc (downcase (cadr (nth counter objects))))
- (mprincl ", (0 bytes)")
- (if (not (eq ftptype 'binary))
+ (dun-mprinc "Sending ")
+ (dun-mprinc dun-ftptype)
+ (dun-mprinc " file for ")
+ (dun-mprinc (downcase (cadr (nth counter dun-objects))))
+ (dun-mprincl ", (0 bytes)")
+ (if (not (eq dun-ftptype 'binary))
(progn
(if (not (member obj-protoplasm
- (nth receiving-room room-objects)))
- (replace room-objects receiving-room
- (append (nth receiving-room room-objects)
+ (nth receiving-room
+ dun-room-objects)))
+ (dun-replace dun-room-objects receiving-room
+ (append (nth receiving-room
+ dun-room-objects)
(list obj-protoplasm))))
- (remove-obj-from-inven counter))
- (remove-obj-from-inven counter)
- (replace room-objects receiving-room
- (append (nth receiving-room room-objects)
+ (dun-remove-obj-from-inven counter))
+ (dun-remove-obj-from-inven counter)
+ (dun-replace dun-room-objects receiving-room
+ (append (nth receiving-room dun-room-objects)
(list counter))))
(setq foo t)
- (mprincl "Transfer complete."))))
+ (dun-mprincl "Transfer complete."))))
(setq counter (+ 1 counter)))
(if (not foo)
- (mprincl "No such file."))))))
+ (dun-mprincl "No such file."))))))
-(defun ftphelp (args)
- (mprincl
+(defun dun-ftphelp (args)
+ (dun-mprincl
"Possible commands are:\nsend quit type ascii binary help"))
-(defun uexit (args)
+(defun dun-uexit (args)
(setq dungeon-mode 'dungeon)
- (mprincl "\nYou step back from the console.")
- (define-key dungeon-mode-map "\r" 'dungeon-parse)
- (if (not batch-mode)
- (dungeon-messages)))
+ (dun-mprincl "\nYou step back from the console.")
+ (define-key dungeon-mode-map "\r" 'dun-parse)
+ (if (not dun-batch-mode)
+ (dun-messages)))
-(defun dunnet-pwd (args)
- (mprincl cdpath))
+(defun dun-pwd (args)
+ (dun-mprincl dun-cdpath))
-(defun uncompress (args)
+(defun dun-uncompress (args)
(if (not (car args))
- (mprincl "Usage: uncompress <filename>")
+ (dun-mprincl "Usage: uncompress <filename>")
(setq args (car args))
- (if (or uncompressed
+ (if (or dun-uncompressed
(and (not (string= args "paper.o"))
(not (string= args "paper.o.z"))))
- (mprincl "Uncompress command failed.")
- (setq uncompressed t)
- (setq inventory (append inventory (list obj-paper))))))
+ (dun-mprincl "Uncompress command failed.")
+ (setq dun-uncompressed t)
+ (setq dun-inventory (append dun-inventory (list obj-paper))))))
-(defun rlogin (args)
+(defun dun-rlogin (args)
(let (passwd)
(if (not (car args))
- (mprincl "Usage: rlogin <hostname>")
+ (dun-mprincl "Usage: rlogin <hostname>")
(setq args (car args))
(if (string= args "endgame")
- (rlogin-endgame)
+ (dun-rlogin-endgame)
(if (not (string= args "gamma"))
- (mprincl "No such host.")
- (if (not ethernet)
- (mprincl "Host not responding.")
- (mprinc "Password: ")
- (setq passwd (read-line))
+ (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"))
- (mprincl "\nlogin incorrect")
- (mprinc
+ (dun-mprincl "\nlogin incorrect")
+ (dun-mprinc
"\nYou begin to feel strange for a moment, and you lose your items."
)
- (replace room-objects computer-room
- (append (nth computer-room room-objects) inventory))
- (setq inventory nil)
- (setq current-room receiving-room)
- (uexit nil))))))))
+ (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 dunnet-cd (args)
+(defun dun-cd (args)
(let (tcdpath tcdroom path-elemants room-check)
(if (not (car args))
- (mprincl "Usage: cd <path>")
- (setq tcdpath cdpath)
- (setq tcdroom cdroom)
- (setq badcd nil)
+ (dun-mprincl "Usage: cd <path>")
+ (setq tcdpath dun-cdpath)
+ (setq tcdroom dun-cdroom)
+ (setq dun-badcd nil)
(condition-case nil
- (setq path-elements (get-path (car args) nil))
- (error (mprincl "Invalid path.")
- (setq badcd t)))
+ (setq path-elements (dun-get-path (car args) nil))
+ (error (dun-mprincl "Invalid path.")
+ (setq dun-badcd t)))
(dolist (pe path-elements)
- (unless badcd
+ (unless dun-badcd
(if (not (string= pe "."))
(if (string= pe "..")
(progn
@@ -2896,11 +2906,11 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
(progn
(setq tcdpath "/usr/toukmond")
(setq tcdroom -10))
- (nosuchdir))
+ (dun-nosuchdir))
(if (= tcdroom -10)
- (nosuchdir)
+ (dun-nosuchdir)
(if (> tcdroom 0)
- (nosuchdir)
+ (dun-nosuchdir)
(if (= tcdroom -3)
(progn
(if (string= pe "rooms")
@@ -2911,77 +2921,82 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
(progn
(setq tcdpath "/usr")
(setq tcdroom -4))
- (nosuchdir))))
+ (dun-nosuchdir))))
(if (= tcdroom -2)
(progn
- (dolist (x visited)
+ (dolist (x dun-visited)
(setq room-check
- (nth x room-shorts))
+ (nth x
+ dun-room-shorts))
(if (string= room-check pe)
(progn
(setq tcdpath
(concat "/rooms/" room-check))
(setq tcdroom x))))
(if (= tcdroom -2)
- (nosuchdir)))))))))))))
- (if (not badcd)
+ (dun-nosuchdir)))))))))))))
+ (if (not dun-badcd)
(progn
- (setq cdpath tcdpath)
- (setq cdroom tcdroom)
+ (setq dun-cdpath tcdpath)
+ (setq dun-cdroom tcdroom)
0)
-2))))
-(defun nosuchdir ()
- (mprincl "No such directory.")
- (setq badcd t))
+(defun dun-nosuchdir ()
+ (dun-mprincl "No such directory.")
+ (setq dun-badcd t))
-(defun cat (args)
+(defun dun-cat (args)
(let (doto checklist)
(if (not (setq args (car args)))
- (mprincl "Usage: cat <ascii-file-name>")
+ (dun-mprincl "Usage: cat <ascii-file-name>")
(if (string-match "/" args)
- (mprincl "cat: only files in current directory allowed.")
- (if (and (> cdroom 0) (string= args "description"))
- (mprincl (car (nth cdroom rooms)))
+ (dun-mprincl "cat: only files in current directory allowed.")
+ (if (and (> dun-cdroom 0) (string= args "description"))
+ (dun-mprincl (car (nth dun-cdroom dun-rooms)))
(if (setq doto (string-match "\\.o" args))
(progn
- (if (= cdroom -10)
- (setq checklist inventory)
- (setq checklist (nth cdroom room-objects)))
+ (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)) objnames))
+ (substring args 0 doto))
+ dun-objnames))
checklist))
- (mprincl "File not found.")
- (mprincl "Ascii files only.")))
- (if (assq (intern args) unix-verbs)
- (mprincl "Ascii files only.")
- (mprincl "File not found."))))))))
+ (dun-mprincl "File not found.")
+ (dun-mprincl "Ascii files only.")))
+ (if (assq (intern args) dun-unix-verbs)
+ (dun-mprincl "Ascii files only.")
+ (dun-mprincl "File not found."))))))))
-(defun zippy (args)
- (mprincl (yow)))
+(defun dun-zippy (args)
+ (dun-mprincl (yow)))
-(defun rlogin-endgame ()
- (if (not (= (score nil) 90))
- (mprincl "You have not achieved enough points to connect to endgame.")
- (mprincl"\nWelcome to the endgame. You are a truly noble adventurer.")
- (setq current-room treasure-room)
- (setq endgame t)
- (replace room-objects endgame-treasure-room (list obj-bill))
- (uexit nil)))
+(defun dun-rlogin-endgame ()
+ (if (not (= (dun-score nil) 90))
+ (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)
+ (setq dun-endgame t)
+ (dun-replace dun-room-objects endgame-treasure-room (list obj-bill))
+ (dun-uexit nil)))
(random t)
(setq tloc (+ 60 (% (abs (random)) 18)))
-(replace room-objects tloc (append (nth tloc room-objects) (list 18)))
+(dun-replace dun-room-objects tloc
+ (append (nth tloc dun-room-objects) (list 18)))
+
(setq tcomb (+ 100 (% (abs (random)) 899)))
-(setq combination (prin1-to-string tcomb))
+(setq dun-combination (prin1-to-string tcomb))
;;;;
;;;; This section defines the DOS emulation functions for dunnet
;;;;
-(defun dos-parse (args)
+(defun dun-dos-parse (args)
(interactive "*p")
(beginning-of-line)
(let (beg)
@@ -2991,42 +3006,42 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
(let (line)
(setq line (downcase (buffer-substring beg (point))))
(princ line)
- (if (eq (parse2 nil dos-verbs line) -1)
+ (if (eq (dun-parse2 nil dun-dos-verbs line) -1)
(progn
(sleep-for 1)
- (mprincl "Bad command or file name"))))
+ (dun-mprincl "Bad command or file name"))))
(goto-char (point-max))
- (mprinc "\n"))
+ (dun-mprinc "\n"))
(if (eq dungeon-mode 'dos)
(progn
- (fix-screen)
- (dos-prompt)))))
+ (dun-fix-screen)
+ (dun-dos-prompt)))))
-(defun dos-interface ()
- (dos-boot-msg)
+(defun dun-dos-interface ()
+ (dun-dos-boot-msg)
(setq dungeon-mode 'dos)
- (define-key dungeon-mode-map "\r" 'dos-parse)
- (dos-prompt))
+ (define-key dungeon-mode-map "\r" 'dun-dos-parse)
+ (dun-dos-prompt))
-(defun dos-type (args)
+(defun dun-dos-type (args)
(sleep-for 2)
(if (setq args (car args))
(if (string= args "foo.txt")
- (dos-show-combination)
+ (dun-dos-show-combination)
(if (string= args "command.com")
- (mprincl "Cannot type binary files")
- (mprinc "File not found - ")
- (mprincl (upcase args))))
- (mprincl "Must supply file name")))
+ (dun-mprincl "Cannot type binary files")
+ (dun-mprinc "File not found - ")
+ (dun-mprincl (upcase args))))
+ (dun-mprincl "Must supply file name")))
-(defun dos-invd (args)
+(defun dun-dos-invd (args)
(sleep-for 1)
- (mprincl "Invalid drive specification"))
+ (dun-mprincl "Invalid drive specification"))
-(defun dos-dir (args)
+(defun dun-dos-dir (args)
(sleep-for 1)
(if (or (not (setq args (car args))) (string= args "\\"))
- (mprincl "
+ (dun-mprincl "
Volume in drive A is FOO
Volume Serial Number is 1A16-08C9
Directory of A:\\
@@ -3036,7 +3051,7 @@ FOO TXT 40 01-20-93 1:01a
2 file(s) 47845 bytes
1065280 bytes free
")
- (mprincl "
+ (dun-mprincl "
Volume in drive A is FOO
Volume Serial Number is 1A16-08C9
Directory of A:\\
@@ -3044,97 +3059,95 @@ FOO TXT 40 01-20-93 1:01a
File not found")))
-(defun dos-prompt ()
- (mprinc "A> "))
+(defun dun-dos-prompt ()
+ (dun-mprinc "A> "))
-(defun dos-boot-msg ()
+(defun dun-dos-boot-msg ()
(sleep-for 3)
- (mprinc "Current time is ")
- (mprincl (substring (current-time-string) 12 20))
- (mprinc "Enter new time: ")
- (read-line)
- (if (not batch-mode)
- (mprinc "\n")))
-
-(defun dos-spawn (args)
+ (dun-mprinc "Current time is ")
+ (dun-mprincl (substring (current-time-string) 12 20))
+ (dun-mprinc "Enter new time: ")
+ (dun-read-line)
+ (if (not dun-batch-mode)
+ (dun-mprinc "\n")))
+
+(defun dun-dos-spawn (args)
(sleep-for 1)
- (mprincl "Cannot spawn subshell"))
+ (dun-mprincl "Cannot spawn subshell"))
-(defun dos-exit (args)
+(defun dun-dos-exit (args)
(setq dungeon-mode 'dungeon)
- (mprincl "\nYou power down the machine and step back.")
- (define-key dungeon-mode-map "\r" 'dungeon-parse)
- (if (not batch-mode)
- (dungeon-messages)))
+ (dun-mprincl "\nYou power down the machine and step back.")
+ (define-key dungeon-mode-map "\r" 'dun-parse)
+ (if (not dun-batch-mode)
+ (dun-messages)))
-(defun dos-no-disk ()
+(defun dun-dos-no-disk ()
(sleep-for 3)
- (mprincl "Boot sector not found"))
+ (dun-mprincl "Boot sector not found"))
-(defun dos-show-combination ()
+(defun dun-dos-show-combination ()
(sleep-for 2)
- (mprinc "\nThe combination is ")
- (mprinc combination)
- (mprinc ".\n"))
+ (dun-mprinc "\nThe combination is ")
+ (dun-mprinc dun-combination)
+ (dun-mprinc ".\n"))
-(defun dos-nil (args))
+(defun dun-dos-nil (args))
;;;;
;;;; This section defines the save and restore game functions for dunnet.
;;;;
-(defun save-game (filename)
+(defun dun-save-game (filename)
(if (not (setq filename (car filename)))
- (mprincl "You must supply a filename for the save.")
+ (dun-mprincl "You must supply a filename for the save.")
(if (file-exists-p filename)
(delete-file filename))
- (setq numsaves (1+ numsaves))
- (make-save-buffer)
- (save-val "current-room")
- (save-val "computer")
- (save-val "door1")
- (save-val "combination")
- (save-val "visited")
- (save-val "diggables")
- (save-val "key-level")
- (save-val "floppy")
- (save-val "numsaves")
- (save-val "numcmds")
- (save-val "logged-in")
- (save-val "dungeon-mode")
- (save-val "jar")
- (save-val "lastdir")
- (save-val "black")
- (save-val "nomail")
- (save-val "unix-verbs")
- (save-val "hole")
- (save-val "uncompressed")
- (save-val "ethernet")
- (save-val "sauna-level")
- (save-val "room-objects")
- (save-val "room-silents")
- (save-val "inventory")
- (save-val "endgame-question")
- (save-val "endgame")
- (save-val "endgame-questions")
- (save-val "cdroom")
- (save-val "cdpath")
- (save-val "correct-answer")
- (save-val "inbus")
- (if (compile-save-out filename)
- (mprincl "Error saving to file.")
- (do-logfile 'save nil)
+ (setq dun-numsaves (1+ dun-numsaves))
+ (dun-make-save-buffer)
+ (dun-save-val "dun-current-room")
+ (dun-save-val "dun-computer")
+ (dun-save-val "dun-combination")
+ (dun-save-val "dun-visited")
+ (dun-save-val "dun-diggables")
+ (dun-save-val "dun-key-level")
+ (dun-save-val "dun-floppy")
+ (dun-save-val "dun-numsaves")
+ (dun-save-val "dun-numcmds")
+ (dun-save-val "dun-logged-in")
+ (dun-save-val "dungeon-mode")
+ (dun-save-val "dun-jar")
+ (dun-save-val "dun-lastdir")
+ (dun-save-val "dun-black")
+ (dun-save-val "dun-nomail")
+ (dun-save-val "dun-unix-verbs")
+ (dun-save-val "dun-hole")
+ (dun-save-val "dun-uncompressed")
+ (dun-save-val "dun-ethernet")
+ (dun-save-val "dun-sauna-level")
+ (dun-save-val "dun-room-objects")
+ (dun-save-val "dun-room-silents")
+ (dun-save-val "dun-inventory")
+ (dun-save-val "dun-endgame-question")
+ (dun-save-val "dun-endgame")
+ (dun-save-val "dun-cdroom")
+ (dun-save-val "dun-cdpath")
+ (dun-save-val "dun-correct-answer")
+ (dun-save-val "dun-inbus")
+ (if (dun-compile-save-out filename)
+ (dun-mprincl "Error saving to file.")
+ (dun-do-logfile 'save nil)
(switch-to-buffer "*dungeon*")
(princ "")
- (mprincl "Done."))))
+ (dun-mprincl "Done."))))
-(defun make-save-buffer ()
+(defun dun-make-save-buffer ()
(switch-to-buffer (get-buffer-create "*save-dungeon*"))
(erase-buffer))
-(defun compile-save-out (filename)
+(defun dun-compile-save-out (filename)
(let (ferror)
(setq ferror nil)
(condition-case nil
@@ -3150,69 +3163,69 @@ File not found")))
ferror))
-(defun save-val (varname)
+(defun dun-save-val (varname)
(let (value)
(setq varname (intern varname))
(setq value (eval varname))
- (minsert "(setq ")
- (minsert varname)
- (minsert " ")
+ (dun-minsert "(setq ")
+ (dun-minsert varname)
+ (dun-minsert " ")
(if (or (listp value)
(symbolp value))
- (minsert "'"))
+ (dun-minsert "'"))
(if (stringp value)
- (minsert "\""))
- (minsert value)
+ (dun-minsert "\""))
+ (dun-minsert value)
(if (stringp value)
- (minsert "\""))
- (minsertl ")")))
+ (dun-minsert "\""))
+ (dun-minsertl ")")))
-(defun restore (args)
+(defun dun-restore (args)
(let (file)
(if (not (setq file (car args)))
- (mprincl "You must supply a filename.")
- (if (not (load-d file))
- (mprincl "Could not load restore file.")
- (mprincl "Done.")
+ (dun-mprincl "You must supply a filename.")
+ (if (not (dun-load-d file))
+ (dun-mprincl "Could not load restore file.")
+ (dun-mprincl "Done.")
(setq room 0)))))
-(defun do-logfile (type how)
+(defun dun-do-logfile (type how)
(let (ferror newscore)
(setq ferror nil)
(switch-to-buffer (get-buffer-create "*score*"))
(erase-buffer)
(condition-case nil
- (insert-file-contents log-file)
+ (insert-file-contents dun-log-file)
(error (setq ferror t)))
(unless ferror
(goto-char (point-max))
- (minsert (current-time-string))
- (minsert " ")
- (minsert (user-login-name))
- (minsert " ")
+ (dun-minsert (current-time-string))
+ (dun-minsert " ")
+ (dun-minsert (user-login-name))
+ (dun-minsert " ")
(if (eq type 'save)
- (minsert "saved ")
- (if (= (endgame-score) 110)
- (minsert "won ")
+ (dun-minsert "saved ")
+ (if (= (dun-endgame-score) 110)
+ (dun-minsert "won ")
(if (not how)
- (minsert "quit ")
- (minsert "killed by ")
- (minsert how)
- (minsert " "))))
- (minsert "at ")
- (minsert (cadr (nth (abs room) rooms)))
- (minsert ". score: ")
- (if (> (endgame-score) 0)
- (minsert (setq newscore (+ 90 (endgame-score))))
- (minsert (setq newscore (reg-score))))
- (minsert " saves: ")
- (minsert numsaves)
- (minsert " commands: ")
- (minsert numcmds)
- (minsert "\n")
- (write-region 1 (point-max) log-file nil 1))
+ (dun-minsert "quit ")
+ (dun-minsert "killed by ")
+ (dun-minsert how)
+ (dun-minsert " "))))
+ (dun-minsert "at ")
+ (dun-minsert (cadr (nth (abs room) dun-rooms)))
+ (dun-minsert ". score: ")
+ (if (> (dun-endgame-score) 0)
+ (dun-minsert (setq newscore (+ 90 (dun-endgame-score))))
+ (dun-minsert (setq newscore (dun-reg-score))))
+ (dun-minsert " saves: ")
+ (dun-minsert dun-numsaves)
+ (dun-minsert " commands: ")
+ (dun-minsert dun-numcmds)
+ (dun-minsert "\n")
+ (write-region 1 (point-max) dun-log-file nil 1))
(kill-buffer (current-buffer))))
@@ -3221,13 +3234,13 @@ File not found")))
;;;; be run in batch mode.
-(defun batch-mprinc (arg)
+(defun dun-batch-mprinc (arg)
(if (stringp arg)
(send-string-to-terminal arg)
(send-string-to-terminal (prin1-to-string arg))))
-(defun batch-mprincl (arg)
+(defun dun-batch-mprincl (arg)
(if (stringp arg)
(progn
(send-string-to-terminal arg)
@@ -3235,82 +3248,81 @@ File not found")))
(send-string-to-terminal (prin1-to-string arg))
(send-string-to-terminal "\n")))
-(defun batch-parse (ignore verblist line)
- (setq line-list (listify-string (concat line " ")))
- (doverb ignore verblist (car line-list) (cdr line-list)))
+(defun dun-batch-parse (dun-ignore dun-verblist line)
+ (setq line-list (dun-listify-string (concat line " ")))
+ (dun-doverb dun-ignore dun-verblist (car line-list) (cdr line-list)))
-(defun batch-parse2 (ignore verblist line)
- (setq line-list (listify-string2 (concat line " ")))
- (doverb ignore verblist (car line-list) (cdr line-list)))
+(defun dun-batch-parse2 (dun-ignore dun-verblist line)
+ (setq line-list (dun-listify-string2 (concat line " ")))
+ (dun-doverb dun-ignore dun-verblist (car line-list) (cdr line-list)))
-(defun batch-read-line ()
+(defun dun-batch-read-line ()
(read-from-minibuffer "" nil dungeon-batch-map))
-(defun dungeon-batch-loop ()
- (setq dead nil)
+(defun dun-batch-loop ()
+ (setq dun-dead nil)
(setq room 0)
- (while (not dead)
+ (while (not dun-dead)
(if (eq dungeon-mode 'dungeon)
(progn
- (if (not (= room current-room))
+ (if (not (= room dun-current-room))
(progn
- (describe-room current-room)
- (setq room current-room)))
- (mprinc ">")
- (setq line (downcase (read-line)))
- (if (eq (parse ignore verblist line) -1)
- (mprinc "I don't understand that.\n"))))))
-
-(defun batch-dos-interface ()
- (dos-boot-msg)
+ (dun-describe-room dun-current-room)
+ (setq room dun-current-room)))
+ (dun-mprinc ">")
+ (setq line (downcase (dun-read-line)))
+ (if (eq (dun-vparse dun-ignore dun-verblist line) -1)
+ (dun-mprinc "I don't understand that.\n"))))))
+
+(defun dun-batch-dos-interface ()
+ (dun-dos-boot-msg)
(setq dungeon-mode 'dos)
(while (eq dungeon-mode 'dos)
- (dos-prompt)
- (setq line (downcase (read-line)))
- (if (eq (parse2 nil dos-verbs line) -1)
+ (dun-dos-prompt)
+ (setq line (downcase (dun-read-line)))
+ (if (eq (dun-parse2 nil dun-dos-verbs line) -1)
(progn
(sleep-for 1)
- (mprincl "Bad command or file name"))))
+ (dun-mprincl "Bad command or file name"))))
(goto-char (point-max))
- (mprinc "\n"))
+ (dun-mprinc "\n"))
-(defun batch-unix-interface ()
- (login)
- (if logged-in
+(defun dun-batch-unix-interface ()
+ (dun-login)
+ (if dun-logged-in
(progn
(setq dungeon-mode 'unix)
(while (eq dungeon-mode 'unix)
- (mprinc "$ ")
- (setq line (downcase (read-line)))
- (if (eq (parse2 nil unix-verbs line) -1)
+ (dun-mprinc "$ ")
+ (setq line (downcase (dun-read-line)))
+ (if (eq (dun-parse2 nil dun-unix-verbs line) -1)
(let (esign)
(if (setq esign (string-match "=" line))
- (doassign line esign)
- (mprinc (car line-list))
- (mprincl ": not found.")))))
+ (dun-doassign line esign)
+ (dun-mprinc (car line-list))
+ (dun-mprincl ": not found.")))))
(goto-char (point-max))
- (mprinc "\n"))))
+ (dun-mprinc "\n"))))
(defun dungeon-nil (arg)
"noop"
(interactive "*p"))
-(defun batch-dungeon ()
+(defun dun-batch-dungeon ()
(load "dun-batch")
- (setq visited '(27))
- (mprinc "\n")
- (dungeon-batch-loop))
+ (setq dun-visited '(27))
+ (dun-mprinc "\n")
+ (dun-batch-loop))
(unless (not noninteractive)
- (fset 'mprinc 'batch-mprinc)
- (fset 'mprincl 'batch-mprincl)
- (fset 'parse 'batch-parse)
- (fset 'parse2 'batch-parse2)
- (fset 'read-line 'batch-read-line)
- (fset 'dos-interface 'batch-dos-interface)
- (fset 'unix-interface 'batch-unix-interface)
- (mprinc "\n")
- (setq batch-mode t)
- (dungeon-batch-loop))
-
+ (fset 'dun-mprinc 'dun-batch-mprinc)
+ (fset 'dun-mprincl 'dun-batch-mprincl)
+ (fset 'dun-vparse 'dun-batch-parse)
+ (fset 'dun-parse2 'dun-batch-parse2)
+ (fset 'dun-read-line 'dun-batch-read-line)
+ (fset 'dun-dos-interface 'dun-batch-dos-interface)
+ (fset 'dun-unix-interface 'dun-batch-unix-interface)
+ (dun-mprinc "\n")
+ (setq dun-batch-mode t)
+ (dun-batch-loop))