diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index cd98317..0cecc65 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -102,6 +102,7 @@ rather big ears. His fingers are drumming around on some strange black box that is lying open in front of him." says "Hi Pooh, pleased to meet you at last!" + interaction-hook "daniel-says" ; QUESTS diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index cd98317..0cecc65 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -102,6 +102,7 @@ rather big ears. His fingers are drumming around on some strange black box that is lying open in front of him." says "Hi Pooh, pleased to meet you at last!" + interaction-hook "daniel-says" ; QUESTS diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 2f845a1..b72be80 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -178,3 +178,27 @@ (format t "~&You feel a stab of pain in your heart as you watch the ring drop.") (format t "~&On second thoughts, you pick it up again.~%~%") (take player "Golden ring")) + + +;; When somebody plays on my server (Helios), he can leave me a message... + +(defun daniel-says (player) + "Leave a message for the real me" + (unless (y-or-n-p "~&~%Daniel has more to say to you. Do you want to hear it?") + (return-from daniel-says)) + (setf msg "~%DANIEL: +Hi there! This is the 'real' Daniel speaking now... Great to see that you've +gotten so far in the game! I've spent two years and many, many hours getting +it into shape, so I'm very happy to have other people actually using it :-) +~%If you happen to be playing on my server at the moment, you can actually +leave me a message if you like. I'll definitely read it, and would very much +appreciate any feedback!") + (format t msg) + (when (y-or-n-p "~&~%Leave Daniel a message?") + (format t "~&~%What is your name?") + (input-string name) + (setf message (lisp-ed)) + (unless (null message) + (write-to-file message + (string-from-list (list "../" name ".msg") "") T) + (format t "~&Thank you very much :-)")))) diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index cd98317..0cecc65 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -102,6 +102,7 @@ rather big ears. His fingers are drumming around on some strange black box that is lying open in front of him." says "Hi Pooh, pleased to meet you at last!" + interaction-hook "daniel-says" ; QUESTS diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 2f845a1..b72be80 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -178,3 +178,27 @@ (format t "~&You feel a stab of pain in your heart as you watch the ring drop.") (format t "~&On second thoughts, you pick it up again.~%~%") (take player "Golden ring")) + + +;; When somebody plays on my server (Helios), he can leave me a message... + +(defun daniel-says (player) + "Leave a message for the real me" + (unless (y-or-n-p "~&~%Daniel has more to say to you. Do you want to hear it?") + (return-from daniel-says)) + (setf msg "~%DANIEL: +Hi there! This is the 'real' Daniel speaking now... Great to see that you've +gotten so far in the game! I've spent two years and many, many hours getting +it into shape, so I'm very happy to have other people actually using it :-) +~%If you happen to be playing on my server at the moment, you can actually +leave me a message if you like. I'll definitely read it, and would very much +appreciate any feedback!") + (format t msg) + (when (y-or-n-p "~&~%Leave Daniel a message?") + (format t "~&~%What is your name?") + (input-string name) + (setf message (lisp-ed)) + (unless (null message) + (write-to-file message + (string-from-list (list "../" name ".msg") "") T) + (format t "~&Thank you very much :-)")))) diff --git a/lisp/util.lisp b/lisp/util.lisp index 2e14d6e..0317d9d 100644 --- a/lisp/util.lisp +++ b/lisp/util.lisp @@ -214,7 +214,8 @@ "Write text (a string or list of strings) to the specified file" (let ((text-list (if (listp text) text (list text))) (f (if append - (open filename :direction :output :if-exists :append) + (open filename :direction :output :if-exists :append + :if-does-not-exist :create) (open filename :direction :output)))) (dolist (line text-list) (format f "~&~A~&" line)) @@ -255,6 +256,28 @@ ;; Basically just a utility wrapper (nth (choose-number-option option-list) option-list)) +(defun lisp-ed () + "A very, very basic line editor for inputing several lines of text." + (flet ((text-input () + (format t "~&$ ") + (do* ((line (read-line) (read-line)) + (text line (string-from-list + (list text line) #\newline))) + ((equalp line ".") (first (cut-string text + (- (length text) 2)))) + (format t "$ ")))) + (setf help-msg " +Input your text below. When you are done, finish with a line that contains only +a single fullstop. If you make a mistake, you can still edit your text later.") + (format t help-msg) + (setf text (text-input)) + (while (not (y-or-n-p "~&Save and exit?")) + (when (y-or-n-p "~&Cancel and exit?") + (return-from lisp-ed)) + (format t "~&Please reenter your text:") + (setf text (text-input))) + text)) + (defun clear-screen () "Clear the screen in an OS-dependent manner" ;; NOTE: only works with CLISP! (ext:shell function used)