Celeste's guide to Bots

There are two kinds of bots on the moo. One is simple and one is more complex. Both extend the puppet class and so can be controlled by you directly. Neither currently implements a way to turn them off so they do not act autonymously. Neither will talk unless there is one and only one person in the room with it. Neither will speak before recieving some sort of message from you. If you put more than one bot in a room with you, they will talk to each other after you speak. Let's talk first about simple bots.

Simple Bots
Simple bots extend the generic bot object (#178). There is an example of a simple bot in the first room (#62) and in casaninja. Simple bots only respond to spoken text and only output spoken text. They cannot understand poses or pose themselves. They have four kinds of text they can output: starter, filler, answers and greetings. Greetings (hello, hi, etc) are outputted when the bot detects that someone new is speaking to it. Answers are outputted When the bot hears a sentence ending with a question mark. Filler is outputted when the bot is not bored and starter is outputted when it is.

The bot tracks boredom via the length of your sentences. If you utter less than a certain number of words for a certain number of replies you will be deemed bored (or boring, depending on your perspective) and the bot will stop grabbing it's replies from the filler array and grab one from the starter array. All of it's replies, once it decided what array to use, are completely random. It may come up with the same one several times in a row. You can make it more or less bored with the verbs more_bored and less_bored. You can make it's desired sentence length more or less talkative with more_talkative or less_talkative. And you can add phrases with the verbs add_answer add_starter add_filler and add_greeting. If you accidentally put in a phrase you don't like, you can elminate it by useing @notedit to manipulate the arrays directly.

Starter should be filled with long sentences that might start conversations. Like "The 49ers ought to fire Joe Montanna. He's too old. And I just saw him in a Mervyns ad." Filler should be filled with phrases that are interjected into the middle of somebody else talking, like, "oh", "cool", and "really?" Answers should be as noncommital as possible, since you have no way of knowing what sort of questions you may be asked. "I dunno" works well.

Complex Bots
The generic enhanced bot class is not currently aviable, but cthe documentation is still in here in case somebody decides to rewrite it
Complex bots are really two classes. One is generic enhance bot (#964) and the other is generic reply manager (#1061). There is a complex bot in Wall Berlin (#858) Complex bots work very much like simple bots in their handling of boredom and greetings. We're first going to look at how to create one and set it up. First we @create one in the normal way, but then we must init it.

init MyBot
starter #1074 created
filler #1075 created
greeting #1076 created
#1077 created to match statements ending with ?
Remeber those object numbers! You add your phrases directly to them. To add a text reply (MyBot says, "text reply"), use the object number and add_text. So it's add_text "text" to [obj]. Adding a pose is the same, except the verb is add_pose.
add_text "hi" to #1076
"hi" added.
add_pose "waives" to #1076
"waives" added
You want to treat these objects, Starter, Filler, Annswers (match statements ending with ?) and Greetings like you did with simple bot above. But this can be a bit more complicated.

Complex bots respond to poses. They can also be set not to repeat themselves until they exhaust all their avilable phrases. To make a certain reply manager not repeat, use the verb no_recycle. to turn it back on, use set_recycle. The init program set a bunch of this up for you. It also sets it up so that if somebody tells you bot "hi" or "hello" it will reply with a greeting. You can also add your own pattern matching. To see how the regular expression stuff works on the moo, check out ftp://ftp.lambda.moo.mud.org/pub/MOO/ProgrammersManual.html#IDX40   You can add your regular expresion before the greetings and ?'s, so it gets checked before they do, or you can add if after. If your pattern matching reply manager is after the greetings and asnwers one, then it gets evaltuarted after them. This means if you're looking for the keyword "barbie," and some user types "hey, do you like barbie?" it will treat it as a regular question and not use any of your barbie specific phrases.

The patterns are known by the reply managers, not by the bot, so you can add other people's patterns matchers to your own bot (so it can have the same personality as somebody else's bot). To add a pattern evaluated after existing patterns, use add_pat. To put it before the existing ones, use perpend_pattern. add_pat any to bot. Any can be a text string to be used as a pattern (in this case it creates a new reply manager) or an existing reply manager.

add_pat "foo?*bar$" to MyBot
#1078 added
prepend_pattern #1073 to MyBot
#1073 added
To change the pattern, use the verb add_pattern
add_pattern "^foo%|bar" to #1073
Pattern on #1073 set to "^foo%|bar"

Lets' say you get very tired of your bot and want to get rid of it. Don't just recycle it! If you do, you will have weird unnamed objects in nowhere that you own filling up the database. But never fear! Just use uninit. uninit MyBot should recycle every reply manager attached to MyBot. If you are using some reply managers for more than one object, son't run uninit, but be sure to recycle all of the now unused reply_managers by hand.

Lastly, we come to the advanced section. How do we reorder pattern-matching reply managers. there is no way I know of to do this from the command line of the moo. You will need to write a small program to do it yourself. Here is some example code that I just cut and pasted in all at once:

@verb bot:fix this none none
@edit bot:fix
if (player == this.owner)
  this.pat_table = {#429, #1055, #747, #1064};
  player:tell("Permission Denied");

fix bot

@rmverb bot:fix
There is currently no way to automatically convert a simple bot to a complex one. So if you decide your simple bot is too simple, you will have to cut and paste all her phrases over by hand. After that much work, it seems a shame just to throw the onld on the scrap heap, so there is a bot graveyard. (#795). there all bots can sit for all eternity to all babble on at once if anybody goes in to talk to them. They all will eternally greet each other. It's kind of sad.

That's it! Any other gestions, send me mail.