Inform 7 Home Page / Documentation


§6.13. Magic Words

Many fantasy games incorporate the idea of magic words that can be spoken. In implementing these, we want to be a bit flexible and accept a range of input regardless of whether the player explicitly speaks the command aloud: XYZZY, SAY XYZZY, or perhaps even CAST XYZZY. The inventively named Xyzzy demonstrates how we might define such a command.

If we want to go even further and to allow the player also to use quotation marks, as in SAY "XYZZY", we may want to include Punctuation Removal by Emily Short, which allows for quotation marks to be stripped out of the player's input before it is understood.


arrow-up.png Start of Chapter 6: Commands
arrow-left.png Back to §6.12. Other Built-In Actions
arrow-right.png Onward to §6.14. Remembering, Converting and Combining Actions

*ExampleXYZZY
Basics of adding a new command reviewed, for the case of the simple magic word XYZZY.