X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/3a880af4a79688e90da45311a8d85bae2d59a811..924a09e9161c05d9d69d85fa102910b10ece372f:/lisp/play/dunnet.el diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 2d62b800ef..3f4b8e8c5b 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -1,6 +1,6 @@ -;;; dunnet.el --- text adventure for Emacs -*- byte-compile-warnings: nil -*- +;;; dunnet.el --- text adventure for Emacs -;; Copyright (C) 1992-1993, 2001-2012 Free Software Foundation, Inc. +;; Copyright (C) 1992-1993, 2001-2014 Free Software Foundation, Inc. ;; Author: Ron Schnell ;; Created: 25 Jul 1992 @@ -100,7 +100,8 @@ (defun dun-describe-room (room) (if (and (not (member (abs room) dun-light-rooms)) - (not (member obj-lamp dun-inventory))) + (not (member obj-lamp dun-inventory)) + (not (member obj-lamp (nth dun-current-room dun-room-objects)))) (dun-mprincl "It is pitch dark. You are likely to be eaten by a grue.") (dun-mprincl (cadr (nth (abs room) dun-rooms))) (if (and (and (or (member room dun-visited) @@ -615,7 +616,8 @@ just try dropping it.") (defun dun-move (dir) (if (and (not (member dun-current-room dun-light-rooms)) - (not (member obj-lamp dun-inventory))) + (not (member obj-lamp dun-inventory)) + (not (member obj-lamp (nth dun-current-room dun-room-objects)))) (progn (dun-mprinc "You trip over a grue and fall into a pit and break every bone in your @@ -896,7 +898,7 @@ to swim.") (defun dun-help (args) (dun-mprincl -"Welcome to dunnet (2.01), by Ron Schnell (ronnie@driver-aces.com). +"Welcome to dunnet (2.02), by Ron Schnell (ronnie@driver-aces.com - @RonnieSchnell). 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 @@ -1385,8 +1387,8 @@ for a moment, then straighten yourself up. (setq dungeon-mode 'dungeon) (setq dun-unix-verbs '((ls . dun-ls) (ftp . dun-ftp) (echo . dun-echo) (exit . dun-uexit) (cd . dun-cd) (pwd . dun-pwd) - (rlogin . dun-rlogin) (uncompress . dun-uncompress) - (cat . dun-cat) (zippy . dun-zippy))) + (rlogin . dun-rlogin) (ssh . dun-rlogin) + (uncompress . dun-uncompress) (cat . dun-cat))) (setq dun-dos-verbs '((dir . dun-dos-dir) (type . dun-dos-type) (exit . dun-dos-exit) (command . dun-dos-spawn) @@ -2537,25 +2539,31 @@ treasures for points?" "4" "four") (dun-mprincl "Incorrect."))) (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)))) - - (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)) - (dun-eval varname value)))) + (setq varname (replace-regexp-in-string " " "" (substring line 0 esign))) + + (if (or (= (length varname) 0) (< (- (length line) esign) 2)) + (progn + (dun-mprinc line) + (dun-mprincl " : not found.")) + + (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)))) + + (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)) + (dun-eval varname value))))) (defun dun-eval (varname value) (let (eval-error) @@ -2739,16 +2747,20 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") (if dun-batch-mode (dun-mprincl "Login failed.") (dun-mprincl "\nLogin failed.")) - (if dun-batch-mode - (dun-mprincl - "Guest login okay, user access restrictions apply.") - (dun-mprincl - "\nGuest login okay, user access restrictions apply.")) - (dun-ftp-commands) - (setq newlist + (if (= (length ident) 0) + (if dun-batch-mode + (dun-mprincl "Password is required.") + (dun-mprincl "\nPassword is required.")) + (if dun-batch-mode + (dun-mprincl + "Guest login okay, user access restrictions apply.") + (dun-mprincl + "\nGuest login okay, user access restrictions apply.")) + (dun-ftp-commands) + (setq newlist '("What password did you use during anonymous ftp to gamma?")) - (setq newlist (append newlist (list ident))) - (rplaca (nthcdr 1 dun-endgame-questions) newlist))))))))) + (setq newlist (append newlist (list ident))) + (rplaca (nthcdr 1 dun-endgame-questions) newlist)))))))))) (defun dun-ftp-commands () (setq dun-exitf nil) @@ -2996,9 +3008,6 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") (dun-mprincl "Ascii files only.") (dun-mprincl "File not found.")))))))) -(defun dun-zippy (args) - (dun-mprincl (yow))) - (defun dun-rlogin-endgame () (if (not (= (dun-score nil) 90)) (dun-mprincl @@ -3356,3 +3365,7 @@ File not found"))) (provide 'dunnet) ;;; dunnet.el ends here + +;; Local Variables: +;; byte-compile-warnings: (not free-vars lexical) +;; End: