1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00
emacs/lisp/play/dunnet.el

3374 lines
112 KiB
EmacsLisp
Raw Normal View History

;;; dunnet.el --- text adventure for Emacs
1993-07-08 21:10:59 +00:00
;; Copyright (C) 1992, 1993, 2001 Free Software Foundation, Inc.
1996-01-14 07:34:30 +00:00
;; Author: Ron Schnell <ronnie@driver-aces.com>
1993-07-08 21:10:59 +00:00
;; Created: 25 Jul 1992
;; Version: 2.01
1993-07-08 21:10:59 +00:00
;; Keywords: games
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
1996-01-14 07:34:30 +00:00
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
1993-07-08 21:10:59 +00:00
;;; Commentary:
;; This game can be run in batch mode. To do this, use:
1993-07-13 20:44:02 +00:00
;; emacs -batch -l dunnet
1993-07-08 21:10:59 +00:00
2003-02-04 13:24:35 +00:00
;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1993-07-08 21:10:59 +00:00
;;; The log file should be set for your system, and it must
1996-01-04 23:13:09 +00:00
;;; be writable by all.
1993-07-08 21:10:59 +00:00
;;; Code:
1998-04-05 16:14:58 +00:00
(defgroup dunnet nil
"Text adventure for Emacs."
:prefix "dun-"
:group 'games)
(defcustom dun-log-file "/usr/local/dunnet.score"
"Name of file to store score information for dunnet."
:type 'file
:group 'dunnet)
1993-07-08 21:10:59 +00:00
(if nil
(eval-and-compile (setq byte-compile-warnings nil)))
(eval-when-compile
(require 'cl))
1993-07-08 21:10:59 +00:00
;;;; Mode definitions for interactive mode
1993-07-13 20:44:02 +00:00
(defun dun-mode ()
"Major mode for running dunnet."
1993-07-08 21:10:59 +00:00
(interactive)
(text-mode)
(make-local-variable 'scroll-step)
(setq scroll-step 2)
1993-07-08 21:10:59 +00:00
(use-local-map dungeon-mode-map)
(setq major-mode 'dun-mode)
1993-07-08 21:10:59 +00:00
(setq mode-name "Dungeon"))
1993-07-13 20:44:02 +00:00
(defun dun-parse (arg)
"Function called when return is pressed in interactive mode to parse line."
1993-07-08 21:10:59 +00:00
(interactive "*p")
(beginning-of-line)
(setq beg (+ (point) 1))
(end-of-line)
(if (and (not (= beg (point))) (not (< (point) beg))
(string= ">" (buffer-substring (- beg 1) beg)))
(progn
(setq line (downcase (buffer-substring beg (point))))
(princ line)
1993-07-13 20:44:02 +00:00
(if (eq (dun-vparse dun-ignore dun-verblist line) -1)
(dun-mprinc "I don't understand that.\n")))
1993-07-08 21:10:59 +00:00
(goto-char (point-max))
1993-07-13 20:44:02 +00:00
(dun-mprinc "\n"))
(dun-messages))
2003-02-04 13:24:35 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-messages ()
(if dun-dead
1993-07-08 21:10:59 +00:00
(text-mode)
(if (eq dungeon-mode 'dungeon)
(progn
1993-07-13 20:44:02 +00:00
(if (not (= room dun-current-room))
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-describe-room dun-current-room)
(setq room dun-current-room)))
(dun-fix-screen)
(dun-mprinc ">")))))
1993-07-08 21:10:59 +00:00
;;;###autoload
(defun dunnet ()
"Switch to *dungeon* buffer and start game."
(interactive)
(switch-to-buffer "*dungeon*")
1993-07-13 20:44:02 +00:00
(dun-mode)
(setq dun-dead nil)
1993-07-08 21:10:59 +00:00
(setq room 0)
1993-07-13 20:44:02 +00:00
(dun-messages))
1993-07-08 21:10:59 +00:00
;;;;
;;;; This section contains all of the verbs and commands.
;;;;
;;; Give long description of room if haven't been there yet. Otherwise
;;; short. Also give long if we were called with negative room number.
1993-07-13 20:44:02 +00:00
(defun dun-describe-room (room)
2003-02-04 13:24:35 +00:00
(if (and (not (member (abs room) dun-light-rooms))
1993-07-13 20:44:02 +00:00
(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)))
2003-02-04 13:24:35 +00:00
(if (and (and (or (member room dun-visited)
1993-07-13 20:44:02 +00:00
(string= dun-mode "dun-superb")) (> room 0))
(not (string= dun-mode "long")))
1993-07-08 21:10:59 +00:00
nil
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
(if (= xobjs obj-special)
1993-07-13 20:44:02 +00:00
(dun-special-object)
1993-07-08 21:10:59 +00:00
(if (>= xobjs 0)
1993-07-13 20:44:02 +00:00
(dun-mprincl (car (nth xobjs dun-objects)))
(if (not (and (= xobjs obj-bus) dun-inbus))
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl (car (nth (abs xobjs) dun-perm-objects)))))))
(if (and (= xobjs obj-jar) dun-jar)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(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."))))
1993-07-08 21:10:59 +00:00
;;; There is a special object in the room. This object's description,
;;; or lack thereof, depends on certain conditions.
1993-07-13 20:44:02 +00:00
(defun dun-special-object ()
(if (= dun-current-room computer-room)
(if dun-computer
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"The panel lights are flashing in a seemingly organized pattern.")
1993-07-13 20:44:02 +00:00
(dun-mprincl "The panel lights are steady and motionless.")))
1993-07-08 21:10:59 +00:00
2003-02-04 13:24:35 +00:00
(if (and (= dun-current-room red-room)
1993-07-13 20:44:02 +00:00
(not (member obj-towel (nth red-room dun-room-objects))))
(dun-mprincl "There is a hole in the floor here."))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(if (and (= dun-current-room marine-life-area) dun-black)
2003-02-04 13:24:35 +00:00
(dun-mprincl
"The room is lit by a black light, causing the fish, and some of
1993-07-08 21:10:59 +00:00
your objects, to give off an eerie glow."))
1993-07-13 20:44:02 +00:00
(if (and (= dun-current-room fourth-vermont-intersection) dun-hole)
1993-07-08 21:10:59 +00:00
(progn
1993-07-23 16:57:24 +00:00
(if (not dun-inbus)
(progn
(dun-mprincl"You fall into a hole in the ground.")
(setq dun-current-room vermont-station)
(dun-describe-room vermont-station))
(progn
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-23 16:57:24 +00:00
"The bus falls down a hole in the ground and explodes.")
(dun-die "burning")))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(if (> dun-current-room endgame-computer-room)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(if (not dun-correct-answer)
(dun-endgame-question)
(dun-mprincl "Your question is:")
(dun-mprincl dun-endgame-question))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(if (= dun-current-room sauna)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl (nth dun-sauna-level '(
1993-07-08 21:10:59 +00:00
"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.")))
2003-02-04 13:24:35 +00:00
(if (= dun-sauna-level 3)
1993-07-08 21:10:59 +00:00
(progn
(if (or (member obj-rms dun-inventory)
(member obj-rms (nth dun-current-room dun-room-objects)))
(progn
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"You notice the wax on your statuette beginning to melt, until it completely
melts off. You are left with a beautiful diamond!")
(if (member obj-rms dun-inventory)
(progn
(dun-remove-obj-from-inven obj-rms)
2003-02-04 13:24:35 +00:00
(setq dun-inventory (append dun-inventory
(list obj-diamond))))
(dun-remove-obj-from-room dun-current-room obj-rms)
(dun-replace dun-room-objects dun-current-room
(append (nth dun-current-room dun-room-objects)
(list obj-diamond))))))
(if (or (member obj-floppy dun-inventory)
(member obj-floppy (nth dun-current-room dun-room-objects)))
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl
2003-02-04 13:24:35 +00:00
"You notice your floppy disk beginning to melt. As you grab for it, the
1993-07-08 21:10:59 +00:00
disk bursts into flames, and disintegrates.")
1993-07-13 20:44:02 +00:00
(dun-remove-obj-from-inven obj-floppy)
(dun-remove-obj-from-room dun-current-room obj-floppy))))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-die (murderer)
(dun-mprinc "\n")
1993-07-08 21:10:59 +00:00
(if murderer
1993-07-13 20:44:02 +00:00
(dun-mprincl "You are dead."))
(dun-do-logfile 'dun-die murderer)
(dun-score nil)
(setq dun-dead t))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-quit (args)
(dun-die nil))
1993-07-08 21:10:59 +00:00
;;; Print every object in player's inventory. Special case for the jar,
;;; as we must also print what is in it.
1993-07-13 20:44:02 +00:00
(defun dun-inven (args)
(dun-mprinc "You currently have:")
(dun-mprinc "\n")
(dolist (curobj dun-inventory)
1993-07-08 21:10:59 +00:00
(if curobj
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl (cadr (nth curobj dun-objects)))
(if (and (= curobj obj-jar) dun-jar)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl "The jar contains:")
(dolist (x dun-jar)
(dun-mprinc " ")
(dun-mprincl (cadr (nth x dun-objects))))))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-shake (obj)
1993-07-08 21:10:59 +00:00
(let (objnum)
1993-07-13 20:44:02 +00:00
(when (setq objnum (dun-objnum-from-args-std obj))
(if (member objnum dun-inventory)
1993-07-08 21:10:59 +00:00
(progn
;;; If shaking anything will do anything, put here.
1993-07-13 20:44:02 +00:00
(dun-mprinc "Shaking ")
(dun-mprinc (downcase (cadr (nth objnum dun-objects))))
(dun-mprinc " seems to have no effect.")
(dun-mprinc "\n")
1993-07-08 21:10:59 +00:00
)
1993-07-13 20:44:02 +00:00
(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.")
1993-07-08 21:10:59 +00:00
;;; Shaking trees can be deadly
(if (= objnum obj-tree)
(progn
1993-07-13 20:44:02 +00:00
(dun-mprinc
1993-07-08 21:10:59 +00:00
"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.")
1993-07-13 20:44:02 +00:00
(dun-die "a coconut"))
1993-07-08 21:10:59 +00:00
(if (= objnum obj-bear)
(progn
1993-07-13 20:44:02 +00:00
(dun-mprinc
1993-07-08 21:10:59 +00:00
"As you go up to the bear, it removes your head and places it on the ground.")
1993-07-13 20:44:02 +00:00
(dun-die "a bear"))
1993-07-08 21:10:59 +00:00
(if (< objnum 0)
1993-07-13 20:44:02 +00:00
(dun-mprincl "You cannot shake that.")
(dun-mprincl "You don't have that.")))))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-drop (obj)
(if dun-inbus
(dun-mprincl "You can't drop anything while on the bus.")
1993-07-08 21:10:59 +00:00
(let (objnum ptr)
1993-07-13 20:44:02 +00:00
(when (setq objnum (dun-objnum-from-args-std obj))
(if (not (setq ptr (member objnum dun-inventory)))
(dun-mprincl "You don't have that.")
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-remove-obj-from-inven objnum)
(dun-replace dun-room-objects dun-current-room
(append (nth dun-current-room dun-room-objects)
1993-07-08 21:10:59 +00:00
(list objnum)))
1993-07-13 20:44:02 +00:00
(dun-mprincl "Done.")
1993-07-08 21:10:59 +00:00
(if (member objnum (list obj-food obj-weight obj-jar))
1993-07-13 20:44:02 +00:00
(dun-drop-check objnum))))))))
1993-07-08 21:10:59 +00:00
;;; Dropping certain things causes things to happen.
1993-07-13 20:44:02 +00:00
(defun dun-drop-check (objnum)
1993-07-08 21:10:59 +00:00
(if (and (= objnum obj-food) (= room bear-hangout)
1993-07-13 20:44:02 +00:00
(member obj-bear (nth bear-hangout dun-room-objects)))
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"The bear takes the food and runs away with it. He left something behind.")
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(list obj-key)))))
2003-02-04 13:24:35 +00:00
(if (and (= objnum obj-jar) (member obj-nitric dun-jar)
1993-07-13 20:44:02 +00:00
(member obj-glycerine dun-jar))
1993-07-08 21:10:59 +00:00
(progn
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-13 20:44:02 +00:00
"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)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(setq dun-hole t)
(setq dun-current-room vermont-station)
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"The explosion causes a hole to open up in the ground, which you fall
through.")))))
1993-07-13 20:44:02 +00:00
(if (and (= objnum obj-weight) (= dun-current-room maze-button-room))
(dun-mprincl "A passageway opens.")))
1993-07-08 21:10:59 +00:00
;;; Give long description of current room, or an object.
2003-02-04 13:24:35 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-examine (obj)
1993-07-08 21:10:59 +00:00
(let (objnum)
1993-07-13 20:44:02 +00:00
(setq objnum (dun-objnum-from-args obj))
1993-07-08 21:10:59 +00:00
(if (eq objnum obj-special)
1993-07-13 20:44:02 +00:00
(dun-describe-room (* dun-current-room -1))
1993-07-08 21:10:59 +00:00
(if (and (eq objnum obj-computer)
1993-07-13 20:44:02 +00:00
(member obj-pc (nth dun-current-room dun-room-silents)))
(dun-examine '("pc"))
1993-07-08 21:10:59 +00:00
(if (eq objnum nil)
1993-07-13 20:44:02 +00:00
(dun-mprincl "I don't know what that is.")
2003-02-04 13:24:35 +00:00
(if (and (not (member objnum
1993-07-13 20:44:02 +00:00
(nth dun-current-room dun-room-objects)))
(not (and (member obj-jar dun-inventory)
(member objnum dun-jar)))
2003-02-04 13:24:35 +00:00
(not (member objnum
1993-07-13 20:44:02 +00:00
(nth dun-current-room dun-room-silents)))
(not (member objnum dun-inventory)))
(dun-mprincl "I don't see that here.")
1993-07-08 21:10:59 +00:00
(if (>= objnum 0)
2003-02-04 13:24:35 +00:00
(if (and (= objnum obj-bone)
1993-07-13 20:44:02 +00:00
(= dun-current-room marine-life-area) dun-black)
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"In this light you can see some writing on the bone. It says:
For an explosive time, go to Fourth St. and Vermont.")
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl (nth (abs objnum) dun-permobj-desc)))
(dun-mprincl "I see nothing special about that.")))))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-take (obj)
(setq obj (dun-firstword obj))
(if (not obj)
(dun-mprincl "You must supply an object.")
(if (string= obj "all")
(let (gotsome)
(if dun-inbus
(dun-mprincl "You can't take anything while on the bus.")
(setq gotsome nil)
(dolist (x (nth dun-current-room dun-room-objects))
(if (and (>= x 0) (not (= x obj-special)))
(progn
(setq gotsome t)
(dun-mprinc (cadr (nth x dun-objects)))
(dun-mprinc ": ")
(dun-take-object x))))
(if (not gotsome)
(dun-mprincl "Nothing to take."))))
(let (objnum)
(setq objnum (cdr (assq (intern obj) dun-objnames)))
(if (eq objnum nil)
(progn
(dun-mprinc "I don't know what that is.")
(dun-mprinc "\n"))
(if (and dun-inbus (not (and (member objnum dun-jar)
(member obj-jar dun-inventory))))
(dun-mprincl "You can't take anything while on the bus.")
(dun-take-object objnum)))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-take-object (objnum)
(if (and (member objnum dun-jar) (member obj-jar dun-inventory))
1993-07-08 21:10:59 +00:00
(let (newjar)
1993-07-13 20:44:02 +00:00
(dun-mprincl "You remove it from the jar.")
1993-07-08 21:10:59 +00:00
(setq newjar nil)
1993-07-13 20:44:02 +00:00
(dolist (x dun-jar)
1993-07-08 21:10:59 +00:00
(if (not (= x objnum))
(setq newjar (append newjar (list x)))))
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
(if (>= objnum 0)
(progn
2003-02-04 13:24:35 +00:00
(if (and (car dun-inventory)
1993-07-13 20:44:02 +00:00
(> (+ (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))
2003-02-04 13:24:35 +00:00
(dun-mprinc
1993-07-13 20:44:02 +00:00
"Taking the towel reveals a hole in the floor."))))
(dun-try-take objnum)))
(dun-mprinc "\n")))
(defun dun-inven-weight ()
1993-07-08 21:10:59 +00:00
(let (total)
(setq total 0)
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
;;; We try to take an object that is untakable. Print a message
;;; depending on what it is.
1993-07-13 20:44:02 +00:00
(defun dun-try-take (obj)
(dun-mprinc "You cannot take that."))
(defun dun-dig (args)
(if dun-inbus
(dun-mprincl "Digging here reveals nothing.")
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(let (objnum)
1993-07-13 20:44:02 +00:00
(setq objnum (dun-objnum-from-args obj))
(cond ((not objnum)
(dun-mprincl "I don't know what that object is."))
((and (not (eq objnum obj-special))
(not (member objnum (nth dun-current-room dun-room-objects)))
(not (member objnum (nth dun-current-room dun-room-silents)))
(not (and (member objnum dun-jar) (member obj-jar dun-inventory)))
(not (member objnum dun-inventory)))
(dun-mprincl "I don't see that here."))
((and (eq objnum obj-special)
(not (member obj-tree (nth dun-current-room dun-room-silents))))
(dun-mprincl "There is nothing here to climb."))
((and (not (eq objnum obj-tree)) (not (eq objnum obj-special)))
(dun-mprincl "You can't climb that."))
(t
(dun-mprincl
"You manage to get about two feet up the tree and fall back down. You
notice that the tree is very unsteady.")))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-eat (obj)
1993-07-08 21:10:59 +00:00
(let (objnum)
1993-07-13 20:44:02 +00:00
(when (setq objnum (dun-objnum-from-args-std obj))
(if (not (member objnum dun-inventory))
(dun-mprincl "You don't have that.")
1993-07-08 21:10:59 +00:00
(if (not (= objnum obj-food))
(progn
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(let (newargs objnum objnum2 obj)
1993-07-13 20:44:02 +00:00
(setq newargs (dun-firstwordl args))
1993-07-08 21:10:59 +00:00
(if (not newargs)
1993-07-13 20:44:02 +00:00
(dun-mprincl "You must supply an object")
1993-07-08 21:10:59 +00:00
(setq obj (intern (car newargs)))
1993-07-13 20:44:02 +00:00
(setq objnum (cdr (assq obj dun-objnames)))
1993-07-08 21:10:59 +00:00
(if (not objnum)
1993-07-13 20:44:02 +00:00
(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)))
1993-07-08 21:10:59 +00:00
(if (not newargs)
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
(setq objnum2 obj-pc))
(if (not objnum2)
1993-07-13 20:44:02 +00:00
(dun-mprincl "I don't know what that indirect object is.")
2003-02-04 13:24:35 +00:00
(if (and (not (member objnum2
1993-07-13 20:44:02 +00:00
(nth dun-current-room dun-room-objects)))
2003-02-04 13:24:35 +00:00
(not (member objnum2
1993-07-13 20:44:02 +00:00
(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)))))))))
1993-07-13 20:44:02 +00:00
(defun dun-put-objs (obj1 obj2)
(if (and (= obj2 obj-drop) (not dun-nomail))
1993-07-08 21:10:59 +00:00
(setq obj2 obj-chute))
(if (= obj2 obj-disposal) (setq obj2 obj-chute))
(if (and (= obj1 obj-cpu) (= obj2 obj-computer))
(progn
1993-07-13 20:44:02 +00:00
(dun-remove-obj-from-inven obj-cpu)
(setq dun-computer t)
(dun-mprincl
1993-07-08 21:10:59 +00:00
"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))
1993-07-13 20:44:02 +00:00
(dun-drop '("weight"))
1993-07-08 21:10:59 +00:00
(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)))
1993-07-13 20:44:02 +00:00
(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."))
1993-07-08 21:10:59 +00:00
(if (= obj2 obj-chute) ;; Put something in chute
(progn
1993-07-13 20:44:02 +00:00
(dun-remove-obj-from-inven obj1)
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"You hear it slide down the chute and off into the distance.")
1993-07-13 20:44:02 +00:00
(dun-put-objs-in-treas (list obj1)))
1993-07-08 21:10:59 +00:00
(if (= obj2 obj-box) ;; Put key in key box
(if (= obj1 obj-key)
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"As you drop the key, the box begins to shake. Finally it explodes
with a bang. The key seems to have vanished!")
1993-07-13 20:44:02 +00:00
(dun-remove-obj-from-inven obj1)
(dun-replace dun-room-objects computer-room (append
1993-07-08 21:10:59 +00:00
(nth computer-room
1993-07-13 20:44:02 +00:00
dun-room-objects)
1993-07-08 21:10:59 +00:00
(list obj1)))
1993-07-13 20:44:02 +00:00
(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!"))
1993-07-08 21:10:59 +00:00
(if (and (= obj1 obj-floppy) (= obj2 obj-pc))
(progn
1993-07-13 20:44:02 +00:00
(setq dun-floppy t)
(dun-remove-obj-from-inven obj1)
(dun-mprincl "Done."))
1993-07-08 21:10:59 +00:00
(if (= obj2 obj-urinal) ;; Put object in urinal
(progn
1993-07-13 20:44:02 +00:00
(dun-remove-obj-from-inven obj1)
2003-02-04 13:24:35 +00:00
(dun-replace dun-room-objects urinal (append
1993-07-13 20:44:02 +00:00
(nth urinal dun-room-objects)
1993-07-08 21:10:59 +00:00
(list obj1)))
1993-07-13 20:44:02 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"You hear it plop down in some water below."))
(if (= obj2 obj-mail)
1993-07-13 20:44:02 +00:00
(dun-mprincl "The mail chute is locked.")
(if (member obj1 dun-inventory)
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"I don't know how to combine those objects. Perhaps you should
just try dropping it.")
1993-07-13 20:44:02 +00:00
(dun-mprincl"You can't put that there.")))))))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(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)
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"You type on the keyboard, but your characters do not even echo.")
1993-07-13 20:44:02 +00:00
(dun-unix-interface))))
1993-07-08 21:10:59 +00:00
;;; Various movement directions
1993-07-13 20:44:02 +00:00
(defun dun-n (args)
(dun-move north))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-s (args)
(dun-move south))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-e (args)
(dun-move east))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-w (args)
(dun-move west))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-ne (args)
(dun-move northeast))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-se (args)
(dun-move southeast))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-nw (args)
(dun-move northwest))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-sw (args)
(dun-move southwest))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-up (args)
(dun-move up))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-down (args)
(dun-move down))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-in (args)
(dun-move in))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-out (args)
(dun-move out))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-go (args)
2003-02-04 13:24:35 +00:00
(if (or (not (car args))
(eq (dun-doverb dun-ignore dun-verblist (car args)
1993-07-13 20:44:02 +00:00
(cdr (cdr args))) -1))
(dun-mprinc "I don't understand where you want me to go.\n")))
1993-07-08 21:10:59 +00:00
;;; 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.
1993-07-13 20:44:02 +00:00
(defun dun-move (dir)
2003-02-04 13:24:35 +00:00
(if (and (not (member dun-current-room dun-light-rooms))
1993-07-13 20:44:02 +00:00
(not (member obj-lamp dun-inventory)))
1993-07-08 21:10:59 +00:00
(progn
2003-02-04 13:24:35 +00:00
(dun-mprinc
1993-07-08 21:10:59 +00:00
"You trip over a grue and fall into a pit and break every bone in your
body.")
1993-07-13 20:44:02 +00:00
(dun-die "a grue"))
1993-07-08 21:10:59 +00:00
(let (newroom)
1993-07-13 20:44:02 +00:00
(setq newroom (nth dir (nth dun-current-room dungeon-map)))
1993-07-08 21:10:59 +00:00
(if (eq newroom -1)
1993-07-13 20:44:02 +00:00
(dun-mprinc "You can't go that way.\n")
1993-07-08 21:10:59 +00:00
(if (eq newroom 255)
1993-07-13 20:44:02 +00:00
(dun-special-move dir)
1993-07-08 21:10:59 +00:00
(setq room -1)
1993-07-13 20:44:02 +00:00
(setq dun-lastdir dir)
(if dun-inbus
1993-07-08 21:10:59 +00:00
(progn
(if (or (< newroom 58) (> newroom 83))
1993-07-13 20:44:02 +00:00
(dun-mprincl "The bus cannot go this way.")
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"The bus lurches ahead and comes to a screeching halt.")
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(list obj-bus)))))
1993-07-13 20:44:02 +00:00
(setq dun-current-room newroom)))))))
1993-07-08 21:10:59 +00:00
;;; Movement in this direction causes something special to happen if the
;;; right conditions exist. It may be that you can't go this way unless
;;; you have a key, or a passage has been opened.
;;; coding note: Each check of the current room is on the same 'if' level,
;;; i.e. there aren't else's. If two rooms next to each other have
;;; specials, and they are connected by specials, this could cause
;;; a problem. Be careful when adding them to consider this, and
;;; perhaps use else's.
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(let (combo)
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"You must type a 3 digit combination code to enter this room.")
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
(progn
2003-02-04 13:24:35 +00:00
(dun-mprinc
1993-07-08 21:10:59 +00:00
"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.
")
1993-07-13 20:44:02 +00:00
(dun-die "a bear"))
(dun-mprincl "You can't go that way.")))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(if (= dun-current-room vermont-station)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"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.")
1993-07-13 20:44:02 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"\nFinally the train comes to a sudden stop, and the doors open, and some
force throws you out. The train speeds away.\n")
1993-07-13 20:44:02 +00:00
(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."))
2003-02-04 13:24:35 +00:00
(if (or (= dun-current-room lakefront-north)
1993-07-13 20:44:02 +00:00
(= 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
1993-07-08 21:10:59 +00:00
"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.")
1993-07-13 20:44:02 +00:00
(dun-die "burning")))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(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.")))
1993-07-08 21:10:59 +00:00
2003-02-04 13:24:35 +00:00
(if (and (> dir down) (> dun-current-room gamma-computing-center)
1993-07-13 20:44:02 +00:00
(< 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.")
1993-07-08 21:10:59 +00:00
(if (= dir in)
(if dun-inbus
(dun-mprincl
"You are already in the bus!")
(if (member obj-license dun-inventory)
(progn
2003-02-04 13:24:35 +00:00
(dun-mprincl
"You board the bus and get in the driver's seat.")
(setq dun-nomail t)
(setq dun-inbus t))
(dun-mprincl "You are not licensed for this type of vehicle.")))
(if (not dun-inbus)
(dun-mprincl "You are already off the bus!")
(dun-mprincl "You hop off the bus.")
(setq dun-inbus nil))))
1993-07-13 20:44:02 +00:00
(if (= dun-current-room fifth-oaktree-intersection)
(if (not dun-inbus)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl "You fall down the cliff and land on your head.")
(dun-die "a cliff"))
(dun-mprincl
1993-07-08 21:10:59 +00:00
"The bus flies off the cliff, and plunges to the bottom, where it explodes.")
1993-07-13 20:44:02 +00:00
(dun-die "a bus accident")))
(if (= dun-current-room main-maple-intersection)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(if (not dun-inbus)
(dun-mprincl "The gate will not open.")
(dun-mprincl
1993-07-08 21:10:59 +00:00
"As the bus approaches, the gate opens and you drive through.")
1993-07-13 20:44:02 +00:00
(dun-remove-obj-from-room main-maple-intersection obj-bus)
2003-02-04 13:24:35 +00:00
(dun-replace dun-room-objects museum-entrance
1993-07-13 20:44:02 +00:00
(append (nth museum-entrance dun-room-objects)
1993-07-08 21:10:59 +00:00
(list obj-bus)))
1993-07-13 20:44:02 +00:00
(setq dun-current-room museum-entrance)))))
(if (= dun-current-room cave-entrance)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"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")
1993-07-13 20:44:02 +00:00
(setq dun-current-room misty-room)))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-long (args)
(setq dun-mode "long"))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-turn (obj)
1993-07-08 21:10:59 +00:00
(let (objnum direction)
1993-07-13 20:44:02 +00:00
(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.")
1993-07-08 21:10:59 +00:00
(if (not (= objnum obj-dial))
1993-07-13 20:44:02 +00:00
(dun-mprincl "You can't turn that.")
(setq direction (dun-firstword (cdr obj)))
2003-02-04 13:24:35 +00:00
(if (or (not direction)
1993-07-08 21:10:59 +00:00
(not (or (string= direction "clockwise")
(string= direction "counterclockwise"))))
1993-07-13 20:44:02 +00:00
(dun-mprincl "You must indicate clockwise or counterclockwise.")
1993-07-08 21:10:59 +00:00
(if (string= direction "clockwise")
1993-07-13 20:44:02 +00:00
(setq dun-sauna-level (+ dun-sauna-level 1))
(setq dun-sauna-level (- dun-sauna-level 1)))
2003-02-04 13:24:35 +00:00
1993-07-13 20:44:02 +00:00
(if (< dun-sauna-level 0)
1993-07-08 21:10:59 +00:00
(progn
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"The dial will not turn further in that direction.")
1993-07-13 20:44:02 +00:00
(setq dun-sauna-level 0))
(dun-sauna-heat))))))))
(defun dun-sauna-heat ()
(if (= dun-sauna-level 0)
2003-02-04 13:24:35 +00:00
(dun-mprincl
1996-01-04 23:13:09 +00:00
"The temperature has returned to normal room temperature."))
1993-07-13 20:44:02 +00:00
(if (= dun-sauna-level 1)
(dun-mprincl "It is now luke warm in here. You are perspiring."))
1993-07-13 20:44:02 +00:00
(if (= dun-sauna-level 2)
(dun-mprincl "It is pretty hot in here. It is still very comfortable."))
(if (= dun-sauna-level 3)
1993-07-08 21:10:59 +00:00
(progn
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"It is now very hot. There is something very refreshing about this.")
2003-02-04 13:24:35 +00:00
(if (or (member obj-rms dun-inventory)
1993-07-13 20:44:02 +00:00
(member obj-rms (nth dun-current-room dun-room-objects)))
1993-07-08 21:10:59 +00:00
(progn
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"You notice the wax on your statuette beginning to melt, until it completely
melts off. You are left with a beautiful diamond!")
1993-07-13 20:44:02 +00:00
(if (member obj-rms dun-inventory)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-remove-obj-from-inven obj-rms)
2003-02-04 13:24:35 +00:00
(setq dun-inventory (append dun-inventory
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(list obj-diamond))))))
1993-07-13 20:44:02 +00:00
(if (or (member obj-floppy dun-inventory)
(member obj-floppy (nth dun-current-room dun-room-objects)))
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl
2003-02-04 13:24:35 +00:00
"You notice your floppy disk beginning to melt. As you grab for it, the
1993-07-08 21:10:59 +00:00
disk bursts into flames, and disintegrates.")
1993-07-13 20:44:02 +00:00
(if (member obj-floppy dun-inventory)
(dun-remove-obj-from-inven obj-floppy)
(dun-remove-obj-from-room dun-current-room obj-floppy))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(if (= dun-sauna-level 4)
1993-07-08 21:10:59 +00:00
(progn
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"As the dial clicks into place, you immediately burst into flames.")
1993-07-13 20:44:02 +00:00
(dun-die "burning"))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-press (obj)
1993-07-08 21:10:59 +00:00
(let (objnum)
1993-07-13 20:44:02 +00:00
(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.")
1993-07-08 21:10:59 +00:00
(if (not (member objnum (list obj-button obj-switch)))
(progn
1993-07-13 20:44:02 +00:00
(dun-mprinc "You can't ")
(dun-mprinc (car line-list))
(dun-mprincl " that."))
1993-07-08 21:10:59 +00:00
(if (= objnum obj-button)
1993-07-13 20:44:02 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"As you press the button, you notice a passageway open up, but
as you release it, the passageway closes."))
(if (= objnum obj-switch)
1993-07-13 20:44:02 +00:00
(if dun-black
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
(progn
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"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.")
1993-07-13 20:44:02 +00:00
(dun-die "drowning"))
(if (= dun-current-room lakefront-north)
(setq dun-current-room lakefront-south)
(setq dun-current-room lakefront-north)))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-score (args)
(if (not dun-endgame)
1993-07-08 21:10:59 +00:00
(let (total)
1993-07-13 20:44:02 +00:00
(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)
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"\n\nCongratulations. You have won. The wizard password is 'moby'"))))
1993-07-13 20:44:02 +00:00
(defun dun-help (args)
(dun-mprincl
"Welcome to dunnet (2.01), by Ron Schnell (ronnie@driver-aces.com).
1993-07-08 21:10:59 +00:00
Here is some useful information (read carefully because there are one
or more clues in here):
- If you have a key that can open a door, you do not need to explicitly
open it. You may just use 'in' or walk in the direction of the door.
- If you have a lamp, it is always lit.
- You will not get any points until you manage to get treasures to a certain
place. Simply finding the treasures is not good enough. There is more
than one way to get a treasure to the special place. It is also
important that the objects get to the special place *unharmed* and
*untarnished*. You can tell if you have successfully transported the
object by looking at your score, as it changes immediately. Note that
an object can become harmed even after you have received points for it.
If this happens, your score will decrease, and in many cases you can never
get credit for it again.
- You can save your game with the 'save' command, and use restore it
with the 'restore' command.
- There are no limits on lengths of object names.
- Directions are: north,south,east,west,northeast,southeast,northwest,
southwest,up,down,in,out.
- These can be abbreviated: n,s,e,w,ne,se,nw,sw,u,d,in,out.
- If you go down a hole in the floor without an aid such as a ladder,
you probably won't be able to get back up the way you came, if at all.
- To run this game in batch mode (no emacs window), use:
1993-07-13 20:44:02 +00:00
emacs -batch -l dunnet
NOTE: This game *should* be run in batch mode!
1993-07-08 21:10:59 +00:00
If you have questions or comments, please contact ronnie@driver-aces.com
My home page is http://www.driver-aces.com/ronnie.html
"))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(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)
1993-07-13 20:44:02 +00:00
(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)
2003-02-04 13:24:35 +00:00
(dun-replace dun-room-objects urinal (append
1993-07-13 20:44:02 +00:00
(nth urinal dun-room-objects)
(list obj-URINE))))))
(defun dun-sleep (args)
(if (not (= dun-current-room bedroom))
(dun-mprincl
1993-07-08 21:10:59 +00:00
"You try to go to sleep while standing up here, but can't seem to do it.")
1993-07-13 20:44:02 +00:00
(setq dun-gottago t)
(dun-mprincl
1993-07-08 21:10:59 +00:00
"As soon as you start to doze off you begin dreaming. You see images of
workers digging caves, slaving in the humid heat. Then you see yourself
as one of these workers. While no one is looking, you leave the group
and walk into a room. The room is bare except for a horseshoe
shaped piece of stone in the center. You see yourself digging a hole in
the ground, then putting some kind of treasure in it, and filling the hole
with dirt again. After this, you immediately wake up.")))
1993-07-13 20:44:02 +00:00
(defun dun-break (obj)
1993-07-08 21:10:59 +00:00
(let (objnum)
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"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.")
1993-07-13 20:44:02 +00:00
(dun-die "an axe"))
(if (not (or (member objnum (nth dun-current-room dun-room-objects))
2003-02-04 13:24:35 +00:00
(member objnum
1993-07-13 20:44:02 +00:00
(nth dun-current-room dun-room-silents))))
(dun-mprincl "I don't see that here.")
1993-07-08 21:10:59 +00:00
(if (= objnum obj-cable)
(progn
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"As you break the ethernet cable, everything starts to blur. You collapse
for a moment, then straighten yourself up.
")
1993-07-13 20:44:02 +00:00
(dun-replace dun-room-objects gamma-computing-center
2003-02-04 13:24:35 +00:00
(append
1993-07-13 20:44:02 +00:00
(nth gamma-computing-center dun-room-objects)
dun-inventory))
(if (member obj-key dun-inventory)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(setq dun-inventory (list obj-key))
2003-02-04 13:24:35 +00:00
(dun-remove-obj-from-room
1993-07-13 20:44:02 +00:00
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))
1993-07-08 21:10:59 +00:00
(if (< objnum 0)
(progn
1993-07-13 20:44:02 +00:00
(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)))))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(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.")))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-superb (args)
(setq dun-mode 'dun-superb))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-reg-score ()
1993-07-08 21:10:59 +00:00
(let (total)
(setq total 0)
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
(setq total 0)) total))
1993-07-13 20:44:02 +00:00
(defun dun-endgame-score ()
1993-07-08 21:10:59 +00:00
(let (total)
(setq total 0)
1993-07-13 20:44:02 +00:00
(dolist (x (nth endgame-treasure-room dun-room-objects))
(setq total (+ total (nth x dun-object-pts)))) total))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-answer (args)
(if (not dun-correct-answer)
(dun-mprincl "I don't believe anyone asked you anything.")
1993-07-08 21:10:59 +00:00
(setq args (car args))
(if (not args)
1993-07-13 20:44:02 +00:00
(dun-mprincl "You must give the answer on the same line.")
(if (dun-members args dun-correct-answer)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl "Your question is:")
(dun-mprincl "No more questions, just do 'answer foo'.")
(setq dun-correct-answer '("foo")))
1993-07-08 21:10:59 +00:00
(let (which i newques)
(setq i 0)
(setq newques nil)
(setq which (random (length dun-endgame-questions)))
1993-07-13 20:44:02 +00:00
(dun-mprincl "Your question is:")
2003-02-04 13:24:35 +00:00
(dun-mprincl (setq dun-endgame-question (car
(nth which
1993-07-13 20:44:02 +00:00
dun-endgame-questions))))
(setq dun-correct-answer (cdr (nth which dun-endgame-questions)))
1993-07-08 21:10:59 +00:00
(while (< i which)
1993-07-13 20:44:02 +00:00
(setq newques (append newques (list (nth i dun-endgame-questions))))
1993-07-08 21:10:59 +00:00
(setq i (1+ i)))
(setq i (1+ which))
1993-07-13 20:44:02 +00:00
(while (< i (length dun-endgame-questions))
(setq newques (append newques (list (nth i dun-endgame-questions))))
1993-07-08 21:10:59 +00:00
(setq i (1+ i)))
1993-07-13 20:44:02 +00:00
(setq dun-endgame-questions newques))))
1993-07-08 21:10:59 +00:00
(defun dun-power (args)
1993-07-13 20:44:02 +00:00
(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))))
1993-07-08 21:10:59 +00:00
(defun dun-feed (args)
(let (objnum)
1993-07-13 20:44:02 +00:00
(when (setq objnum (dun-objnum-from-args-std args))
2003-02-04 13:24:35 +00:00
(if (and (= objnum obj-bear)
1993-07-13 20:44:02 +00:00
(member obj-bear (nth dun-current-room dun-room-objects)))
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(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."))))))
1993-07-08 21:10:59 +00:00
;;;;
;;;; This section defines various utility functions used
;;;; by dunnet.
;;;;
;;; Function which takes a verb and a list of other words. Calls proper
;;; function associated with the verb, and passes along the other words.
1993-07-13 20:44:02 +00:00
(defun dun-doverb (dun-ignore dun-verblist verb rest)
1993-07-08 21:10:59 +00:00
(if (not verb)
nil
1993-07-13 20:44:02 +00:00
(if (member (intern verb) dun-ignore)
1993-07-08 21:10:59 +00:00
(if (not (car rest)) -1
1993-07-13 20:44:02 +00:00
(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)))))))
1993-07-08 21:10:59 +00:00
;;; Function to take a string and change it into a list of lowercase words.
1993-07-13 20:44:02 +00:00
(defun dun-listify-string (strin)
1993-07-08 21:10:59 +00:00
(let (pos ret-list end-pos)
(setq pos 0)
(setq ret-list nil)
(while (setq end-pos (string-match "[ ,:;]" (substring strin pos)))
(setq end-pos (+ end-pos pos))
(if (not (= end-pos pos))
2003-02-04 13:24:35 +00:00
(setq ret-list (append ret-list (list
1993-07-08 21:10:59 +00:00
(downcase
(substring strin pos end-pos))))))
(setq pos (+ end-pos 1))) ret-list))
1993-07-13 20:44:02 +00:00
(defun dun-listify-string2 (strin)
1993-07-08 21:10:59 +00:00
(let (pos ret-list end-pos)
(setq pos 0)
(setq ret-list nil)
(while (setq end-pos (string-match " " (substring strin pos)))
(setq end-pos (+ end-pos pos))
(if (not (= end-pos pos))
2003-02-04 13:24:35 +00:00
(setq ret-list (append ret-list (list
1993-07-08 21:10:59 +00:00
(downcase
(substring strin pos end-pos))))))
(setq pos (+ end-pos 1))) ret-list))
1993-07-13 20:44:02 +00:00
(defun dun-replace (list n number)
1993-07-08 21:10:59 +00:00
(rplaca (nthcdr n list) number))
;;; Get the first non-ignored word from a list.
1993-07-13 20:44:02 +00:00
(defun dun-firstword (list)
1993-07-08 21:10:59 +00:00
(if (not (car list))
nil
1993-07-13 20:44:02 +00:00
(while (and list (member (intern (car list)) dun-ignore))
1993-07-08 21:10:59 +00:00
(setq list (cdr list)))
(car list)))
1993-07-13 20:44:02 +00:00
(defun dun-firstwordl (list)
1993-07-08 21:10:59 +00:00
(if (not (car list))
nil
1993-07-13 20:44:02 +00:00
(while (and list (member (intern (car list)) dun-ignore))
1993-07-08 21:10:59 +00:00
(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.
1993-07-13 20:44:02 +00:00
(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)))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(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)))
1993-07-08 21:10:59 +00:00
;;; Read a line, in window mode
1993-07-13 20:44:02 +00:00
(defun dun-read-line ()
1993-07-08 21:10:59 +00:00
(let (line)
(setq line (read-string ""))
1993-07-13 20:44:02 +00:00
(dun-mprinc line) line))
1993-07-08 21:10:59 +00:00
;;; Insert something into the window buffer
1993-07-13 20:44:02 +00:00
(defun dun-minsert (string)
1993-07-08 21:10:59 +00:00
(if (stringp string)
(insert string)
(insert (prin1-to-string string))))
;;; Print something out, in window mode
1993-07-13 20:44:02 +00:00
(defun dun-mprinc (string)
1993-07-08 21:10:59 +00:00
(if (stringp string)
(insert string)
(insert (prin1-to-string string))))
;;; In window mode, keep screen from jumping by keeping last line at
;;; the bottom of the screen.
1993-07-13 20:44:02 +00:00
(defun dun-fix-screen ()
1993-07-08 21:10:59 +00:00
(interactive)
(forward-line (- 0 (- (window-height) 2 )))
(set-window-start (selected-window) (point))
(end-of-buffer))
;;; Insert something into the buffer, followed by newline.
1993-07-13 20:44:02 +00:00
(defun dun-minsertl (string)
(dun-minsert string)
(dun-minsert "\n"))
1993-07-08 21:10:59 +00:00
;;; Print something, followed by a newline.
1993-07-13 20:44:02 +00:00
(defun dun-mprincl (string)
(dun-mprinc string)
(dun-mprinc "\n"))
1993-07-08 21:10:59 +00:00
;;; Function which will get an object number given the list of
;;; words in the command, except for the verb.
1993-07-13 20:44:02 +00:00
(defun dun-objnum-from-args (obj)
1993-07-08 21:10:59 +00:00
(let (objnum)
1993-07-13 20:44:02 +00:00
(setq obj (dun-firstword obj))
1993-07-08 21:10:59 +00:00
(if (not obj)
obj-special
1993-07-13 20:44:02 +00:00
(setq objnum (cdr (assq (intern obj) dun-objnames))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-objnum-from-args-std (obj)
1993-07-08 21:10:59 +00:00
(let (result)
1993-07-13 20:44:02 +00:00
(if (eq (setq result (dun-objnum-from-args obj)) obj-special)
(dun-mprincl "You must supply an object."))
1993-07-08 21:10:59 +00:00
(if (eq result nil)
1993-07-13 20:44:02 +00:00
(dun-mprincl "I don't know what that is."))
1993-07-08 21:10:59 +00:00
(if (eq result obj-special)
nil
result)))
;;; Take a short room description, and change spaces and slashes to dashes.
1993-07-13 20:44:02 +00:00
(defun dun-space-to-hyphen (string)
1993-07-08 21:10:59 +00:00
(let (space)
(if (setq space (string-match "[ /]" string))
(progn
(setq string (concat (substring string 0 space) "-"
(substring string (1+ space))))
1993-07-13 20:44:02 +00:00
(dun-space-to-hyphen string))
1993-07-08 21:10:59 +00:00
string)))
;;; Given a unix style pathname, build a list of path components (recursive)
1993-07-13 20:44:02 +00:00
(defun dun-get-path (dirstring startlist)
1993-07-08 21:10:59 +00:00
(let (slash pos)
(if (= (length dirstring) 0)
startlist
(if (string= (substring dirstring 0 1) "/")
1993-07-13 20:44:02 +00:00
(dun-get-path (substring dirstring 1) (append startlist (list "/")))
1993-07-08 21:10:59 +00:00
(if (not (setq slash (string-match "/" dirstring)))
(append startlist (list dirstring))
1993-07-13 20:44:02 +00:00
(dun-get-path (substring dirstring (1+ slash))
1993-07-08 21:10:59 +00:00
(append startlist
(list (substring dirstring 0 slash)))))))))
;;; Is a string a member of a string list?
1993-07-13 20:44:02 +00:00
(defun dun-members (string string-list)
1993-07-08 21:10:59 +00:00
(let (found)
(setq found nil)
(dolist (x string-list)
(if (string= x string)
(setq found t))) found))
;;; Function to put objects in the treasure room. Also prints current
;;; score to let user know he has scored.
1993-07-13 20:44:02 +00:00
(defun dun-put-objs-in-treas (objlist)
1993-07-08 21:10:59 +00:00
(let (oscore newscore)
1993-07-13 20:44:02 +00:00
(setq oscore (dun-reg-score))
(dun-replace dun-room-objects 0 (append (nth 0 dun-room-objects) objlist))
(setq newscore (dun-reg-score))
1993-07-08 21:10:59 +00:00
(if (not (= oscore newscore))
1993-07-13 20:44:02 +00:00
(dun-score nil))))
1993-07-08 21:10:59 +00:00
;;; Load an encrypted file, and eval it.
1993-07-13 20:44:02 +00:00
(defun dun-load-d (filename)
1993-07-08 21:10:59 +00:00
(let (old-buffer result)
(setq result t)
(setq old-buffer (current-buffer))
(switch-to-buffer (get-buffer-create "*loadc*"))
(erase-buffer)
(condition-case nil
(insert-file-contents filename)
(error (setq result nil)))
(unless (not result)
(condition-case nil
(dun-rot13)
(error (yank)))
(eval-current-buffer)
(kill-buffer (current-buffer)))
(switch-to-buffer old-buffer)
1993-07-08 21:10:59 +00:00
result))
;;; Functions to remove an object either from a room, or from inventory.
1993-07-13 20:44:02 +00:00
(defun dun-remove-obj-from-room (room objnum)
1993-07-08 21:10:59 +00:00
(let (newroom)
(setq newroom nil)
1993-07-13 20:44:02 +00:00
(dolist (x (nth room dun-room-objects))
1993-07-08 21:10:59 +00:00
(if (not (= x objnum))
(setq newroom (append newroom (list x)))))
1993-07-13 20:44:02 +00:00
(rplaca (nthcdr room dun-room-objects) newroom)))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-remove-obj-from-inven (objnum)
1993-07-08 21:10:59 +00:00
(let (new-inven)
(setq new-inven nil)
1993-07-13 20:44:02 +00:00
(dolist (x dun-inventory)
1993-07-08 21:10:59 +00:00
(if (not (= x objnum))
(setq new-inven (append new-inven (list x)))))
1993-07-13 20:44:02 +00:00
(setq dun-inventory new-inven)))
1993-07-08 21:10:59 +00:00
(let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper)
1993-07-13 20:44:02 +00:00
(setq dun-translate-table (make-vector 256 0))
1993-07-08 21:10:59 +00:00
(while (< i 256)
1993-07-13 20:44:02 +00:00
(aset dun-translate-table i i)
1993-07-08 21:10:59 +00:00
(setq i (1+ i)))
(setq lower (concat lower lower))
(setq upper (upcase lower))
(setq i 0)
(while (< i 26)
1993-07-13 20:44:02 +00:00
(aset dun-translate-table (+ ?a i) (aref lower (+ i 13)))
(aset dun-translate-table (+ ?A i) (aref upper (+ i 13)))
1993-07-08 21:10:59 +00:00
(setq i (1+ i))))
2003-02-04 13:24:35 +00:00
1993-07-08 21:10:59 +00:00
(defun dun-rot13 ()
(let (str len (i 0))
(setq str (buffer-substring (point-min) (point-max)))
(setq len (length str))
(while (< i len)
1993-07-13 20:44:02 +00:00
(aset str i (aref dun-translate-table (aref str i)))
1993-07-08 21:10:59 +00:00
(setq i (1+ i)))
(erase-buffer)
(insert str)))
;;;;
;;;; This section defines the globals that are used in dunnet.
;;;;
;;;; IMPORTANT
;;;; All globals which can change must be saved from 'save-game. Add
;;;; all new globals to bottom of file.
1993-07-13 20:44:02 +00:00
(setq dun-visited '(27))
(setq dun-current-room 1)
(setq dun-exitf nil)
(setq dun-badcd nil)
1993-07-08 21:10:59 +00:00
(defvar dungeon-mode-map nil)
(setq dungeon-mode-map (make-sparse-keymap))
1993-07-13 20:44:02 +00:00
(define-key dungeon-mode-map "\r" 'dun-parse)
1993-07-08 21:10:59 +00:00
(defvar dungeon-batch-map (make-keymap))
(if (string= (substring emacs-version 0 2) "18")
(let (n)
(setq n 32)
(while (< 0 (setq n (- n 1)))
(aset dungeon-batch-map n 'dungeon-nil)))
(let (n)
(setq n 32)
(while (< 0 (setq n (- n 1)))
(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)
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(setq dungeon-mode 'dungeon)
2003-02-04 13:24:35 +00:00
(setq dun-unix-verbs '((ls . dun-ls) (ftp . dun-ftp) (echo . dun-echo)
1993-07-13 20:44:02 +00:00
(exit . dun-uexit) (cd . dun-cd) (pwd . dun-pwd)
(rlogin . dun-rlogin) (uncompress . dun-uncompress)
(cat . dun-cat) (zippy . dun-zippy)))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(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)))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(setq dun-batch-mode nil)
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(setq dun-cdpath "/usr/toukmond")
(setq dun-cdroom -10)
(setq dun-uncompressed nil)
(setq dun-ethernet t)
2003-02-04 13:24:35 +00:00
(setq dun-restricted
'(dun-room-objects dungeon-map dun-rooms
1993-07-13 20:44:02 +00:00
dun-room-silents dun-combination))
(setq dun-ftptype 'ascii)
(setq dun-endgame nil)
(setq dun-gottago t)
(setq dun-black nil)
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(setq dun-rooms '(
1993-07-08 21:10:59 +00:00
(
"You are in the treasure room. A door leads out to the north."
"Treasure room"
)
(
"You are at a dead end of a dirt road. The road goes to the east.
In the distance you can see that it will eventually fork off. The
trees here are very tall royal palms, and they are spaced equidistant
from each other."
"Dead end"
)
(
"You are on the continuation of a dirt road. There are more trees on
both sides of you. The road continues to the east and west."
"E/W Dirt road"
)
(
"You are at a fork of two passages, one to the northeast, and one to the
southeast. The ground here seems very soft. You can also go back west."
"Fork"
)
(
"You are on a northeast/southwest road."
"NE/SW road"
)
(
"You are at the end of the road. There is a building in front of you
to the northeast, and the road leads back to the southwest."
"Building front"
)
(
"You are on a southeast/northwest road."
"SE/NW road"
)
(
"You are standing at the end of a road. A passage leads back to the
northwest."
"Bear hangout"
)
(
"You are in the hallway of an old building. There are rooms to the east
and west, and doors leading out to the north and south."
"Old Building hallway"
)
(
"You are in a mailroom. There are many bins where the mail is usually
kept. The exit is to the west."
"Mailroom"
)
(
"You are in a computer room. It seems like most of the equipment has
been removed. There is a VAX 11/780 in front of you, however, with
one of the cabinets wide open. A sign on the front of the machine
says: This VAX is named 'pokey'. To type on the console, use the
'type' command. The exit is to the east."
"Computer room"
)
(
"You are in a meadow in the back of an old building. A small path leads
to the west, and a door leads to the south."
"Meadow"
)
(
"You are in a round, stone room with a door to the east. There
is a sign on the wall that reads: 'receiving room'."
"Receiving room"
)
(
"You are at the south end of a hallway that leads to the north. There
are rooms to the east and west."
"Northbound Hallway"
)
(
"You are in a sauna. There is nothing in the room except for a dial
on the wall. A door leads out to west."
"Sauna"
)
(
"You are at the end of a north/south hallway. You can go back to the south,
or off to a room to the east."
"End of N/S Hallway"
)
(
"You are in an old weight room. All of the equipment is either destroyed
or completely broken. There is a door out to the west, and there is a ladder
leading down a hole in the floor."
"Weight room" ;16
)
(
"You are in a maze of twisty little passages, all alike.
There is a button on the ground here."
"Maze button room"
)
(
"You are in a maze of little twisty passages, all alike."
"Maze"
)
(
"You are in a maze of thirsty little passages, all alike."
"Maze" ;19
)
(
"You are in a maze of twenty little passages, all alike."
"Maze"
)
(
"You are in a daze of twisty little passages, all alike."
"Maze" ;21
)
(
"You are in a maze of twisty little cabbages, all alike."
"Maze" ;22
)
(
"You are in a reception area for a health and fitness center. The place
appears to have been recently ransacked, and nothing is left. There is
a door out to the south, and a crawlspace to the southeast."
"Reception area"
)
(
"You are outside a large building to the north which used to be a health
and fitness center. A road leads to the south."
"Health Club front"
)
(
"You are at the north side of a lake. On the other side you can see
a road which leads to a cave. The water appears very deep."
"Lakefront North"
)
(
"You are at the south side of a lake. A road goes to the south."
"Lakefront South"
)
(
"You are in a well-hidden area off to the side of a road. Back to the
northeast through the brush you can see the bear hangout."
"Hidden area"
)
(
"The entrance to a cave is to the south. To the north, a road leads
towards a deep lake. On the ground nearby there is a chute, with a sign
that says 'put treasures here for points'."
"Cave Entrance" ;28
)
(
"You are in a misty, humid room carved into a mountain.
To the north is the remains of a rockslide. To the east, a small
passage leads away into the darkness." ;29
"Misty Room"
)
(
"You are in an east/west passageway. The walls here are made of
multicolored rock and are quite beautiful."
"Cave E/W passage" ;30
)
(
"You are at the junction of two passages. One goes north/south, and
the other goes west."
"N/S/W Junction" ;31
)
(
"You are at the north end of a north/south passageway. There are stairs
leading down from here. There is also a door leading west."
"North end of cave passage" ;32
)
(
"You are at the south end of a north/south passageway. There is a hole
in the floor here, into which you could probably fit."
"South end of cave passage" ;33
)
(
"You are in what appears to be a worker's bedroom. There is a queen-
sized bed in the middle of the room, and a painting hanging on the
wall. A door leads to another room to the south, and stairways
lead up and down."
"Bedroom" ;34
)
(
"You are in a bathroom built for workers in the cave. There is a
urinal hanging on the wall, and some exposed pipes on the opposite
wall where a sink used to be. To the north is a bedroom."
"Bathroom" ;35
)
(
"This is a marker for the urinal. User will not see this, but it
is a room that can contain objects."
"Urinal" ;36
)
(
"You are at the northeast end of a northeast/southwest passageway.
Stairs lead up out of sight."
"NE end of NE/SW cave passage" ;37
1993-07-08 21:10:59 +00:00
)
(
"You are at the junction of northeast/southwest and east/west passages."
"NE/SW-E/W junction" ;38
1993-07-08 21:10:59 +00:00
)
(
"You are at the southwest end of a northeast/southwest passageway."
"SW end of NE/SW cave passage" ;39
1993-07-08 21:10:59 +00:00
)
(
"You are at the east end of an E/W passage. There are stairs leading up
1993-07-08 21:10:59 +00:00
to a room above."
"East end of E/W cave passage" ;40
1993-07-08 21:10:59 +00:00
)
(
"You are at the west end of an E/W passage. There is a hole on the ground
1993-07-08 21:10:59 +00:00
which leads down out of sight."
"West end of E/W cave passage" ;41
1993-07-08 21:10:59 +00:00
)
(
"You are in a room which is bare, except for a horseshoe shaped boulder
in the center. Stairs lead down from here." ;42
"Horseshoe boulder room"
)
(
"You are in a room which is completely empty. Doors lead out to the north
and east."
"Empty room" ;43
)
(
"You are in an empty room. Interestingly enough, the stones in this
room are painted blue. Doors lead out to the east and south." ;44
"Blue room"
)
(
"You are in an empty room. Interestingly enough, the stones in this
room are painted yellow. Doors lead out to the south and west." ;45
"Yellow room"
)
(
"You are in an empty room. Interestingly enough, the stones in this room
are painted red. Doors lead out to the west and north."
"Red room" ;46
)
(
"You are in the middle of a long north/south hallway." ;47
"Long n/s hallway"
)
(
"You are 3/4 of the way towards the north end of a long north/south hallway."
"3/4 north" ;48
)
(
"You are at the north end of a long north/south hallway. There are stairs
leading upwards."
"North end of long hallway" ;49
)
(
"You are 3/4 of the way towards the south end of a long north/south hallway."
"3/4 south" ;50
)
(
"You are at the south end of a long north/south hallway. There is a hole
to the south."
"South end of long hallway" ;51
)
(
"You are at a landing in a stairwell which continues up and down."
"Stair landing" ;52
)
(
"You are at the continuation of an up/down staircase."
"Up/down staircase" ;53
)
(
"You are at the top of a staircase leading down. A crawlway leads off
to the northeast."
"Top of staircase." ;54
)
(
"You are in a crawlway that leads northeast or southwest."
"NE crawlway" ;55
1993-07-08 21:10:59 +00:00
)
(
"You are in a small crawlspace. There is a hole in the ground here, and
a small passage back to the southwest."
"Small crawlspace" ;56
)
(
"You are in the Gamma Computing Center. An IBM 3090/600s is whirring
away in here. There is an ethernet cable coming out of one of the units,
and going through the ceiling. There is no console here on which you
could type."
"Gamma computing center" ;57
)
(
"You are near the remains of a post office. There is a mail drop on the
face of the building, but you cannot see where it leads. A path leads
back to the east, and a road leads to the north."
"Post office" ;58
)
(
"You are at the intersection of Main Street and Maple Ave. Main street
runs north and south, and Maple Ave runs east off into the distance.
If you look north and east you can see many intersections, but all of
the buildings that used to stand here are gone. Nothing remains except
street signs.
There is a road to the northwest leading to a gate that guards a building."
"Main-Maple intersection" ;59
)
(
"You are at the intersection of Main Street and the west end of Oaktree Ave."
"Main-Oaktree intersection" ;60
)
(
"You are at the intersection of Main Street and the west end of Vermont Ave."
"Main-Vermont intersection" ;61
)
(
"You are at the north end of Main Street at the west end of Sycamore Ave." ;62
"Main-Sycamore intersection"
)
(
"You are at the south end of First Street at Maple Ave." ;63
"First-Maple intersection"
)
(
"You are at the intersection of First Street and Oaktree Ave." ;64
"First-Oaktree intersection"
)
(
"You are at the intersection of First Street and Vermont Ave." ;65
"First-Vermont intersection"
)
(
"You are at the north end of First Street at Sycamore Ave." ;66
"First-Sycamore intersection"
)
(
"You are at the south end of Second Street at Maple Ave." ;67
"Second-Maple intersection"
)
(
"You are at the intersection of Second Street and Oaktree Ave." ;68
"Second-Oaktree intersection"
)
(
"You are at the intersection of Second Street and Vermont Ave." ;69
"Second-Vermont intersection"
)
(
"You are at the north end of Second Street at Sycamore Ave." ;70
"Second-Sycamore intersection"
)
(
"You are at the south end of Third Street at Maple Ave." ;71
"Third-Maple intersection"
)
(
"You are at the intersection of Third Street and Oaktree Ave." ;72
"Third-Oaktree intersection"
)
(
"You are at the intersection of Third Street and Vermont Ave." ;73
"Third-Vermont intersection"
)
(
"You are at the north end of Third Street at Sycamore Ave." ;74
"Third-Sycamore intersection"
)
(
"You are at the south end of Fourth Street at Maple Ave." ;75
"Fourth-Maple intersection"
)
(
"You are at the intersection of Fourth Street and Oaktree Ave." ;76
"Fourth-Oaktree intersection"
)
(
"You are at the intersection of Fourth Street and Vermont Ave." ;77
"Fourth-Vermont intersection"
)
(
"You are at the north end of Fourth Street at Sycamore Ave." ;78
"Fourth-Sycamore intersection"
)
(
"You are at the south end of Fifth Street at the east end of Maple Ave." ;79
"Fifth-Maple intersection"
)
(
"You are at the intersection of Fifth Street and the east end of Oaktree Ave.
There is a cliff off to the east."
"Fifth-Oaktree intersection" ;80
)
(
"You are at the intersection of Fifth Street and the east end of Vermont Ave."
"Fifth-Vermont intersection" ;81
)
(
"You are at the north end of Fifth Street and the east end of Sycamore Ave."
"Fifth-Sycamore intersection" ;82
)
(
"You are in front of the Museum of Natural History. A door leads into
the building to the north, and a road leads to the southeast."
"Museum entrance" ;83
)
(
"You are in the main lobby for the Museum of Natural History. In the center
of the room is the huge skeleton of a dinosaur. Doors lead out to the
2003-02-04 13:24:35 +00:00
south and east."
1993-07-08 21:10:59 +00:00
"Museum lobby" ;84
)
(
"You are in the geological display. All of the objects that used to
2003-02-04 13:24:35 +00:00
be on display are missing. There are rooms to the east, west, and
1993-07-08 21:10:59 +00:00
north."
"Geological display" ;85
)
(
"You are in the marine life area. The room is filled with fish tanks,
which are filled with dead fish that have apparently died due to
starvation. Doors lead out to the south and east."
"Marine life area" ;86
)
(
"You are in some sort of maintenance room for the museum. There is a
switch on the wall labeled 'BL'. There are doors to the west and north."
"Maintenance room" ;87
)
(
"You are in a classroom where school children were taught about natural
history. On the blackboard is written, 'No children allowed downstairs.'
There is a door to the east with an 'exit' sign on it. There is another
door to the west."
"Classroom" ;88
)
(
"You are at the Vermont St. subway station. A train is sitting here waiting."
"Vermont station" ;89
)
(
"You are at the Museum subway stop. A passage leads off to the north."
"Museum station" ;90
)
(
"You are in a north/south tunnel."
"N/S tunnel" ;91
)
(
"You are at the north end of a north/south tunnel. Stairs lead up and
down from here. There is a garbage disposal here."
"North end of N/S tunnel" ;92
1993-07-08 21:10:59 +00:00
)
(
"You are at the top of some stairs near the subway station. There is
a door to the west."
"Top of subway stairs" ;93
)
(
"You are at the bottom of some stairs near the subway station. There is
a room to the northeast."
"Bottom of subway stairs" ;94
)
(
"You are in another computer room. There is a computer in here larger
than you have ever seen. It has no manufacturers name on it, but it
does have a sign that says: This machine's name is 'endgame'. The
exit is to the southwest. There is no console here on which you could
type."
"Endgame computer room" ;95
)
(
"You are in a north/south hallway."
"Endgame N/S hallway" ;96
1993-07-08 21:10:59 +00:00
)
(
"You have reached a question room. You must answer a question correctly in
order to get by. Use the 'answer' command to answer the question."
"Question room 1" ;97
)
(
"You are in a north/south hallway."
"Endgame N/S hallway" ;98
1993-07-08 21:10:59 +00:00
)
(
"You are in a second question room."
"Question room 2" ;99
)
(
"You are in a north/south hallway."
"Endgame N/S hallway" ;100
1993-07-08 21:10:59 +00:00
)
(
"You are in a third question room."
"Question room 3" ;101
)
(
"You are in the endgame treasure room. A door leads out to the north, and
a hallway leads to the south."
"Endgame treasure room" ;102
)
(
"You are in the winner's room. A door leads back to the south."
"Winner's room" ;103
)
(
"You have reached a dead end. There is a PC on the floor here. Above
it is a sign that reads:
2003-02-04 13:24:35 +00:00
Type the 'reset' command to type on the PC.
1993-07-08 21:10:59 +00:00
A hole leads north."
"PC area" ;104
2003-02-04 13:24:35 +00:00
)
1993-07-08 21:10:59 +00:00
))
1993-07-13 20:44:02 +00:00
(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
1993-07-08 21:10:59 +00:00
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
77 78 79 80 81 82 83))
2003-02-04 13:24:35 +00:00
(setq dun-verblist '((die . dun-die) (ne . dun-ne) (north . dun-n)
1993-07-13 20:44:02 +00:00
(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)
2003-02-04 13:24:35 +00:00
(nw . dun-nw) (sw . dun-sw) (up . dun-up)
1993-07-13 20:44:02 +00:00
(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)
2003-02-04 13:24:35 +00:00
(examine . dun-examine) (describe . dun-examine)
1993-07-13 20:44:02 +00:00
(climb . dun-climb) (eat . dun-eat) (put . dun-put)
(type . dun-type) (insert . dun-put)
2003-02-04 13:24:35 +00:00
(score . dun-score) (help . dun-help) (quit . dun-quit)
(read . dun-examine) (verbose . dun-long)
(urinate . dun-piss) (piss . dun-piss)
2003-02-04 13:24:35 +00:00
(flush . dun-flush) (sleep . dun-sleep) (lie . dun-sleep)
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(defconst north 0)
(defconst south 1)
(defconst east 2)
(defconst west 3)
(defconst northeast 4)
(defconst southeast 5)
(defconst northwest 6)
(defconst southwest 7)
(defconst up 8)
(defconst down 9)
(defconst in 10)
(defconst out 11)
(setq dungeon-map '(
; no so ea we ne se nw sw up do in ot
( 96 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;0
( -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;1
( -1 -1 3 1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;2
( -1 -1 -1 2 4 6 -1 -1 -1 -1 -1 -1 ) ;3
( -1 -1 -1 -1 5 -1 -1 3 -1 -1 -1 -1 ) ;4
( -1 -1 -1 -1 255 -1 -1 4 -1 -1 255 -1 ) ;5
( -1 -1 -1 -1 -1 7 3 -1 -1 -1 -1 -1 ) ;6
( -1 -1 -1 -1 -1 255 6 27 -1 -1 -1 -1 ) ;7
( 255 5 9 10 -1 -1 -1 5 -1 -1 -1 5 ) ;8
( -1 -1 -1 8 -1 -1 -1 -1 -1 -1 -1 -1 ) ;9
( -1 -1 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;10
( -1 8 -1 58 -1 -1 -1 -1 -1 -1 -1 -1 ) ;11
( -1 -1 13 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;12
( 15 -1 14 12 -1 -1 -1 -1 -1 -1 -1 -1 ) ;13
( -1 -1 -1 13 -1 -1 -1 -1 -1 -1 -1 -1 ) ;14
( -1 13 16 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;15
( -1 -1 -1 15 -1 -1 -1 -1 -1 17 16 -1 ) ;16
( -1 -1 17 17 17 17 255 17 255 17 -1 -1 ) ;17
( 18 18 18 18 18 -1 18 18 19 18 -1 -1 ) ;18
( -1 18 18 19 19 20 19 19 -1 18 -1 -1 ) ;19
( -1 -1 -1 18 -1 -1 -1 -1 -1 21 -1 -1 ) ;20
( -1 -1 -1 -1 -1 20 22 -1 -1 -1 -1 -1 ) ;21
( 18 18 18 18 16 18 23 18 18 18 18 18 ) ;22
( -1 255 -1 -1 -1 19 -1 -1 -1 -1 -1 -1 ) ;23
( 23 25 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;24
( 24 255 -1 -1 -1 -1 -1 -1 -1 -1 255 -1 ) ;25
(255 28 -1 -1 -1 -1 -1 -1 -1 -1 255 -1 ) ;26
( -1 -1 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 ) ;27
( 26 255 -1 -1 -1 -1 -1 -1 -1 -1 255 -1 ) ;28
( -1 -1 30 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;29
( -1 -1 31 29 -1 -1 -1 -1 -1 -1 -1 -1 ) ;30
( 32 33 -1 30 -1 -1 -1 -1 -1 -1 -1 -1 ) ;31
( -1 31 -1 255 -1 -1 -1 -1 -1 34 -1 -1 ) ;32
( 31 -1 -1 -1 -1 -1 -1 -1 -1 35 -1 -1 ) ;33
( -1 35 -1 -1 -1 -1 -1 -1 32 37 -1 -1 ) ;34
( 34 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;35
( -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;36
( -1 -1 -1 -1 -1 -1 -1 38 34 -1 -1 -1 ) ;37
( -1 -1 40 41 37 -1 -1 39 -1 -1 -1 -1 ) ;38
( -1 -1 -1 -1 38 -1 -1 -1 -1 -1 -1 -1 ) ;39
( -1 -1 -1 38 -1 -1 -1 -1 42 -1 -1 -1 ) ;40
( -1 -1 38 -1 -1 -1 -1 -1 -1 43 -1 -1 ) ;41
( -1 -1 -1 -1 -1 -1 -1 -1 -1 40 -1 -1 ) ;42
( 44 -1 46 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;43
( -1 43 45 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;44
( -1 46 -1 44 -1 -1 -1 -1 -1 -1 -1 -1 ) ;45
( 45 -1 -1 43 -1 -1 -1 -1 -1 255 -1 -1 ) ;46
( 48 50 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;47
( 49 47 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;48
( -1 48 -1 -1 -1 -1 -1 -1 52 -1 -1 -1 ) ;49
( 47 51 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;50
( 50 104 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;51
( -1 -1 -1 -1 -1 -1 -1 -1 53 49 -1 -1 ) ;52
( -1 -1 -1 -1 -1 -1 -1 -1 54 52 -1 -1 ) ;53
( -1 -1 -1 -1 55 -1 -1 -1 -1 53 -1 -1 ) ;54
( -1 -1 -1 -1 56 -1 -1 54 -1 -1 -1 54 ) ;55
( -1 -1 -1 -1 -1 -1 -1 55 -1 31 -1 -1 ) ;56
( -1 -1 32 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;57
( 59 -1 11 -1 -1 -1 -1 -1 -1 -1 255 255) ;58
( 60 58 63 -1 -1 -1 255 -1 -1 -1 255 255) ;59
( 61 59 64 -1 -1 -1 -1 -1 -1 -1 255 255) ;60
( 62 60 65 -1 -1 -1 -1 -1 -1 -1 255 255) ;61
( -1 61 66 -1 -1 -1 -1 -1 -1 -1 255 255) ;62
( 64 -1 67 59 -1 -1 -1 -1 -1 -1 255 255) ;63
( 65 63 68 60 -1 -1 -1 -1 -1 -1 255 255) ;64
( 66 64 69 61 -1 -1 -1 -1 -1 -1 255 255) ;65
( -1 65 70 62 -1 -1 -1 -1 -1 -1 255 255) ;66
( 68 -1 71 63 -1 -1 -1 -1 -1 -1 255 255) ;67
( 69 67 72 64 -1 -1 -1 -1 -1 -1 255 255) ;68
( 70 68 73 65 -1 -1 -1 -1 -1 -1 255 255) ;69
( -1 69 74 66 -1 -1 -1 -1 -1 -1 255 255) ;70
( 72 -1 75 67 -1 -1 -1 -1 -1 -1 255 255) ;71
( 73 71 76 68 -1 -1 -1 -1 -1 -1 255 255) ;72
( 74 72 77 69 -1 -1 -1 -1 -1 -1 255 255) ;73
( -1 73 78 70 -1 -1 -1 -1 -1 -1 255 255) ;74
( 76 -1 79 71 -1 -1 -1 -1 -1 -1 255 255) ;75
( 77 75 80 72 -1 -1 -1 -1 -1 -1 255 255) ;76
( 78 76 81 73 -1 -1 -1 -1 -1 -1 255 255) ;77
( -1 77 82 74 -1 -1 -1 -1 -1 -1 255 255) ;78
( 80 -1 -1 75 -1 -1 -1 -1 -1 -1 255 255) ;79
( 81 79 255 76 -1 -1 -1 -1 -1 -1 255 255) ;80
( 82 80 -1 77 -1 -1 -1 -1 -1 -1 255 255) ;81
( -1 81 -1 78 -1 -1 -1 -1 -1 -1 255 255) ;82
( 84 -1 -1 -1 -1 59 -1 -1 -1 -1 255 255) ;83
( -1 83 85 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;84
( 86 -1 87 84 -1 -1 -1 -1 -1 -1 -1 -1 ) ;85
( -1 85 88 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;86
( 88 -1 -1 85 -1 -1 -1 -1 -1 -1 -1 -1 ) ;87
( -1 87 255 86 -1 -1 -1 -1 -1 -1 -1 -1 ) ;88
( -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 255 -1 ) ;89
( 91 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;90
( 92 90 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;91
( -1 91 -1 -1 -1 -1 -1 -1 93 94 -1 -1 ) ;92
( -1 -1 -1 88 -1 -1 -1 -1 -1 92 -1 -1 ) ;93
( -1 -1 -1 -1 95 -1 -1 -1 92 -1 -1 -1 ) ;94
( -1 -1 -1 -1 -1 -1 -1 94 -1 -1 -1 -1 ) ;95
( 97 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;96
( -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;97
( 99 97 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;98
( -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;99
( 101 99 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;100
( -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;101
( 103 101 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;102
( -1 102 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;103
( 51 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;104
)
; no so ea we ne se nw sw up do in ot
)
;;; How the user references *all* objects, permanent and regular.
1993-07-13 20:44:02 +00:00
(setq dun-objnames '(
2003-02-04 13:24:35 +00:00
(shovel . 0)
1993-07-08 21:10:59 +00:00
(lamp . 1)
(cpu . 2) (board . 2) (card . 2) (chip . 2)
2003-02-04 13:24:35 +00:00
(food . 3)
(key . 4)
(paper . 5) (slip . 5)
1993-07-08 21:10:59 +00:00
(rms . 6) (statue . 6) (statuette . 6) (stallman . 6)
(diamond . 7)
(weight . 8)
(life . 9) (preserver . 9)
2003-02-04 13:24:35 +00:00
(bracelet . 10) (emerald . 10)
1993-07-08 21:10:59 +00:00
(gold . 11)
(platinum . 12)
(towel . 13) (beach . 13)
(axe . 14)
(silver . 15)
(license . 16)
(coins . 17)
(egg . 18)
(jar . 19)
(bone . 20)
(acid . 21) (nitric . 21)
(glycerine . 22)
(ruby . 23)
2003-02-04 13:24:35 +00:00
(amethyst . 24)
1993-07-08 21:10:59 +00:00
(mona . 25)
2003-02-04 13:24:35 +00:00
(bill . 26)
1993-07-08 21:10:59 +00:00
(floppy . 27) (disk . 27)
2003-02-04 13:24:35 +00:00
1993-07-08 21:10:59 +00:00
(boulder . -1)
2003-02-04 13:24:35 +00:00
(tree . -2) (trees . -2) (palm . -2)
1993-07-08 21:10:59 +00:00
(bear . -3)
(bin . -4) (bins . -4)
2003-02-04 13:24:35 +00:00
(cabinet . -5) (computer . -5) (vax . -5) (ibm . -5)
1993-07-08 21:10:59 +00:00
(protoplasm . -6)
2003-02-04 13:24:35 +00:00
(dial . -7)
(button . -8)
(chute . -9)
1993-07-08 21:10:59 +00:00
(painting . -10)
(bed . -11)
(urinal . -12)
(URINE . -13)
2003-02-04 13:24:35 +00:00
(pipes . -14) (pipe . -14)
(box . -15) (slit . -15)
(cable . -16) (ethernet . -16)
1993-07-08 21:10:59 +00:00
(mail . -17) (drop . -17)
(bus . -18)
(gate . -19)
2003-02-04 13:24:35 +00:00
(cliff . -20)
1993-07-08 21:10:59 +00:00
(skeleton . -21) (dinosaur . -21)
(fish . -22)
(tanks . -23) (tank . -23)
1993-07-08 21:10:59 +00:00
(switch . -24)
(blackboard . -25)
(disposal . -26) (garbage . -26)
(ladder . -27)
2003-02-04 13:24:35 +00:00
(subway . -28) (train . -28)
(pc . -29) (drive . -29) (coconut . -30) (coconuts . -30)
(lake . -32) (water . -32)
1993-07-08 21:10:59 +00:00
))
1993-07-13 20:44:02 +00:00
(dolist (x dun-objnames)
1993-07-08 21:10:59 +00:00
(let (name)
(setq name (concat "obj-" (prin1-to-string (car x))))
(eval (list 'defconst (intern name) (cdr x)))))
(defconst obj-special 255)
;;; The initial setup of what objects are in each room.
;;; Regular objects have whole numbers lower than 255.
;;; 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
2003-02-04 13:24:35 +00:00
;;; handled specially by 'dun-describe-room.
1993-07-08 21:10:59 +00:00
2003-02-04 13:24:35 +00:00
(setq dun-room-objects (list nil
1993-07-08 21:10:59 +00:00
(list obj-shovel) ;; treasure-room
(list obj-boulder) ;; dead-end
nil nil nil
(list obj-food) ;; se-nw-road
(list obj-bear) ;; bear-hangout
nil nil
(list obj-special) ;; computer-room
(list obj-lamp obj-license obj-silver);; meadow
nil nil
(list obj-special) ;; sauna
2003-02-04 13:24:35 +00:00
nil
1993-07-08 21:10:59 +00:00
(list obj-weight obj-life) ;; weight-room
nil nil
(list obj-rms obj-floppy) ;; thirsty-maze
2003-02-04 13:24:35 +00:00
nil nil nil nil nil nil nil
1993-07-08 21:10:59 +00:00
(list obj-emerald) ;; hidden-area
nil
(list obj-gold) ;; misty-room
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
(list obj-towel obj-special) ;; red-room
nil nil nil nil nil
(list obj-box) ;; stair-landing
nil nil nil
(list obj-axe) ;; smal-crawlspace
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil
(list obj-special) ;; fourth-vermont-intersection
nil nil
(list obj-coins) ;; fifth-oaktree-intersection
nil
(list obj-bus) ;; fifth-sycamore-intersection
nil
(list obj-bone) ;; museum-lobby
nil
(list obj-jar obj-special obj-ruby) ;; marine-life-area
(list obj-nitric) ;; maintenance-room
(list obj-glycerine) ;; classroom
nil nil nil nil nil
(list obj-amethyst) ;; bottom-of-subway-stairs
nil nil
(list obj-special) ;; question-room-1
nil
(list obj-special) ;; question-room-2
nil
(list obj-special) ;; question-room-three
nil
(list obj-mona) ;; winner's-room
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil))
;;; These are objects in a room that are only described in the
;;; room description. They are permanent.
1993-07-13 20:44:02 +00:00
(setq dun-room-silents (list nil
(list obj-tree obj-coconut) ;; dead-end
(list obj-tree obj-coconut) ;; e-w-dirt-road
1993-07-08 21:10:59 +00:00
nil nil nil nil nil nil
(list obj-bin) ;; mailroom
(list obj-computer) ;; computer-room
nil nil nil
(list obj-dial) ;; sauna
nil
(list obj-ladder) ;; weight-room
(list obj-button obj-ladder) ;; maze-button-room
nil nil nil
nil nil nil nil
(list obj-lake) ;; lakefront-north
(list obj-lake) ;; lakefront-south
nil
1993-07-08 21:10:59 +00:00
(list obj-chute) ;; cave-entrance
nil nil nil nil nil
(list obj-painting obj-bed) ;; bedroom
(list obj-urinal obj-pipes) ;; bathroom
nil nil nil nil nil nil
(list obj-boulder) ;; horseshoe-boulder-room
nil nil nil nil nil nil nil nil nil nil nil nil nil nil
(list obj-computer obj-cable) ;; gamma-computing-center
(list obj-mail) ;; post-office
(list obj-gate) ;; main-maple-intersection
nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil
(list obj-cliff) ;; fifth-oaktree-intersection
nil nil nil
(list obj-dinosaur) ;; museum-lobby
nil
(list obj-fish obj-tanks) ;; marine-life-area
(list obj-switch) ;; maintenance-room
(list obj-blackboard) ;; classroom
(list obj-train) ;; vermont-station
nil nil
(list obj-disposal) ;; north-end-of-n-s-tunnel
nil nil
(list obj-computer) ;; endgame-computer-room
2003-02-04 13:24:35 +00:00
nil nil nil nil nil nil nil nil
1993-07-08 21:10:59 +00:00
(list obj-pc) ;; pc-area
nil nil nil nil nil nil
))
1993-07-13 20:44:02 +00:00
(setq dun-inventory '(1))
1993-07-08 21:10:59 +00:00
;;; Descriptions of objects, as they appear in the room description, and
;;; the inventory.
1993-07-13 20:44:02 +00:00
(setq dun-objects '(
1993-07-08 21:10:59 +00:00
("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
("There is some food here." "Some food") ;3
("There is a shiny brass key here." "A brass key") ;4
("There is a slip of paper here." "A slip of paper") ;5
("There is a wax statuette of Richard Stallman here." ;6
"An RMS statuette")
("There is a shimmering diamond here." "A diamond") ;7
("There is a 10 pound weight here." "A weight") ;8
("There is a life preserver here." "A life preserver");9
("There is an emerald bracelet here." "A bracelet") ;10
("There is a gold bar here." "A gold bar") ;11
("There is a platinum bar here." "A platinum bar") ;12
("There is a beach towel on the ground here." "A beach towel")
("There is an axe here." "An axe") ;14
("There is a silver bar here." "A silver bar") ;15
("There is a bus driver's license here." "A license") ;16
("There are some valuable coins here." "Some valuable coins")
("There is a jewel-encrusted egg here." "A valuable egg") ;18
("There is a glass jar here." "A glass jar") ;19
("There is a dinosaur bone here." "A bone") ;20
("There is a packet of nitric acid here." "Some nitric acid")
("There is a packet of glycerine here." "Some glycerine") ;22
("There is a valuable ruby here." "A ruby") ;23
("There is a valuable amethyst here." "An amethyst") ;24
("The Mona Lisa is here." "The Mona Lisa") ;25
("There is a 100 dollar bill here." "A $100 bill") ;26
("There is a floppy disk here." "A floppy disk") ;27
)
)
;;; Weight of objects
2003-02-04 13:24:35 +00:00
(setq dun-object-lbs
1993-07-13 20:44:02 +00:00
'(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))
2003-02-04 13:24:35 +00:00
(setq dun-object-pts
1993-07-13 20:44:02 +00:00
'(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))
1993-07-08 21:10:59 +00:00
;;; Unix representation of objects.
1993-07-13 20:44:02 +00:00
(setq dun-objfiles '(
1993-07-08 21:10:59 +00:00
"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"
"coins.o" "egg.o" "jar.o" "bone.o" "nitric.o" "glycerine.o"
"ruby.o" "amethyst.o"
))
;;; These are the descriptions for the negative numbered objects from
1993-07-13 20:44:02 +00:00
;;; dun-room-objects
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(setq dun-perm-objects '(
1993-07-08 21:10:59 +00:00
nil
("There is a large boulder here.")
nil
("There is a ferocious bear here!")
nil
nil
("There is a worthless pile of protoplasm here.")
nil
nil
nil
nil
nil
nil
("There is a strange smell in this room.")
nil
(
"There is a box with a slit in it, bolted to the wall here."
)
nil
nil
("There is a bus here.")
nil
nil
nil
))
;;; These are the descriptions the user gets when regular objects are
;;; examined.
1993-07-13 20:44:02 +00:00
(setq dun-physobj-desc '(
1993-07-08 21:10:59 +00:00
"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
2 Megabytes of RAM onboard."
"It looks like some kind of meat. Smells pretty bad."
nil
"The paper says: Don't forget to type 'help' for help. Also, remember
this word: 'worms'"
"The statuette is of the likeness of Richard Stallman, the author of the
famous EMACS editor. You notice that he is not wearing any shoes."
nil
"You observe that the weight is heavy."
"It says S. S. Minnow."
nil
nil
nil
"It has a picture of snoopy on it."
nil
nil
"It has your picture on it!"
"They are old coins from the 19th century."
"It is a valuable Fabrege egg."
2002-07-03 11:29:28 +00:00
"It is a plain glass jar."
1993-07-08 21:10:59 +00:00
nil
nil
nil
nil
nil
)
)
;;; These are the descriptions the user gets when non-regular objects
;;; are examined.
1993-07-13 20:44:02 +00:00
(setq dun-permobj-desc '(
1993-07-08 21:10:59 +00:00
nil
"It is just a boulder. It cannot be moved."
"They are palm trees with a bountiful supply of coconuts in them."
"It looks like a grizzly to me."
"All of the bins are empty. Looking closely you can see that there
are names written at the bottom of each bin, but most of them are
faded away so that you cannot read them. You can only make out three
names:
Jeffrey Collier
Robert Toukmond
Thomas Stock
"
nil
"It is just a garbled mess."
"The dial points to a temperature scale which has long since faded away."
nil
nil
"It is a velvet painting of Elvis Presley. It seems to be nailed to the
1993-07-08 21:10:59 +00:00
wall, and you cannot move it."
"It is a queen sized bed, with a very firm mattress."
"The urinal is very clean compared with everything else in the cave. There
isn't even any rust. Upon close examination you realize that the drain at the
bottom is missing, and there is just a large hole leading down the
2003-02-04 13:24:35 +00:00
pipes into nowhere. The hole is too small for a person to fit in. The
1993-07-08 21:10:59 +00:00
flush handle is so clean that you can see your reflection in it."
nil
nil
"The box has a slit in the top of it, and on it, in sloppy handwriting, is
written: 'For key upgrade, put key in here.'"
nil
"It says 'express mail' on it."
"It is a 35 passenger bus with the company name 'mobytours' on it."
"It is a large metal gate that is too big to climb over."
"It is a HIGH cliff."
"Unfortunately you do not know enough about dinosaurs to tell very much about
it. It is very big, though."
"The fish look like they were once quite beautiful."
nil
nil
nil
nil
"It is a normal ladder that is permanently attached to the hole."
"It is a passenger train that is ready to go."
"It is a personal computer that has only one floppy disk drive."
)
)
2003-02-04 13:24:35 +00:00
(setq dun-diggables
1993-07-13 20:44:02 +00:00
(list nil nil nil (list obj-cpu) nil nil nil nil nil nil nil
1993-07-08 21:10:59 +00:00
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))
1993-07-13 20:44:02 +00:00
(setq dun-room-shorts nil)
(dolist (x dun-rooms)
2003-02-04 13:24:35 +00:00
(setq dun-room-shorts
(append dun-room-shorts (list (downcase
1993-07-13 20:44:02 +00:00
(dun-space-to-hyphen
(cadr x)))))))
(setq dun-endgame-questions '(
1993-07-08 21:10:59 +00:00
(
"What is your password on the machine called 'pokey'?" "robert")
(
"What password did you use during anonymous ftp to gamma?" "foo")
(
"Excluding the endgame, how many places are there where you can put
treasures for points?" "4" "four")
(
"What is your login name on the 'endgame' machine?" "toukmond"
)
(
"What is the nearest whole dollar to the price of the shovel?" "20" "twenty")
(
"What is the name of the bus company serving the town?" "mobytours")
(
"Give either of the two last names in the mailroom, other than your own."
"collier" "stock")
(
"What cartoon character is on the towel?" "snoopy")
(
"What is the last name of the author of EMACS?" "stallman")
(
"How many megabytes of memory is on the CPU board for the Vax?" "2")
(
"Which street in town is named after a U.S. state?" "vermont")
(
"How many pounds did the weight weigh?" "ten" "10")
(
"Name the STREET which runs right over the subway stop." "fourth" "4" "4th")
(
"How many corners are there in town (excluding the one with the Post Office)?"
"24" "twentyfour" "twenty-four")
(
"What type of bear was hiding your key?" "grizzly")
(
"Name either of the two objects you found by digging." "cpu" "card" "vax"
"board" "platinum")
(
"What network protocol is used between pokey and gamma?" "tcp/ip" "ip" "tcp")
))
(let (a)
(setq a 0)
1993-07-13 20:44:02 +00:00
(dolist (x dun-room-shorts)
1993-07-08 21:10:59 +00:00
(eval (list 'defconst (intern x) a))
(setq a (+ a 1))))
;;;;
;;;; This section defines the UNIX emulation functions for dunnet.
;;;;
1993-07-13 20:44:02 +00:00
(defun dun-unix-parse (args)
1993-07-08 21:10:59 +00:00
(interactive "*p")
(beginning-of-line)
(let (beg esign)
(setq beg (+ (point) 2))
(end-of-line)
(if (and (not (= beg (point)))
(string= "$" (buffer-substring (- beg 2) (- beg 1))))
(progn
(setq line (downcase (buffer-substring beg (point))))
(princ line)
1993-07-13 20:44:02 +00:00
(if (eq (dun-parse2 nil dun-unix-verbs line) -1)
1993-07-08 21:10:59 +00:00
(progn
(if (setq esign (string-match "=" line))
2003-02-04 13:24:35 +00:00
(dun-doassign line esign)
1993-07-13 20:44:02 +00:00
(dun-mprinc (car line-list))
(dun-mprincl ": not found.")))))
1993-07-08 21:10:59 +00:00
(goto-char (point-max))
1993-07-13 20:44:02 +00:00
(dun-mprinc "\n"))
1993-07-08 21:10:59 +00:00
(if (eq dungeon-mode 'unix)
(progn
1993-07-13 20:44:02 +00:00
(dun-fix-screen)
(dun-mprinc "$ ")))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-doassign (line esign)
(if (not dun-wizard)
1993-07-08 21:10:59 +00:00
(let (passwd)
1993-07-13 20:44:02 +00:00
(dun-mprinc "Enter wizard password: ")
(setq passwd (dun-read-line))
(if (not dun-batch-mode)
(dun-mprinc "\n"))
1993-07-08 21:10:59 +00:00
(if (string= passwd "moby")
(progn
1993-07-13 20:44:02 +00:00
(setq dun-wizard t)
(dun-doassign line esign))
(dun-mprincl "Incorrect.")))
1993-07-08 21:10:59 +00:00
(let (varname epoint afterq i value)
(setq varname (substring line 0 esign))
(if (not (setq epoint (string-match ")" line)))
(if (string= (substring line (1+ esign) (+ esign 2))
"\"")
(progn
(setq afterq (substring line (+ esign 2)))
(setq epoint (+
(string-match "\"" afterq)
(+ esign 3))))
2003-02-04 13:24:35 +00:00
1993-07-08 21:10:59 +00:00
(if (not (setq epoint (string-match " " line)))
(setq epoint (length line))))
(setq epoint (1+ epoint))
(while (and
(not (= epoint (length line)))
(setq i (string-match ")" (substring line epoint))))
(setq epoint (+ epoint i 1))))
(setq value (substring line (1+ esign) epoint))
1993-07-13 20:44:02 +00:00
(dun-eval varname value))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-eval (varname value)
1993-07-08 21:10:59 +00:00
(let (eval-error)
(switch-to-buffer (get-buffer-create "*dungeon-eval*"))
(erase-buffer)
(insert "(setq ")
(insert varname)
(insert " ")
(insert value)
(insert ")")
(setq eval-error nil)
(condition-case nil
(eval-current-buffer)
(error (setq eval-error t)))
(kill-buffer (current-buffer))
(switch-to-buffer "*dungeon*")
(if eval-error
1993-07-13 20:44:02 +00:00
(dun-mprincl "Invalid syntax."))))
2003-02-04 13:24:35 +00:00
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-unix-interface ()
(dun-login)
(if dun-logged-in
1993-07-08 21:10:59 +00:00
(progn
(setq dungeon-mode 'unix)
1993-07-13 20:44:02 +00:00
(define-key dungeon-mode-map "\r" 'dun-unix-parse)
(dun-mprinc "$ "))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-login ()
1993-07-08 21:10:59 +00:00
(let (tries username password)
(setq tries 4)
1993-07-13 20:44:02 +00:00
(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"))
1993-07-08 21:10:59 +00:00
(if (or (not (string= username "toukmond"))
(not (string= password "robert")))
1993-07-13 20:44:02 +00:00
(dun-mprincl "login incorrect")
(setq dun-logged-in t)
(dun-mprincl "
1993-07-08 21:10:59 +00:00
Welcome to Unix\n
Please clean up your directories. The filesystem is getting full.
1996-01-04 23:13:09 +00:00
Our tcp/ip link to gamma is a little flaky, but seems to work.
The current version of ftp can only send files from your home
1993-07-08 21:10:59 +00:00
directory, and deletes them after they are sent! Be careful.
Note: Restricted bourne shell in use.\n")))
(setq dungeon-mode 'dungeon)))
1993-07-13 20:44:02 +00:00
(defun dun-ls (args)
1993-07-08 21:10:59 +00:00
(if (car args)
(let (ocdpath ocdroom)
1993-07-13 20:44:02 +00:00
(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
1993-07-08 21:10:59 +00:00
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"))
1993-07-13 20:44:02 +00:00
(defun dun-ls-usr ()
(dun-mprincl "total 4
1993-07-08 21:10:59 +00:00
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"))
1993-07-13 20:44:02 +00:00
(defun dun-ls-rooms ()
(dun-mprincl "total 16
1993-07-08 21:10:59 +00:00
drwxr-xr-x 3 root staff 512 Jan 1 1970 .
drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
1993-07-13 20:44:02 +00:00
(dolist (x dun-visited)
(dun-mprinc
1993-07-08 21:10:59 +00:00
"drwxr-xr-x 3 root staff 512 Jan 1 1970 ")
1993-07-13 20:44:02 +00:00
(dun-mprincl (nth x dun-room-shorts))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-ls-room ()
(dun-mprincl "total 4
1993-07-08 21:10:59 +00:00
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")
1993-07-13 20:44:02 +00:00
(dolist (x (nth dun-cdroom dun-room-objects))
1993-07-08 21:10:59 +00:00
(if (and (>= x 0) (not (= x 255)))
(progn
1993-07-13 20:44:02 +00:00
(dun-mprinc "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ")
(dun-mprincl (nth x dun-objfiles))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-ls-inven ()
(dun-mprinc "total 467
1993-07-08 21:10:59 +00:00
drwxr-xr-x 3 toukmond restricted 512 Jan 1 1970 .
drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
1993-07-13 20:44:02 +00:00
(dolist (x dun-unix-verbs)
1993-07-08 21:10:59 +00:00
(if (not (eq (car x) 'IMPOSSIBLE))
(progn
1993-07-13 20:44:02 +00:00
(dun-mprinc"
1993-07-08 21:10:59 +00:00
-rwxr-xr-x 1 toukmond restricted 10423 Jan 1 1970 ")
1993-07-13 20:44:02 +00:00
(dun-mprinc (car x)))))
(dun-mprinc "\n")
(if (not dun-uncompressed)
(dun-mprincl
1993-07-08 21:10:59 +00:00
"-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 paper.o.Z"))
1993-07-13 20:44:02 +00:00
(dolist (x dun-inventory)
2003-02-04 13:24:35 +00:00
(dun-mprinc
1993-07-08 21:10:59 +00:00
"-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ")
1993-07-13 20:44:02 +00:00
(dun-mprincl (nth x dun-objfiles))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-echo (args)
1993-07-08 21:10:59 +00:00
(let (nomore var)
(setq nomore nil)
(dolist (x args)
(if (not nomore)
(progn
(if (not (string= (substring x 0 1) "$"))
(progn
1993-07-13 20:44:02 +00:00
(dun-mprinc x)
(dun-mprinc " "))
1993-07-08 21:10:59 +00:00
(setq var (intern (substring x 1)))
(if (not (boundp var))
1993-07-13 20:44:02 +00:00
(dun-mprinc " ")
(if (member var dun-restricted)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprinc var)
(dun-mprinc ": Permission denied")
1993-07-08 21:10:59 +00:00
(setq nomore t))
1993-07-13 20:44:02 +00:00
(eval (list 'dun-mprinc var))
(dun-mprinc " ")))))))
(dun-mprinc "\n")))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-ftp (args)
1993-07-08 21:10:59 +00:00
(let (host username passwd ident newlist)
(if (not (car args))
1993-07-13 20:44:02 +00:00
(dun-mprincl "ftp: hostname required on command line.")
1993-07-08 21:10:59 +00:00
(setq host (intern (car args)))
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
(if (string= username "toukmond")
1993-07-13 20:44:02 +00:00
(if dun-batch-mode
(dun-mprincl "toukmond ftp access not allowed.")
(dun-mprincl "\ntoukmond ftp access not allowed."))
1993-07-08 21:10:59 +00:00
(if (string= username "anonymous")
1993-07-13 20:44:02 +00:00
(if dun-batch-mode
(dun-mprincl
1993-07-08 21:10:59 +00:00
"Guest login okay, send your user ident as password.")
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"\nGuest login okay, send your user ident as password."))
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
(if (not (string= username "anonymous"))
1993-07-13 20:44:02 +00:00
(if dun-batch-mode
(dun-mprincl "Login failed.")
(dun-mprincl "\nLogin failed."))
(if dun-batch-mode
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-13 20:44:02 +00:00
"Guest login okay, user access restrictions apply.")
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-13 20:44:02 +00:00
"\nGuest login okay, user access restrictions apply."))
(dun-ftp-commands)
2003-02-04 13:24:35 +00:00
(setq newlist
1993-07-08 21:10:59 +00:00
'("What password did you use during anonymous ftp to gamma?"))
(setq newlist (append newlist (list ident)))
1993-07-13 20:44:02 +00:00
(rplaca (nthcdr 1 dun-endgame-questions) newlist)))))))))
2003-02-04 13:24:35 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-ftp-commands ()
(setq dun-exitf nil)
1993-07-08 21:10:59 +00:00
(let (line)
1993-07-13 20:44:02 +00:00
(while (not dun-exitf)
(dun-mprinc "ftp> ")
(setq line (dun-read-line))
2003-02-04 13:24:35 +00:00
(if
1993-07-08 21:10:59 +00:00
(eq
2003-02-04 13:24:35 +00:00
(dun-parse2 nil
1993-07-13 20:44:02 +00:00
'((type . dun-ftptype) (binary . dun-bin) (bin . dun-bin)
(send . dun-send) (put . dun-send) (quit . dun-ftpquit)
(help . dun-ftphelp)(ascii . dun-fascii)
1993-07-08 21:10:59 +00:00
) line)
-1)
1993-07-13 20:44:02 +00:00
(dun-mprincl "No such command. Try help.")))
(setq dun-ftptype 'ascii)))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-ftptype (args)
1993-07-08 21:10:59 +00:00
(if (not (car args))
1993-07-13 20:44:02 +00:00
(dun-mprincl "Usage: type [binary | ascii]")
1993-07-08 21:10:59 +00:00
(setq args (intern (car args)))
(if (eq args 'binary)
1993-07-13 20:44:02 +00:00
(dun-bin nil)
1993-07-08 21:10:59 +00:00
(if (eq args 'ascii)
1993-07-13 20:44:02 +00:00
(dun-fascii 'nil)
(dun-mprincl "Unknown type.")))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-bin (args)
(dun-mprincl "Type set to binary.")
(setq dun-ftptype 'binary))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-fascii (args)
(dun-mprincl "Type set to ascii.")
(setq dun-ftptype 'ascii))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-ftpquit (args)
(setq dun-exitf t))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-send (args)
1993-07-08 21:10:59 +00:00
(if (not (car args))
1993-07-13 20:44:02 +00:00
(dun-mprincl "Usage: send <filename>")
1993-07-08 21:10:59 +00:00
(setq args (car args))
(let (counter foo)
(setq foo nil)
(setq counter 0)
;;; User can send commands! Stupid user.
1993-07-13 20:44:02 +00:00
(if (assq (intern args) dun-unix-verbs)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(if (string= args x)
(progn
1993-07-13 20:44:02 +00:00
(if (not (member counter dun-inventory))
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(dun-mprincl "No such file.")
1993-07-08 21:10:59 +00:00
(setq foo t))
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
(progn
(if (not (member obj-protoplasm
2003-02-04 13:24:35 +00:00
(nth receiving-room
1993-07-13 20:44:02 +00:00
dun-room-objects)))
(dun-replace dun-room-objects receiving-room
2003-02-04 13:24:35 +00:00
(append (nth receiving-room
1993-07-13 20:44:02 +00:00
dun-room-objects)
1993-07-08 21:10:59 +00:00
(list obj-protoplasm))))
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(list counter))))
(setq foo t)
1993-07-13 20:44:02 +00:00
(dun-mprincl "Transfer complete."))))
1993-07-08 21:10:59 +00:00
(setq counter (+ 1 counter)))
(if (not foo)
1993-07-13 20:44:02 +00:00
(dun-mprincl "No such file."))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-ftphelp (args)
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-08 21:10:59 +00:00
"Possible commands are:\nsend quit type ascii binary help"))
1993-07-13 20:44:02 +00:00
(defun dun-uexit (args)
1993-07-08 21:10:59 +00:00
(setq dungeon-mode 'dungeon)
1993-07-13 20:44:02 +00:00
(dun-mprincl "\nYou step back from the console.")
(define-key dungeon-mode-map "\r" 'dun-parse)
(if (not dun-batch-mode)
(dun-messages)))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-pwd (args)
(dun-mprincl dun-cdpath))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-uncompress (args)
1993-07-08 21:10:59 +00:00
(if (not (car args))
1993-07-13 20:44:02 +00:00
(dun-mprincl "Usage: uncompress <filename>")
1993-07-08 21:10:59 +00:00
(setq args (car args))
1993-07-13 20:44:02 +00:00
(if (or dun-uncompressed
1993-07-08 21:10:59 +00:00
(and (not (string= args "paper.o"))
(not (string= args "paper.o.z"))))
1993-07-13 20:44:02 +00:00
(dun-mprincl "Uncompress command failed.")
(setq dun-uncompressed t)
(setq dun-inventory (append dun-inventory (list obj-paper))))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-rlogin (args)
1993-07-08 21:10:59 +00:00
(let (passwd)
(if (not (car args))
1993-07-13 20:44:02 +00:00
(dun-mprincl "Usage: rlogin <hostname>")
1993-07-08 21:10:59 +00:00
(setq args (car args))
(if (string= args "endgame")
1993-07-13 20:44:02 +00:00
(dun-rlogin-endgame)
1993-07-08 21:10:59 +00:00
(if (not (string= args "gamma"))
(if (string= args "pokey")
(dun-mprincl "Can't rlogin back to localhost")
(dun-mprincl "No such host."))
1993-07-13 20:44:02 +00:00
(if (not dun-ethernet)
(dun-mprincl "Host not responding.")
(dun-mprinc "Password: ")
(setq passwd (dun-read-line))
1993-07-08 21:10:59 +00:00
(if (not (string= passwd "worms"))
1993-07-13 20:44:02 +00:00
(dun-mprincl "\nlogin incorrect")
2003-02-04 13:24:35 +00:00
(dun-mprinc
1993-07-08 21:10:59 +00:00
"\nYou begin to feel strange for a moment, and you lose your items."
)
2003-02-04 13:24:35 +00:00
(dun-replace dun-room-objects computer-room
(append (nth computer-room dun-room-objects)
1993-07-13 20:44:02 +00:00
dun-inventory))
(setq dun-inventory nil)
(setq dun-current-room receiving-room)
(dun-uexit nil))))))))
2003-02-04 13:24:35 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-cd (args)
1996-01-04 23:13:09 +00:00
(let (tcdpath tcdroom path-elements room-check)
1993-07-08 21:10:59 +00:00
(if (not (car args))
1993-07-13 20:44:02 +00:00
(dun-mprincl "Usage: cd <path>")
(setq tcdpath dun-cdpath)
(setq tcdroom dun-cdroom)
(setq dun-badcd nil)
1993-07-08 21:10:59 +00:00
(condition-case nil
1993-07-13 20:44:02 +00:00
(setq path-elements (dun-get-path (car args) nil))
(error (dun-mprincl "Invalid path")
1993-07-13 20:44:02 +00:00
(setq dun-badcd t)))
1993-07-08 21:10:59 +00:00
(dolist (pe path-elements)
1993-07-13 20:44:02 +00:00
(unless dun-badcd
1993-07-08 21:10:59 +00:00
(if (not (string= pe "."))
(if (string= pe "..")
(progn
(if (> tcdroom 0) ;In a room
(progn
(setq tcdpath "/rooms")
(setq tcdroom -2))
;In /rooms,/usr,root
2003-02-04 13:24:35 +00:00
(if (or
(= tcdroom -2) (= tcdroom -4)
1993-07-08 21:10:59 +00:00
(= tcdroom -3))
(progn
(setq tcdpath "/")
(setq tcdroom -3))
(if (= tcdroom -10) ;In /usr/toukmond
(progn
(setq tcdpath "/usr")
(setq tcdroom -4))))))
(if (string= pe "/")
(progn
(setq tcdpath "/")
(setq tcdroom -3))
(if (= tcdroom -4)
(if (string= pe "toukmond")
(progn
(setq tcdpath "/usr/toukmond")
(setq tcdroom -10))
1993-07-13 20:44:02 +00:00
(dun-nosuchdir))
1993-07-08 21:10:59 +00:00
(if (= tcdroom -10)
1993-07-13 20:44:02 +00:00
(dun-nosuchdir)
1993-07-08 21:10:59 +00:00
(if (> tcdroom 0)
1993-07-13 20:44:02 +00:00
(dun-nosuchdir)
1993-07-08 21:10:59 +00:00
(if (= tcdroom -3)
(progn
(if (string= pe "rooms")
(progn
(setq tcdpath "/rooms")
(setq tcdroom -2))
(if (string= pe "usr")
(progn
(setq tcdpath "/usr")
(setq tcdroom -4))
1993-07-13 20:44:02 +00:00
(dun-nosuchdir))))
1993-07-08 21:10:59 +00:00
(if (= tcdroom -2)
(progn
1993-07-13 20:44:02 +00:00
(dolist (x dun-visited)
2003-02-04 13:24:35 +00:00
(setq room-check
(nth x
1993-07-13 20:44:02 +00:00
dun-room-shorts))
1993-07-08 21:10:59 +00:00
(if (string= room-check pe)
(progn
2003-02-04 13:24:35 +00:00
(setq tcdpath
1993-07-08 21:10:59 +00:00
(concat "/rooms/" room-check))
(setq tcdroom x))))
(if (= tcdroom -2)
1993-07-13 20:44:02 +00:00
(dun-nosuchdir)))))))))))))
(if (not dun-badcd)
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(setq dun-cdpath tcdpath)
(setq dun-cdroom tcdroom)
1993-07-08 21:10:59 +00:00
0)
-2))))
1993-07-13 20:44:02 +00:00
(defun dun-nosuchdir ()
(dun-mprincl "No such directory.")
(setq dun-badcd t))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-cat (args)
1993-07-08 21:10:59 +00:00
(let (doto checklist)
(if (not (setq args (car args)))
1993-07-13 20:44:02 +00:00
(dun-mprincl "Usage: cat <ascii-file-name>")
1993-07-08 21:10:59 +00:00
(if (string-match "/" args)
1993-07-13 20:44:02 +00:00
(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)))
1993-07-08 21:10:59 +00:00
(if (setq doto (string-match "\\.o" args))
(progn
1993-07-13 20:44:02 +00:00
(if (= dun-cdroom -10)
(setq checklist dun-inventory)
(setq checklist (nth dun-cdroom dun-room-objects)))
2003-02-04 13:24:35 +00:00
(if (not (member (cdr
(assq (intern
(substring args 0 doto))
1993-07-13 20:44:02 +00:00
dun-objnames))
1993-07-08 21:10:59 +00:00
checklist))
1993-07-13 20:44:02 +00:00
(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."))))))))
2003-02-04 13:24:35 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-zippy (args)
(dun-mprincl (yow)))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-rlogin-endgame ()
(if (not (= (dun-score nil) 90))
2003-02-04 13:24:35 +00:00
(dun-mprincl
1993-07-13 20:44:02 +00:00
"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)))
1993-07-08 21:10:59 +00:00
(random t)
(setq tloc (+ 60 (random 18)))
2003-02-04 13:24:35 +00:00
(dun-replace dun-room-objects tloc
1993-07-13 20:44:02 +00:00
(append (nth tloc dun-room-objects) (list 18)))
(setq tcomb (+ 100 (random 899)))
1993-07-13 20:44:02 +00:00
(setq dun-combination (prin1-to-string tcomb))
1993-07-08 21:10:59 +00:00
;;;;
;;;; This section defines the DOS emulation functions for dunnet
;;;;
1993-07-13 20:44:02 +00:00
(defun dun-dos-parse (args)
1993-07-08 21:10:59 +00:00
(interactive "*p")
(beginning-of-line)
(let (beg)
(setq beg (+ (point) 3))
(end-of-line)
(if (not (= beg (point)))
(let (line)
(setq line (downcase (buffer-substring beg (point))))
(princ line)
1993-07-13 20:44:02 +00:00
(if (eq (dun-parse2 nil dun-dos-verbs line) -1)
1993-07-08 21:10:59 +00:00
(progn
(sleep-for 1)
1993-07-13 20:44:02 +00:00
(dun-mprincl "Bad command or file name"))))
1993-07-08 21:10:59 +00:00
(goto-char (point-max))
1993-07-13 20:44:02 +00:00
(dun-mprinc "\n"))
1993-07-08 21:10:59 +00:00
(if (eq dungeon-mode 'dos)
(progn
1993-07-13 20:44:02 +00:00
(dun-fix-screen)
(dun-dos-prompt)))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-dos-interface ()
(dun-dos-boot-msg)
1993-07-08 21:10:59 +00:00
(setq dungeon-mode 'dos)
1993-07-13 20:44:02 +00:00
(define-key dungeon-mode-map "\r" 'dun-dos-parse)
(dun-dos-prompt))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-dos-type (args)
1993-07-08 21:10:59 +00:00
(sleep-for 2)
(if (setq args (car args))
(if (string= args "foo.txt")
1993-07-13 20:44:02 +00:00
(dun-dos-show-combination)
1993-07-08 21:10:59 +00:00
(if (string= args "command.com")
1993-07-13 20:44:02 +00:00
(dun-mprincl "Cannot type binary files")
(dun-mprinc "File not found - ")
(dun-mprincl (upcase args))))
(dun-mprincl "Must supply file name")))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-dos-invd (args)
1993-07-08 21:10:59 +00:00
(sleep-for 1)
1993-07-13 20:44:02 +00:00
(dun-mprincl "Invalid drive specification"))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-dos-dir (args)
1993-07-08 21:10:59 +00:00
(sleep-for 1)
(if (or (not (setq args (car args))) (string= args "\\"))
1993-07-13 20:44:02 +00:00
(dun-mprincl "
2003-02-04 13:24:35 +00:00
Volume in drive A is FOO
1993-07-08 21:10:59 +00:00
Volume Serial Number is 1A16-08C9
Directory of A:\\
COMMAND COM 47845 04-09-91 2:00a
FOO TXT 40 01-20-93 1:01a
2 file(s) 47845 bytes
1065280 bytes free
")
1993-07-13 20:44:02 +00:00
(dun-mprincl "
2003-02-04 13:24:35 +00:00
Volume in drive A is FOO
1993-07-08 21:10:59 +00:00
Volume Serial Number is 1A16-08C9
Directory of A:\\
File not found")))
1993-07-13 20:44:02 +00:00
(defun dun-dos-prompt ()
(dun-mprinc "A> "))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-dos-boot-msg ()
1993-07-08 21:10:59 +00:00
(sleep-for 3)
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(sleep-for 1)
1993-07-13 20:44:02 +00:00
(dun-mprincl "Cannot spawn subshell"))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-dos-exit (args)
1993-07-08 21:10:59 +00:00
(setq dungeon-mode 'dungeon)
1993-07-13 20:44:02 +00:00
(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)))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-dos-no-disk ()
1993-07-08 21:10:59 +00:00
(sleep-for 3)
1993-07-13 20:44:02 +00:00
(dun-mprincl "Boot sector not found"))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-dos-show-combination ()
1993-07-08 21:10:59 +00:00
(sleep-for 2)
1993-07-13 20:44:02 +00:00
(dun-mprinc "\nThe combination is ")
(dun-mprinc dun-combination)
(dun-mprinc ".\n"))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-dos-nil (args))
1993-07-08 21:10:59 +00:00
;;;;
;;;; This section defines the save and restore game functions for dunnet.
;;;;
1993-07-13 20:44:02 +00:00
(defun dun-save-game (filename)
1993-07-08 21:10:59 +00:00
(if (not (setq filename (car filename)))
1993-07-13 20:44:02 +00:00
(dun-mprincl "You must supply a filename for the save.")
1993-07-08 21:10:59 +00:00
(if (file-exists-p filename)
(delete-file filename))
1993-07-13 20:44:02 +00:00
(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-questions")
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(switch-to-buffer "*dungeon*")
(princ "")
1993-07-13 20:44:02 +00:00
(dun-mprincl "Done."))))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-make-save-buffer ()
1993-07-08 21:10:59 +00:00
(switch-to-buffer (get-buffer-create "*save-dungeon*"))
(erase-buffer))
1993-07-13 20:44:02 +00:00
(defun dun-compile-save-out (filename)
1993-07-08 21:10:59 +00:00
(let (ferror)
(setq ferror nil)
(condition-case nil
(dun-rot13)
(error (setq ferror t)))
(if (not ferror)
(progn
(goto-char (point-min))))
(condition-case nil
(write-region 1 (point-max) filename nil 1)
(error (setq ferror t)))
(kill-buffer (current-buffer))
ferror))
2003-02-04 13:24:35 +00:00
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-save-val (varname)
1993-07-08 21:10:59 +00:00
(let (value)
(setq varname (intern varname))
(setq value (eval varname))
1993-07-13 20:44:02 +00:00
(dun-minsert "(setq ")
(dun-minsert varname)
(dun-minsert " ")
1993-07-08 21:10:59 +00:00
(if (or (listp value)
(symbolp value))
1993-07-13 20:44:02 +00:00
(dun-minsert "'"))
1993-07-08 21:10:59 +00:00
(if (stringp value)
1993-07-13 20:44:02 +00:00
(dun-minsert "\""))
(dun-minsert value)
1993-07-08 21:10:59 +00:00
(if (stringp value)
1993-07-13 20:44:02 +00:00
(dun-minsert "\""))
(dun-minsertl ")")))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-restore (args)
1993-07-08 21:10:59 +00:00
(let (file)
(if (not (setq file (car args)))
1993-07-13 20:44:02 +00:00
(dun-mprincl "You must supply a filename.")
(if (not (dun-load-d file))
(dun-mprincl "Could not load restore file.")
(dun-mprincl "Done.")
1993-07-08 21:10:59 +00:00
(setq room 0)))))
1993-07-13 20:44:02 +00:00
(defun dun-do-logfile (type how)
1993-07-08 21:10:59 +00:00
(let (ferror newscore)
(setq ferror nil)
(switch-to-buffer (get-buffer-create "*score*"))
(erase-buffer)
(condition-case nil
1993-07-13 20:44:02 +00:00
(insert-file-contents dun-log-file)
1993-07-08 21:10:59 +00:00
(error (setq ferror t)))
(unless ferror
(goto-char (point-max))
1993-07-13 20:44:02 +00:00
(dun-minsert (current-time-string))
(dun-minsert " ")
(dun-minsert (user-login-name))
(dun-minsert " ")
1993-07-08 21:10:59 +00:00
(if (eq type 'save)
1993-07-13 20:44:02 +00:00
(dun-minsert "saved ")
(if (= (dun-endgame-score) 110)
(dun-minsert "won ")
1993-07-08 21:10:59 +00:00
(if (not how)
1993-07-13 20:44:02 +00:00
(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))
1993-07-08 21:10:59 +00:00
(kill-buffer (current-buffer))))
;;;;
;;;; These are functions, and function re-definitions so that dungeon can
;;;; be run in batch mode.
1993-07-13 20:44:02 +00:00
(defun dun-batch-mprinc (arg)
1993-07-08 21:10:59 +00:00
(if (stringp arg)
(send-string-to-terminal arg)
(send-string-to-terminal (prin1-to-string arg))))
1993-07-13 20:44:02 +00:00
(defun dun-batch-mprincl (arg)
1993-07-08 21:10:59 +00:00
(if (stringp arg)
(progn
(send-string-to-terminal arg)
(send-string-to-terminal "\n"))
(send-string-to-terminal (prin1-to-string arg))
(send-string-to-terminal "\n")))
1993-07-13 20:44:02 +00:00
(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)))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(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)))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-batch-read-line ()
1993-07-08 21:10:59 +00:00
(read-from-minibuffer "" nil dungeon-batch-map))
1993-07-13 20:44:02 +00:00
(defun dun-batch-loop ()
(setq dun-dead nil)
1993-07-08 21:10:59 +00:00
(setq room 0)
1993-07-13 20:44:02 +00:00
(while (not dun-dead)
1993-07-08 21:10:59 +00:00
(if (eq dungeon-mode 'dungeon)
(progn
1993-07-13 20:44:02 +00:00
(if (not (= room dun-current-room))
1993-07-08 21:10:59 +00:00
(progn
1993-07-13 20:44:02 +00:00
(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)
1993-07-08 21:10:59 +00:00
(setq dungeon-mode 'dos)
(while (eq dungeon-mode 'dos)
1993-07-13 20:44:02 +00:00
(dun-dos-prompt)
(setq line (downcase (dun-read-line)))
(if (eq (dun-parse2 nil dun-dos-verbs line) -1)
1993-07-08 21:10:59 +00:00
(progn
(sleep-for 1)
1993-07-13 20:44:02 +00:00
(dun-mprincl "Bad command or file name"))))
1993-07-08 21:10:59 +00:00
(goto-char (point-max))
1993-07-13 20:44:02 +00:00
(dun-mprinc "\n"))
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-batch-unix-interface ()
(dun-login)
(if dun-logged-in
1993-07-08 21:10:59 +00:00
(progn
(setq dungeon-mode 'unix)
(while (eq dungeon-mode 'unix)
1993-07-13 20:44:02 +00:00
(dun-mprinc "$ ")
(setq line (downcase (dun-read-line)))
(if (eq (dun-parse2 nil dun-unix-verbs line) -1)
1993-07-08 21:10:59 +00:00
(let (esign)
(if (setq esign (string-match "=" line))
2003-02-04 13:24:35 +00:00
(dun-doassign line esign)
1993-07-13 20:44:02 +00:00
(dun-mprinc (car line-list))
(dun-mprincl ": not found.")))))
1993-07-08 21:10:59 +00:00
(goto-char (point-max))
1993-07-13 20:44:02 +00:00
(dun-mprinc "\n"))))
1993-07-08 21:10:59 +00:00
(defun dungeon-nil (arg)
"noop"
1997-05-05 23:15:13 +00:00
(interactive "*p")
nil)
1993-07-08 21:10:59 +00:00
1993-07-13 20:44:02 +00:00
(defun dun-batch-dungeon ()
1993-07-08 21:10:59 +00:00
(load "dun-batch")
1993-07-13 20:44:02 +00:00
(setq dun-visited '(27))
(dun-mprinc "\n")
(dun-batch-loop))
1993-07-08 21:10:59 +00:00
(unless (not noninteractive)
1993-07-13 20:44:02 +00:00
(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))
1993-07-20 21:15:26 +00:00
1997-06-22 18:57:55 +00:00
(provide 'dunnet)
2003-09-01 15:45:59 +00:00
;;; arch-tag: 4cc8e47c-d9e1-4ef4-936b-578e7f529558
;;; dunnet.el ends here