home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / games / dunnet / dun-main.el < prev    next >
Encoding:
Text File  |  1993-06-27  |  2.5 KB  |  95 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;                                                                      ;
  3. ;                       dunnet.el  Version 2.0                         ;
  4. ;                                                                      ;
  5. ;                   Ron Schnell (ronnie@media.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. (if nil
  14.     (eval-and-compile (setq byte-compile-warnings nil)))
  15.  
  16. ;;;;;  The log file should be set for your system, and it must
  17. ;;;;;  be writeable by all.
  18.  
  19.       (setq log-file "/usr/local/dunscore")
  20.  
  21. (defun dungeon-mode ()
  22.   "Major mode for running dungeon"
  23.   (interactive)
  24.   (text-mode)
  25.   (use-local-map dungeon-mode-map)
  26.   (setq major-mode 'dungeon-mode)
  27.   (setq mode-name "Dungeon")
  28. )
  29.  
  30. (setq load-path (append load-path (list ".")))
  31.  
  32.  
  33. (defun dungeon-parse (arg)
  34.   "foo"
  35.   (interactive "*p")
  36.   (beginning-of-line)
  37.   (setq beg (+ (point) 1))
  38.   (end-of-line)
  39.   (if (and (not (= beg (point))) (not (< (point) beg))
  40.        (string= ">" (buffer-substring (- beg 1) beg)))
  41.       (progn
  42.     (setq line (downcase (buffer-substring beg (point))))
  43.     (princ line)
  44.     (if (eq (parse ignore verblist line) -1)
  45.         (mprinc "I don't understand that.\n")))
  46.     (goto-char (point-max))
  47.     (mprinc "\n"))
  48.     (dungeon-messages))
  49.     
  50. (defun dungeon-messages ()
  51.   (if dead
  52.       (text-mode)
  53.     (if (eq dungeon-mode 'dungeon)
  54.     (progn
  55.       (if (not (= room current-room))
  56.           (progn
  57.         (describe-room current-room)
  58.         (setq room current-room)))
  59.       (fix-screen)
  60.       (mprinc ">")))))
  61.  
  62. (defun dungeon-start ()
  63.   (interactive)
  64.   (switch-to-buffer "*dungeon*")
  65.   (dungeon-mode)
  66.   (setq dead nil)
  67.   (setq room 0)
  68.   (dungeon-messages))
  69. (setq load-path (append load-path '("/usr/local/emacs/lisp")))
  70.  
  71. (require 'cl)
  72.  
  73. (defun batch-dungeon ()
  74.   (setq load-path (append load-path (list ".")))
  75.   (load "dun-batch")
  76.   (setq visited '(27))
  77.   (mprinc "\n")
  78.   (dungeon-batch-loop))
  79.  
  80.  
  81. (load "dun-commands")
  82. (load "dun-util")
  83. (if (setq glob (get-glob-dat))
  84.     (load-d glob)
  85.   (load "dun-globals"))
  86.  
  87. (load "dun-unix")
  88. (load "dun-dos")
  89. (load "dun-save")
  90. (random t)
  91. (setq tloc (+ 60 (% (abs (random)) 18)))
  92. (replace room-objects tloc (append (nth tloc room-objects) (list 18)))
  93. (setq tcomb (+ 100 (% (abs (random)) 899)))
  94. (setq combination (prin1-to-string tcomb))
  95.