First, a big tip of the hat to Jim Lipsit for his RandomSpeak utility. It is a nice, clean simple solution to the problem of making HAL speak a bit less rigidly.

Those interested in HAL should also know that there is another free tool to do this sort of thing.

Jim and I were inspired at about the same time to address the same issue, and we competed a little bit in the process, and came up with different tools to do the job. I did cheat just a little and also use another of Jim's excellent tools, HAL_Interface to make my program a little more flexible. So thanks to Jim's efforts you have two tools to chose from.

I call mine Sass, and it does more-or-less what RandomSpeak does, but with some additional features.

(1) Not only does it generate text (TTS) and wave file responses randomly from a list of predefined responses, much as RandomSpeak does, but it allows responses to be weighted. So you can have some responses come up most of the time, and an occasional wild or ribald response come up, but very rarely. i.e. You can define ten responses with a weighting of 10, and ten responses with a weighting of 1, and the ones weighted 1 will come up only about 10% of the time.

(2) Weighting of responses can be changed based on HAL variables. For example, set a flag named "GuestsPresent" in HAL and a group of responses suitable for guests can be given a higher weighting.

(3) It can set a flag in HAL to remember when a given response has been returned. Then subsequent responses can be flavored based on prior responses.

e.g. Q: "How Are you today HAL?"
A: "I am fine, how are you?"
Q: "How Are You Today HAL?"
A: "Why are you repeating yourself?"

(4) It can also run an external program based on the response that comes back. Each response in a given group can invoke a different program, or any other combination.

And finally, it comes with complete source and documentation so that you can analyze how it works and enhance it to your own needs. It is written in Perl, for which the language and development tools are all also free.

If you'd like to go beyond basic randomizing of responses, give Sass a try.

http://www.geocities.com/wa4otj/Sass.html

The version marked 1.21 (experimental) is now in wide use, and I recommend it. I just haven't updated the web page yet to reflect this. Feel free to study the code for yourself and use which ever version you prefer.

For those who don't want to play with Perl itself, I also offer version 1.21 as a compiled binary, ready to run. But it does still require the support utilities CDBFLite and HAL_Interface to run.

Enjoy,
Nathan