home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / games / volume14 / dunnet / part02 / dun-main.el < prev    next >
Lisp/Scheme  |  1992-08-31  |  2KB  |  85 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;                                                                      ;
  3. ;                       dunnet.el  Version 1.0                         ;
  4. ;                                                                      ;
  5. ;                   Ron Schnell (ronnie@eddie.mit.edu)                 ;
  6. ;                                                                      ;
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8.  
  9.  
  10. ;; This is the startup file.  It loads in the other files, and sets up
  11. ;; the functions to be bound to keys if you play in window-mode.
  12.  
  13. ;;;;;  The log file should be set for your system, and it must
  14. ;;;;;  be writeable by all.
  15.  
  16.       (setq log-file "/user0/rschnell/score/score") 
  17.  
  18. (defun dungeon-mode ()
  19.   "Major mode for running dungeon"
  20.   (interactive)
  21.   (text-mode)
  22.   (use-local-map dungeon-mode-map)
  23.   (setq major-mode 'dungeon-mode)
  24.   (setq mode-name "Dungeon")
  25. )
  26.  
  27. (defun dungeon-parse (arg)
  28.   "foo"
  29.   (interactive "*p")
  30.   (beginning-of-line)
  31.   (setq beg (+ (point) 1))
  32.   (end-of-line)
  33.   (if (and (not (= beg (point)))
  34.        (string= ">" (buffer-substring (- beg 1) beg)))
  35.       (progn
  36.     (setq line (downcase (buffer-substring beg (point))))
  37.     (princ line)
  38.     (if (eq (parse ignore verblist line) -1)
  39.         (mprinc "I don't understand that.\n")))
  40.     (goto-char (point-max))
  41.     (mprinc "\n"))
  42.     (dungeon-messages))
  43.     
  44. (defun dungeon-messages ()
  45.   (if dead
  46.       (text-mode)
  47.     (if (eq dungeon-mode 'dungeon)
  48.     (progn
  49.       (if (not (= room current-room))
  50.           (progn
  51.         (describe-room current-room)
  52.         (setq room current-room)))
  53.       (mprinc ">")))))
  54.  
  55. (defun dungeon-start ()
  56.   (interactive)
  57.   (switch-to-buffer "*dungeon*")
  58.   (dungeon-mode)
  59.   (setq dead nil)
  60.   (setq room 0)
  61.   (dungeon-messages))
  62.  
  63. (require 'cl)
  64.  
  65. (defun batch-dungeon ()
  66.   (setq load-path (append load-path (list ".")))
  67.   (load "dun-batch")
  68.   (setq visited '(27))
  69.   (mprinc "\n")
  70.   (dungeon-batch-loop))
  71.  
  72. (setq load-path (append load-path (list ".")))
  73.  
  74. (load "dun-commands")
  75. (load "dun-util")
  76. (if (setq glob (get-glob-dat))
  77.     (load-d glob)
  78.   (load "dun-globals"))
  79.  
  80. (load "dun-unix")
  81. (load "dun-save")
  82. (setq tloc (+ 60 (% (abs (random)) 18)))
  83. (replace room-objects tloc (append (nth tloc room-objects) (list 18)))
  84. (dungeon-start)
  85.