diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index 164f112..f5d5d0e 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -180,7 +180,7 @@ organize a replacement?" say-after "What a talented and resourceful bear! Thank you very much, Pooh! Here, take a little something as a token of my gratitude." - ;quest-completed-hook "add-portrait" + completed-hook "add-portrait" proof-item "Picture frame" reward-item "Hunny" experience 5 diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index 164f112..f5d5d0e 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -180,7 +180,7 @@ organize a replacement?" say-after "What a talented and resourceful bear! Thank you very much, Pooh! Here, take a little something as a token of my gratitude." - ;quest-completed-hook "add-portrait" + completed-hook "add-portrait" proof-item "Picture frame" reward-item "Hunny" experience 5 diff --git a/ATL/Pooh/dialogue/portrait.txt b/ATL/Pooh/dialogue/portrait.txt new file mode 100644 index 0000000..a6d1331 --- /dev/null +++ b/ATL/Pooh/dialogue/portrait.txt @@ -0,0 +1,4 @@ + +Owl takes out a portrait and carefully fixes it in the frame. +He hangs the picture on the wall and steps back to look at it. +He nods, approvingly. diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index 164f112..f5d5d0e 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -180,7 +180,7 @@ organize a replacement?" say-after "What a talented and resourceful bear! Thank you very much, Pooh! Here, take a little something as a token of my gratitude." - ;quest-completed-hook "add-portrait" + completed-hook "add-portrait" proof-item "Picture frame" reward-item "Hunny" experience 5 diff --git a/ATL/Pooh/dialogue/portrait.txt b/ATL/Pooh/dialogue/portrait.txt new file mode 100644 index 0000000..a6d1331 --- /dev/null +++ b/ATL/Pooh/dialogue/portrait.txt @@ -0,0 +1,4 @@ + +Owl takes out a portrait and carefully fixes it in the frame. +He hangs the picture on the wall and steps back to look at it. +He nods, approvingly. diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 3e51243..bdf5cf3 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -225,12 +225,11 @@ (set-object-attribute place 'item "Hunny") (save-state 'ROCK-HONEY-FOUND)))))) -(defun stream-current (player &optional arg) ;;TODO TESTME +(defun stream-current (player &optional arg) "The stream sweeps the player on into the Floody place." (when (> 75 (random 100)) - (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(5 2 3 2)) - (goto player "Floody place") - (clear-screen))) + (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(4 2 2 4 3)) + (goto player "Floody place"))) (defun play (player &optional arg) "Let the player play a game" @@ -326,7 +325,8 @@ (defun add-portrait (player &optional arg) "Once Owl has the picture frame, he can hang up the portrait again." (set-object-attribute (get-game-object 'place (player-place player)) - 'item "Portrait")) + 'item "Portrait") + (narrate "../ATL/Pooh/dialogue/portrait.txt")) (defun smell-honey (player &optional arg) "The player smells honey when leaving the tunnel" diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index 164f112..f5d5d0e 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -180,7 +180,7 @@ organize a replacement?" say-after "What a talented and resourceful bear! Thank you very much, Pooh! Here, take a little something as a token of my gratitude." - ;quest-completed-hook "add-portrait" + completed-hook "add-portrait" proof-item "Picture frame" reward-item "Hunny" experience 5 diff --git a/ATL/Pooh/dialogue/portrait.txt b/ATL/Pooh/dialogue/portrait.txt new file mode 100644 index 0000000..a6d1331 --- /dev/null +++ b/ATL/Pooh/dialogue/portrait.txt @@ -0,0 +1,4 @@ + +Owl takes out a portrait and carefully fixes it in the frame. +He hangs the picture on the wall and steps back to look at it. +He nods, approvingly. diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 3e51243..bdf5cf3 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -225,12 +225,11 @@ (set-object-attribute place 'item "Hunny") (save-state 'ROCK-HONEY-FOUND)))))) -(defun stream-current (player &optional arg) ;;TODO TESTME +(defun stream-current (player &optional arg) "The stream sweeps the player on into the Floody place." (when (> 75 (random 100)) - (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(5 2 3 2)) - (goto player "Floody place") - (clear-screen))) + (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(4 2 2 4 3)) + (goto player "Floody place"))) (defun play (player &optional arg) "Let the player play a game" @@ -326,7 +325,8 @@ (defun add-portrait (player &optional arg) "Once Owl has the picture frame, he can hang up the portrait again." (set-object-attribute (get-game-object 'place (player-place player)) - 'item "Portrait")) + 'item "Portrait") + (narrate "../ATL/Pooh/dialogue/portrait.txt")) (defun smell-honey (player &optional arg) "The player smells honey when leaving the tunnel" diff --git a/doc/TODO b/doc/TODO index 3efeabe..42f16ce 100644 --- a/doc/TODO +++ b/doc/TODO @@ -4,8 +4,6 @@ * update Helios guide (include bug reporting with 'archive') * update documentation * fix (string-from-list) bug -* remove point 3 from the start menu -* add quest-completed-hook ATL * fill in missing place descriptions diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index 164f112..f5d5d0e 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -180,7 +180,7 @@ organize a replacement?" say-after "What a talented and resourceful bear! Thank you very much, Pooh! Here, take a little something as a token of my gratitude." - ;quest-completed-hook "add-portrait" + completed-hook "add-portrait" proof-item "Picture frame" reward-item "Hunny" experience 5 diff --git a/ATL/Pooh/dialogue/portrait.txt b/ATL/Pooh/dialogue/portrait.txt new file mode 100644 index 0000000..a6d1331 --- /dev/null +++ b/ATL/Pooh/dialogue/portrait.txt @@ -0,0 +1,4 @@ + +Owl takes out a portrait and carefully fixes it in the frame. +He hangs the picture on the wall and steps back to look at it. +He nods, approvingly. diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 3e51243..bdf5cf3 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -225,12 +225,11 @@ (set-object-attribute place 'item "Hunny") (save-state 'ROCK-HONEY-FOUND)))))) -(defun stream-current (player &optional arg) ;;TODO TESTME +(defun stream-current (player &optional arg) "The stream sweeps the player on into the Floody place." (when (> 75 (random 100)) - (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(5 2 3 2)) - (goto player "Floody place") - (clear-screen))) + (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(4 2 2 4 3)) + (goto player "Floody place"))) (defun play (player &optional arg) "Let the player play a game" @@ -326,7 +325,8 @@ (defun add-portrait (player &optional arg) "Once Owl has the picture frame, he can hang up the portrait again." (set-object-attribute (get-game-object 'place (player-place player)) - 'item "Portrait")) + 'item "Portrait") + (narrate "../ATL/Pooh/dialogue/portrait.txt")) (defun smell-honey (player &optional arg) "The player smells honey when leaving the tunnel" diff --git a/doc/TODO b/doc/TODO index 3efeabe..42f16ce 100644 --- a/doc/TODO +++ b/doc/TODO @@ -4,8 +4,6 @@ * update Helios guide (include bug reporting with 'archive') * update documentation * fix (string-from-list) bug -* remove point 3 from the start menu -* add quest-completed-hook ATL * fill in missing place descriptions diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 04055f2..d0aa1f1 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -15,7 +15,6 @@ (load "world.lisp") (load "interpreter.lisp") (load "ui.lisp") -(load "creator.lisp") (defvar *debugging* NIL) @@ -39,39 +38,11 @@ (print-text-file "banner.txt") (format t "~&~%Welcome! What do you want to do?") (setf options '("Start a new game" "Load a saved game" - "Advanced" "Help" "About" "Exit")) + "Help" "About" "Exit")) (case (choose-number-option options) - (0 ;; ask the player for his/her name - (setf player-name "") - (while (zerop (length player-name)) - (format t "~&What is your name? ") - (setf player-name (read-line))) - (if (and (member player-name - (mapcar #'pathname-name (directory "../saves/*")) - :test #'equalp) - (not (yes-or-no-p "A game by this player already exists. Replace it?"))) - (start-menu) - (setf (world-player-name *world*) player-name)) - ;; let the player choose one of the game worlds - (format t "~&Which world do you want to play?") - (let ((world (choose-option (append (keys *games*) '("Back"))))) - (if (equalp world "Back") (start-menu) - (setf world-file (cassoc world *games*))) - (setf world-file (concatenate 'string "../ATL/" world-file)) - (load-file world-file) - ;; let the player choose a character - (let* ((chars (append (list-world-objects 'player) - (list "Cancel"))) - (char-name (first chars))) - (when (< 2 (length chars)) - (format t "~&Which character do you want to play?") - (setf char-name (choose-option chars))) - (setf (world-main-character *world*) char-name) - (if (equalp char-name "Cancel") - (start-menu) - (play-game))))) - ;; choose a previously saved game + (0 (new-game)) (1 (format t "~&What game file do you want to load?") + ;; choose a previously saved game (let ((game (choose-option (append (mapcar #'pathname-name (directory "../saves/*")) '("Back"))))) @@ -80,17 +51,48 @@ game ".world")) (load-game game) (play-game))))) - (2 (world-creator)) ;;XXX Remove this from the main menu? - (3 (clear-screen) + (2 (clear-screen) (pager "../doc/PLAYING" T) (start-menu)) - (4 (print-version) + (3 (print-version) (when (y-or-n-p "~&~%Show the license text?") (pager "../doc/COPYING" T)) (start-menu)) - (5 (format t "~&Goodbye!") + (4 (format t "~&Goodbye!") (quit)))) - + +(defun new-game () + "Set up a new game." + ;; ask the player for his/her name + (setf player-name "") + (while (zerop (length player-name)) + (format t "~&What is your name? ") + (setf player-name (read-line))) + (if (and (member player-name + (mapcar #'pathname-name (directory "../saves/*")) + :test #'equalp) + (not (yes-or-no-p "A game by this player already exists. Replace it?"))) + (start-menu) + (setf (world-player-name *world*) player-name)) + ;; let the player choose one of the game worlds + (format t "~&Which world do you want to play?") + (let ((world (choose-option (append (keys *games*) '("Back"))))) + (if (equalp world "Back") (start-menu) + (setf world-file (cassoc world *games*))) + (setf world-file (concatenate 'string "../ATL/" world-file)) + (load-file world-file) + ;; let the player choose a character + (let* ((chars (append (list-world-objects 'player) + (list "Cancel"))) + (char-name (first chars))) + (when (< 2 (length chars)) + (format t "~&Which character do you want to play?") + (setf char-name (choose-option chars))) + (setf (world-main-character *world*) char-name) + (if (equalp char-name "Cancel") + (start-menu) + (play-game))))) + (defun cmd-parameter (name &optional truth-value) "Return the value of the parameter 'name'. Or T for present if truth-value." (let ((argument (member name *args* :test #'equalp))) diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index 164f112..f5d5d0e 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -180,7 +180,7 @@ organize a replacement?" say-after "What a talented and resourceful bear! Thank you very much, Pooh! Here, take a little something as a token of my gratitude." - ;quest-completed-hook "add-portrait" + completed-hook "add-portrait" proof-item "Picture frame" reward-item "Hunny" experience 5 diff --git a/ATL/Pooh/dialogue/portrait.txt b/ATL/Pooh/dialogue/portrait.txt new file mode 100644 index 0000000..a6d1331 --- /dev/null +++ b/ATL/Pooh/dialogue/portrait.txt @@ -0,0 +1,4 @@ + +Owl takes out a portrait and carefully fixes it in the frame. +He hangs the picture on the wall and steps back to look at it. +He nods, approvingly. diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 3e51243..bdf5cf3 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -225,12 +225,11 @@ (set-object-attribute place 'item "Hunny") (save-state 'ROCK-HONEY-FOUND)))))) -(defun stream-current (player &optional arg) ;;TODO TESTME +(defun stream-current (player &optional arg) "The stream sweeps the player on into the Floody place." (when (> 75 (random 100)) - (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(5 2 3 2)) - (goto player "Floody place") - (clear-screen))) + (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(4 2 2 4 3)) + (goto player "Floody place"))) (defun play (player &optional arg) "Let the player play a game" @@ -326,7 +325,8 @@ (defun add-portrait (player &optional arg) "Once Owl has the picture frame, he can hang up the portrait again." (set-object-attribute (get-game-object 'place (player-place player)) - 'item "Portrait")) + 'item "Portrait") + (narrate "../ATL/Pooh/dialogue/portrait.txt")) (defun smell-honey (player &optional arg) "The player smells honey when leaving the tunnel" diff --git a/doc/TODO b/doc/TODO index 3efeabe..42f16ce 100644 --- a/doc/TODO +++ b/doc/TODO @@ -4,8 +4,6 @@ * update Helios guide (include bug reporting with 'archive') * update documentation * fix (string-from-list) bug -* remove point 3 from the start menu -* add quest-completed-hook ATL * fill in missing place descriptions diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 04055f2..d0aa1f1 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -15,7 +15,6 @@ (load "world.lisp") (load "interpreter.lisp") (load "ui.lisp") -(load "creator.lisp") (defvar *debugging* NIL) @@ -39,39 +38,11 @@ (print-text-file "banner.txt") (format t "~&~%Welcome! What do you want to do?") (setf options '("Start a new game" "Load a saved game" - "Advanced" "Help" "About" "Exit")) + "Help" "About" "Exit")) (case (choose-number-option options) - (0 ;; ask the player for his/her name - (setf player-name "") - (while (zerop (length player-name)) - (format t "~&What is your name? ") - (setf player-name (read-line))) - (if (and (member player-name - (mapcar #'pathname-name (directory "../saves/*")) - :test #'equalp) - (not (yes-or-no-p "A game by this player already exists. Replace it?"))) - (start-menu) - (setf (world-player-name *world*) player-name)) - ;; let the player choose one of the game worlds - (format t "~&Which world do you want to play?") - (let ((world (choose-option (append (keys *games*) '("Back"))))) - (if (equalp world "Back") (start-menu) - (setf world-file (cassoc world *games*))) - (setf world-file (concatenate 'string "../ATL/" world-file)) - (load-file world-file) - ;; let the player choose a character - (let* ((chars (append (list-world-objects 'player) - (list "Cancel"))) - (char-name (first chars))) - (when (< 2 (length chars)) - (format t "~&Which character do you want to play?") - (setf char-name (choose-option chars))) - (setf (world-main-character *world*) char-name) - (if (equalp char-name "Cancel") - (start-menu) - (play-game))))) - ;; choose a previously saved game + (0 (new-game)) (1 (format t "~&What game file do you want to load?") + ;; choose a previously saved game (let ((game (choose-option (append (mapcar #'pathname-name (directory "../saves/*")) '("Back"))))) @@ -80,17 +51,48 @@ game ".world")) (load-game game) (play-game))))) - (2 (world-creator)) ;;XXX Remove this from the main menu? - (3 (clear-screen) + (2 (clear-screen) (pager "../doc/PLAYING" T) (start-menu)) - (4 (print-version) + (3 (print-version) (when (y-or-n-p "~&~%Show the license text?") (pager "../doc/COPYING" T)) (start-menu)) - (5 (format t "~&Goodbye!") + (4 (format t "~&Goodbye!") (quit)))) - + +(defun new-game () + "Set up a new game." + ;; ask the player for his/her name + (setf player-name "") + (while (zerop (length player-name)) + (format t "~&What is your name? ") + (setf player-name (read-line))) + (if (and (member player-name + (mapcar #'pathname-name (directory "../saves/*")) + :test #'equalp) + (not (yes-or-no-p "A game by this player already exists. Replace it?"))) + (start-menu) + (setf (world-player-name *world*) player-name)) + ;; let the player choose one of the game worlds + (format t "~&Which world do you want to play?") + (let ((world (choose-option (append (keys *games*) '("Back"))))) + (if (equalp world "Back") (start-menu) + (setf world-file (cassoc world *games*))) + (setf world-file (concatenate 'string "../ATL/" world-file)) + (load-file world-file) + ;; let the player choose a character + (let* ((chars (append (list-world-objects 'player) + (list "Cancel"))) + (char-name (first chars))) + (when (< 2 (length chars)) + (format t "~&Which character do you want to play?") + (setf char-name (choose-option chars))) + (setf (world-main-character *world*) char-name) + (if (equalp char-name "Cancel") + (start-menu) + (play-game))))) + (defun cmd-parameter (name &optional truth-value) "Return the value of the parameter 'name'. Or T for present if truth-value." (let ((argument (member name *args* :test #'equalp))) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index 368ce0b..aeb7fdd 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -11,6 +11,10 @@ ;;; date: 20/06/2015 ;;; +;; To avoid confused players, I have diked this out of the Atlantis main menu. +;; To use the spreadsheet import function, load this file from inside a Lisp +;; interpreter and call the (world-creator) function. + (defun import-spreadsheet (spreadsheet atl-file) "Import and convert a spreadsheet (requires LibreOffice)" (let* ((ods-pathname (parse-namestring spreadsheet)) diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index 164f112..f5d5d0e 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -180,7 +180,7 @@ organize a replacement?" say-after "What a talented and resourceful bear! Thank you very much, Pooh! Here, take a little something as a token of my gratitude." - ;quest-completed-hook "add-portrait" + completed-hook "add-portrait" proof-item "Picture frame" reward-item "Hunny" experience 5 diff --git a/ATL/Pooh/dialogue/portrait.txt b/ATL/Pooh/dialogue/portrait.txt new file mode 100644 index 0000000..a6d1331 --- /dev/null +++ b/ATL/Pooh/dialogue/portrait.txt @@ -0,0 +1,4 @@ + +Owl takes out a portrait and carefully fixes it in the frame. +He hangs the picture on the wall and steps back to look at it. +He nods, approvingly. diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 3e51243..bdf5cf3 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -225,12 +225,11 @@ (set-object-attribute place 'item "Hunny") (save-state 'ROCK-HONEY-FOUND)))))) -(defun stream-current (player &optional arg) ;;TODO TESTME +(defun stream-current (player &optional arg) "The stream sweeps the player on into the Floody place." (when (> 75 (random 100)) - (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(5 2 3 2)) - (goto player "Floody place") - (clear-screen))) + (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(4 2 2 4 3)) + (goto player "Floody place"))) (defun play (player &optional arg) "Let the player play a game" @@ -326,7 +325,8 @@ (defun add-portrait (player &optional arg) "Once Owl has the picture frame, he can hang up the portrait again." (set-object-attribute (get-game-object 'place (player-place player)) - 'item "Portrait")) + 'item "Portrait") + (narrate "../ATL/Pooh/dialogue/portrait.txt")) (defun smell-honey (player &optional arg) "The player smells honey when leaving the tunnel" diff --git a/doc/TODO b/doc/TODO index 3efeabe..42f16ce 100644 --- a/doc/TODO +++ b/doc/TODO @@ -4,8 +4,6 @@ * update Helios guide (include bug reporting with 'archive') * update documentation * fix (string-from-list) bug -* remove point 3 from the start menu -* add quest-completed-hook ATL * fill in missing place descriptions diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 04055f2..d0aa1f1 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -15,7 +15,6 @@ (load "world.lisp") (load "interpreter.lisp") (load "ui.lisp") -(load "creator.lisp") (defvar *debugging* NIL) @@ -39,39 +38,11 @@ (print-text-file "banner.txt") (format t "~&~%Welcome! What do you want to do?") (setf options '("Start a new game" "Load a saved game" - "Advanced" "Help" "About" "Exit")) + "Help" "About" "Exit")) (case (choose-number-option options) - (0 ;; ask the player for his/her name - (setf player-name "") - (while (zerop (length player-name)) - (format t "~&What is your name? ") - (setf player-name (read-line))) - (if (and (member player-name - (mapcar #'pathname-name (directory "../saves/*")) - :test #'equalp) - (not (yes-or-no-p "A game by this player already exists. Replace it?"))) - (start-menu) - (setf (world-player-name *world*) player-name)) - ;; let the player choose one of the game worlds - (format t "~&Which world do you want to play?") - (let ((world (choose-option (append (keys *games*) '("Back"))))) - (if (equalp world "Back") (start-menu) - (setf world-file (cassoc world *games*))) - (setf world-file (concatenate 'string "../ATL/" world-file)) - (load-file world-file) - ;; let the player choose a character - (let* ((chars (append (list-world-objects 'player) - (list "Cancel"))) - (char-name (first chars))) - (when (< 2 (length chars)) - (format t "~&Which character do you want to play?") - (setf char-name (choose-option chars))) - (setf (world-main-character *world*) char-name) - (if (equalp char-name "Cancel") - (start-menu) - (play-game))))) - ;; choose a previously saved game + (0 (new-game)) (1 (format t "~&What game file do you want to load?") + ;; choose a previously saved game (let ((game (choose-option (append (mapcar #'pathname-name (directory "../saves/*")) '("Back"))))) @@ -80,17 +51,48 @@ game ".world")) (load-game game) (play-game))))) - (2 (world-creator)) ;;XXX Remove this from the main menu? - (3 (clear-screen) + (2 (clear-screen) (pager "../doc/PLAYING" T) (start-menu)) - (4 (print-version) + (3 (print-version) (when (y-or-n-p "~&~%Show the license text?") (pager "../doc/COPYING" T)) (start-menu)) - (5 (format t "~&Goodbye!") + (4 (format t "~&Goodbye!") (quit)))) - + +(defun new-game () + "Set up a new game." + ;; ask the player for his/her name + (setf player-name "") + (while (zerop (length player-name)) + (format t "~&What is your name? ") + (setf player-name (read-line))) + (if (and (member player-name + (mapcar #'pathname-name (directory "../saves/*")) + :test #'equalp) + (not (yes-or-no-p "A game by this player already exists. Replace it?"))) + (start-menu) + (setf (world-player-name *world*) player-name)) + ;; let the player choose one of the game worlds + (format t "~&Which world do you want to play?") + (let ((world (choose-option (append (keys *games*) '("Back"))))) + (if (equalp world "Back") (start-menu) + (setf world-file (cassoc world *games*))) + (setf world-file (concatenate 'string "../ATL/" world-file)) + (load-file world-file) + ;; let the player choose a character + (let* ((chars (append (list-world-objects 'player) + (list "Cancel"))) + (char-name (first chars))) + (when (< 2 (length chars)) + (format t "~&Which character do you want to play?") + (setf char-name (choose-option chars))) + (setf (world-main-character *world*) char-name) + (if (equalp char-name "Cancel") + (start-menu) + (play-game))))) + (defun cmd-parameter (name &optional truth-value) "Return the value of the parameter 'name'. Or T for present if truth-value." (let ((argument (member name *args* :test #'equalp))) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index 368ce0b..aeb7fdd 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -11,6 +11,10 @@ ;;; date: 20/06/2015 ;;; +;; To avoid confused players, I have diked this out of the Atlantis main menu. +;; To use the spreadsheet import function, load this file from inside a Lisp +;; interpreter and call the (world-creator) function. + (defun import-spreadsheet (spreadsheet atl-file) "Import and convert a spreadsheet (requires LibreOffice)" (let* ((ods-pathname (parse-namestring spreadsheet)) diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index f1c969c..1ab9f3a 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -75,6 +75,7 @@ (reward-item NIL) (money 0) (experience 0) + (completed-hook "") (infinite)) diff --git a/ATL/Pooh/characters.atl b/ATL/Pooh/characters.atl index 164f112..f5d5d0e 100644 --- a/ATL/Pooh/characters.atl +++ b/ATL/Pooh/characters.atl @@ -180,7 +180,7 @@ organize a replacement?" say-after "What a talented and resourceful bear! Thank you very much, Pooh! Here, take a little something as a token of my gratitude." - ;quest-completed-hook "add-portrait" + completed-hook "add-portrait" proof-item "Picture frame" reward-item "Hunny" experience 5 diff --git a/ATL/Pooh/dialogue/portrait.txt b/ATL/Pooh/dialogue/portrait.txt new file mode 100644 index 0000000..a6d1331 --- /dev/null +++ b/ATL/Pooh/dialogue/portrait.txt @@ -0,0 +1,4 @@ + +Owl takes out a portrait and carefully fixes it in the frame. +He hangs the picture on the wall and steps back to look at it. +He nods, approvingly. diff --git a/ATL/Pooh/pooh-extensions.lisp b/ATL/Pooh/pooh-extensions.lisp index 3e51243..bdf5cf3 100644 --- a/ATL/Pooh/pooh-extensions.lisp +++ b/ATL/Pooh/pooh-extensions.lisp @@ -225,12 +225,11 @@ (set-object-attribute place 'item "Hunny") (save-state 'ROCK-HONEY-FOUND)))))) -(defun stream-current (player &optional arg) ;;TODO TESTME +(defun stream-current (player &optional arg) "The stream sweeps the player on into the Floody place." (when (> 75 (random 100)) - (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(5 2 3 2)) - (goto player "Floody place") - (clear-screen))) + (narrate "../ATL/Pooh/dialogue/stream-current.txt" '(4 2 2 4 3)) + (goto player "Floody place"))) (defun play (player &optional arg) "Let the player play a game" @@ -326,7 +325,8 @@ (defun add-portrait (player &optional arg) "Once Owl has the picture frame, he can hang up the portrait again." (set-object-attribute (get-game-object 'place (player-place player)) - 'item "Portrait")) + 'item "Portrait") + (narrate "../ATL/Pooh/dialogue/portrait.txt")) (defun smell-honey (player &optional arg) "The player smells honey when leaving the tunnel" diff --git a/doc/TODO b/doc/TODO index 3efeabe..42f16ce 100644 --- a/doc/TODO +++ b/doc/TODO @@ -4,8 +4,6 @@ * update Helios guide (include bug reporting with 'archive') * update documentation * fix (string-from-list) bug -* remove point 3 from the start menu -* add quest-completed-hook ATL * fill in missing place descriptions diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 04055f2..d0aa1f1 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -15,7 +15,6 @@ (load "world.lisp") (load "interpreter.lisp") (load "ui.lisp") -(load "creator.lisp") (defvar *debugging* NIL) @@ -39,39 +38,11 @@ (print-text-file "banner.txt") (format t "~&~%Welcome! What do you want to do?") (setf options '("Start a new game" "Load a saved game" - "Advanced" "Help" "About" "Exit")) + "Help" "About" "Exit")) (case (choose-number-option options) - (0 ;; ask the player for his/her name - (setf player-name "") - (while (zerop (length player-name)) - (format t "~&What is your name? ") - (setf player-name (read-line))) - (if (and (member player-name - (mapcar #'pathname-name (directory "../saves/*")) - :test #'equalp) - (not (yes-or-no-p "A game by this player already exists. Replace it?"))) - (start-menu) - (setf (world-player-name *world*) player-name)) - ;; let the player choose one of the game worlds - (format t "~&Which world do you want to play?") - (let ((world (choose-option (append (keys *games*) '("Back"))))) - (if (equalp world "Back") (start-menu) - (setf world-file (cassoc world *games*))) - (setf world-file (concatenate 'string "../ATL/" world-file)) - (load-file world-file) - ;; let the player choose a character - (let* ((chars (append (list-world-objects 'player) - (list "Cancel"))) - (char-name (first chars))) - (when (< 2 (length chars)) - (format t "~&Which character do you want to play?") - (setf char-name (choose-option chars))) - (setf (world-main-character *world*) char-name) - (if (equalp char-name "Cancel") - (start-menu) - (play-game))))) - ;; choose a previously saved game + (0 (new-game)) (1 (format t "~&What game file do you want to load?") + ;; choose a previously saved game (let ((game (choose-option (append (mapcar #'pathname-name (directory "../saves/*")) '("Back"))))) @@ -80,17 +51,48 @@ game ".world")) (load-game game) (play-game))))) - (2 (world-creator)) ;;XXX Remove this from the main menu? - (3 (clear-screen) + (2 (clear-screen) (pager "../doc/PLAYING" T) (start-menu)) - (4 (print-version) + (3 (print-version) (when (y-or-n-p "~&~%Show the license text?") (pager "../doc/COPYING" T)) (start-menu)) - (5 (format t "~&Goodbye!") + (4 (format t "~&Goodbye!") (quit)))) - + +(defun new-game () + "Set up a new game." + ;; ask the player for his/her name + (setf player-name "") + (while (zerop (length player-name)) + (format t "~&What is your name? ") + (setf player-name (read-line))) + (if (and (member player-name + (mapcar #'pathname-name (directory "../saves/*")) + :test #'equalp) + (not (yes-or-no-p "A game by this player already exists. Replace it?"))) + (start-menu) + (setf (world-player-name *world*) player-name)) + ;; let the player choose one of the game worlds + (format t "~&Which world do you want to play?") + (let ((world (choose-option (append (keys *games*) '("Back"))))) + (if (equalp world "Back") (start-menu) + (setf world-file (cassoc world *games*))) + (setf world-file (concatenate 'string "../ATL/" world-file)) + (load-file world-file) + ;; let the player choose a character + (let* ((chars (append (list-world-objects 'player) + (list "Cancel"))) + (char-name (first chars))) + (when (< 2 (length chars)) + (format t "~&Which character do you want to play?") + (setf char-name (choose-option chars))) + (setf (world-main-character *world*) char-name) + (if (equalp char-name "Cancel") + (start-menu) + (play-game))))) + (defun cmd-parameter (name &optional truth-value) "Return the value of the parameter 'name'. Or T for present if truth-value." (let ((argument (member name *args* :test #'equalp))) diff --git a/lisp/creator.lisp b/lisp/creator.lisp index 368ce0b..aeb7fdd 100644 --- a/lisp/creator.lisp +++ b/lisp/creator.lisp @@ -11,6 +11,10 @@ ;;; date: 20/06/2015 ;;; +;; To avoid confused players, I have diked this out of the Atlantis main menu. +;; To use the spreadsheet import function, load this file from inside a Lisp +;; interpreter and call the (world-creator) function. + (defun import-spreadsheet (spreadsheet atl-file) "Import and convert a spreadsheet (requires LibreOffice)" (let* ((ods-pathname (parse-namestring spreadsheet)) diff --git a/lisp/game-objects.lisp b/lisp/game-objects.lisp index f1c969c..1ab9f3a 100644 --- a/lisp/game-objects.lisp +++ b/lisp/game-objects.lisp @@ -75,6 +75,7 @@ (reward-item NIL) (money 0) (experience 0) + (completed-hook "") (infinite)) diff --git a/lisp/ui.lisp b/lisp/ui.lisp index 55a50aa..c224997 100644 --- a/lisp/ui.lisp +++ b/lisp/ui.lisp @@ -286,6 +286,8 @@ (quest-money quest) (quest-experience quest) (string-from-list (quest-reward-item quest) :line-length *max-line-items*)) + (let ((hook (quest-completed-hook quest))) + (unless (zerop (length hook)) (funcall (read-from-string hook) player))) (unless (quest-infinite quest) (remove-object-attribute npc 'quest npc))))))