Comments (3)
You can do that with events (events are nothing special actually, just a set in the game map), but not using those dialog helpers but with verb post/pre conditions. It would be something along the lines:
;; add a postcondition to the read verb of the note item, to set an event
(defn after-read-note [oldgs gs] (update-in gs [:events] conj :note-read))
(def note (item/make "a note" "it has text in it" :read {:say "(note contents)" :post `after-read-note}))
;; conditionally allow to enter a room depending on the presence of the read note event
(defn has-read-note [gs]
(if ((:events gs) :note-read)
:my-room
"I don't know the coordinates"))
(def room-map (-> {:some-room some-room
:my-room my-room}
(room/one-way-connect :some-room :north `has-read-note)))
There may be some typos there, but that's the general idea. Take a look on the example-game and house-taken-over for examples on post/pre conditions and how to lock some locations depending on some condition.
from advenjure.
Beautiful! It all works like a charm.
I had everything figured out, except I hadn't zeroed in on the :post functionality yet. But now I have. :-)
Thanks for the quick help. I'm loving this! You can consider this newbie issue closed.
from advenjure.
Great.
from advenjure.
Related Issues (20)
- change rooms clear keeps previous line
- need some way of considering a verb successful to properly evaluate the postcondition.
- simple hint system
- shortcut to use arrows for directions
- gettext or replacement not working in cljs HOT 11
- font size up with cmd
- JLINE autocomplete doesn't work with multiword items
- give to verb
- some way of easily adding "cutscenes"?
- cljs tests
- update gettext dictionaries HOT 1
- refactor basic API to favor a declarative/data-oriented style
- consider clojure.spec
- try not to use eval
- are records needed?
- consider dropping Clojure (target only ClojureScript) HOT 4
- Unify core async requires
- Feature request: shadow cljs
- Use quotes for dialogs
- Scrollbar bug on GitHub pages
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from advenjure.