Although I am a professional programmer, I have to say I’m struggling a bit with some aspects of Inform 7. I seem to be relying of random scatterings of examples, rather than having the clear syntax explained to me. Maybe I’m looking in the wrong place.
For example, as a test I’m trying to get a character to respond when you say the word “Hello”.
Say Hello to Dave
“Hi Steve, how’s it going”. - Says Dave
I just can’t seem to get it to work though.
The closest example I can find is of the form “Instead of saying yes in the presence of…”
So I wrote this.
“Test” by Steve
The ballroom is a room. Dave is a man in the ballroom.
Instead of saying yes in the presence of Dave:
say “That was a bit non-sequitur.”
The code doesn’t actually work though. The response to saying yes is just…
There is no reply.
Worse still, if I change yes to hello (which is the word I wanted), it won’t even compile. Clearly “yes” is a special word that I7 understands. But what if I want to process anything the player says. Surely it would make sense to be able to capture any word in a “Instead of saying” clause.
Also, I don’t really want Dave to just respond when I say “Hello” in his presence. There might be other people present after all. However, if I change the code to the very obvious line “Instead of saying yes to Dave:”, it refuses to compile.
Either the documentation to speaking with NPCs is lacking or I am really missing something in the manual.