version 10 by Michael Martin
Section: Defining and firing off quips
The most fundamental concept in the extension is the "quip". Quips are values, not things; they are used to index into the quip tables.
Thus, the one task we must always perform is filling in the Table of Quip Texts. A default table is provided by the extension, so you will need to continue the table in your own code:
Table of Quip Texts (continued)
|greeting||"'Why, hello there!'"|
|discuss weather||"'Looks like rain, or my name isn't George Washington.'"|
|standoff||"'What's it to you, Mac?'"|
We then (if we are using the ask/tell model) use the Table of Ask Results and Table of Tell Results to attach quips to NPCs and topics. The topics may be patterns, much like understanding commands as actions are. However, the library will match against any text that contains the topic (much like the "Complimentary Peanuts" example in the Recipe Book). The results are quips.
Table of Ask Results (continued)
|Bob||"weather" or "nice day"||discuss weather|
Table of Tell Results (continued)
People have a "default ask quip" and "default tell quip" that can be used to give a generic response to unknown topics. This defaults to the first two quips in the table, which are predefined to "You can't think of anything to say on that topic." If you wish to universally redefine either of these, redefine the globals "generic ask quip" or "generic tell quip". See also "Customizing parser messages", below.
We can also script quip delivery:
Instead of examining Bob, deliver the greeting quip.