;;;; behaviour-scripts ;;;; a proof-of-concept for scripting dialogue and other behaviours (ql:quickload :generators) (use-package :generators) (defun dialogue-running (handle) (cdr handle)) (defun example-conversation () (make-generator () (yield :dialogue "Hello! This is an example conversation. I will now ask you a test question.") (case (yield :ask-question "Nice of the princess to invite us over for a picnic, eh Luigi?") (:spaghetti (yield :dialogue "This is the correct response.") (let ((dialogue-handle (yield :async-dialogue "Blah blah blah tutorial stuff. I'll listen for signals while I'm talking."))) (loop do (case (yield :await-signal) (:tutorial-failure (yield :dialogue "No, no, no! The electron frobnicator goes IN the other thingy!!!")) (:tutorial-success (if (dialogue-running dialogue-handle) (progn (yield :dialogue "Wow, you won't even listen to my help? I see how it is.") (yield :set-emotion :offended)) (yield :dialogue "Good! That concludes the tutorial.")) (loop-finish)) (:earthquake (yield :dialogue "The FUCK was that???"))))) (yield :walk-to-exit)) (:penis (yield :dialogue "This is an incorrect response, but it was received correctly.")) (t (yield :error "The yield statement returned an unexpected result.")))))