
There was some head scratching because the chat example on the Open Metaverse page (http://lib.openmetaverse.org/wiki/Respond_to_inworld_chat) seems to be out of date - the LL prefix from LLUUID and LLVector3 seem to have been dropped. The AIMLBot also doesn't come with the xml and aiml files needed, but I just took those from Radegast.
As it stands the chat call back is fired whenever anyone starts typing nearby, and when it hears itself. My slap-dash solution is included below:
static void Self_OnChat(string message, ChatAudibleLevel audible,
ChatType type, ChatSourceType sourceType, string fromName,
UUID id, UUID ownerid, Vector3 position)
{
if (message != "")
{
if (fromName != "Test Bot")
{
//process chat here
AIMLbot.Request request = new AIMLbot.Request(message,
myUser, myBot);
AIMLbot.Result reply = myBot.Chat(request);
Client.Self.Chat(reply.Output, 0, ChatType.Normal);
Console.WriteLine(reply.Output);
}
}
}
That's the main component of the chat bot, so you can see that it is very easy to implement.