The Ways of the Power of MUDChat |
|
|
The purpose of this document is to understand the MUDChat behavior and the richness it can add to a world. No programming is needed. Basic Chat.Dat InformationIf you've ever popped open the resources/chat.dat file and tried to read the instructions, you'll be familiar with this: # pattern matching: Which work only in ( string | string & (str ~ str)) Helpful and clear, eh? Here's a breakdown of the basics: The chat.dat file is basically a giant text file that is used for pattern-matching, with a couple of extra features. What this means is that you enter 'trigger' text and when the MOB hears someone say it, they'll respond with whatever you set for them to say. An example is warranted: Bo decides he wants MOBs to praise CoffeeMud in a couple ways when it's mentioned. He opens up his chat.dat file. He would enter this: (coffeemud) There's a few different things to understand there:
So, with those basics of triggers and responses clear, you can do some fancier things pattern matching that just one word patterns like (coffeemud). There are and, or, and and-not characters you can use in the pattern matching.
You can also use all of the <S-HIS-HER> type codes that CoffeeMud uses (See Programming Guide) in your trigger/match strings in order to capture normal non-speaking messages. In the responses, several variables are available for inserting into the response strings in order to enhance them, such as the $t in 6I don't care for fish, $t. from the examples above.
ChatGroupsThere's some very unhelpful sentences in there about databases. This is a better explanation. There are several ChatGroups defined in the distribution copy of chat.dat. Some are pretty clear. Here's one (shortened a bit): ############################################################ You'll find this pretty much at the end of the file. What this means, is the ChatGroup is named "healer", "cleric", and "doctor" (the line of #'s is just remark characters, marking it up a bit for readability - it's the '>' that marks a ChatGroup). So, any MOB set to the ChatGroups 'healer', 'cleric', or 'doctor' will respond with these patterns. Another trick you can use to narrow matches on a
ChatGroup
with the > command is to include a CoffeeMud Zapper Mask. In
that
case the zapper masks would be included in your set of matching words
by surrounding it with '/' characters like so: >healer cleric doctor /-GENDER +female/ Adding the mask at the end will give the additional
requirement that the healer be a female before the chat group is
matched. Check the Archon help files on ZAPPERMASK for more
information on the kinds of values you can put in there. At the bottom of our original ChatGroup is a linking character, @, pointing to default. That means that this group will respond with the pattern you see here first, and if nothing matches, will then go on to check in the default for matches.
The linking character preceded by a $, as in '$@mygroup' can be appended to the end of a response string to cause the ChatGroup to either switch to another (in this case 'mygroup'), or append another if '$@+mygroup' with the plus sign is used. This absolutely must occur at the end of the response string though. If you don't recall what a response is, see the previous section. There are some caveats to using @. You can only link to groups that were defined before the link. So, if you wanted a ChatGroup called 'clericforhire' that included some of its own patterns, plus the 'cleric' patterns, you would need to create >clericforhire in the file AFTER >healer cleric doctor, and put @cleric at the bottom of >clericforhire. (More tricks with ChatGroups are in the Power Tricks section).
Applying MUDChat BehaviorsApplying the MUDChat Behavior to MOBs is super easy, and setting the MOB to use a particular ChatGroup is straight-forward as well. MethodsEdit/Create a MOB as usual. In the Behavior list, put
MUDChat. The empty box next to it is the MudChat parameters. If any case you leave the options box empty, the MOB will only use patterns in the @default ChatGroup. If you want to specify which ChatGroup, type its name in the options box. So, if you were setting up a cleric, you would put 'cleric' in the options text. MudChat ParametersIf you specifiy no parameters, the MOB will only use patterns in the @default ChatGroup, or attempt to find a chat group that shares its name or race. If you want to specify which ChatGroup from chat.dat to use, type its name in as the parameter. If you want to specify a different .dat file to use AND which chat group in that new file to select, use an equal sign, like: The above will load the file /resources/mychat.dat file, which uses the same rules as the chat.dat above. In the example, "mychatgroup" would be the name of a chat group in that file that the npc will use. If you want to include any additions or variable overrides to an existing .dat file, you would put those after a plus sign +, after an equal sign, and semicolon ; delimited for example: chat.dat=mygroup+(here there);9neither ${hnt};5well, where?;1nowhere;${hnt=Here nor There!} The above would select the chat group "mygroup" from the default chat.dat file, but add the following to it: (here there) The above defines a new pattern to match (here there), with a few responses, and then defines the variable "hnt" to be "Here nor There!", which can be used like ${hnt} in response strings. If you want to
keep the default chat.dat file AND the default chat group, but still
add new stuff, you can still do that by leaving the first two fields
blank: =+(here there);9neither ${hnt};5well, where?;1nowhere;${hnt=Here nor There!} LLMIf you have configured CoffeeMud to use an AI/LLM system (see Installation Guide), then you can use MudChat to immediately take advantage of it, by overriding or supplementing its default behaviors with LLM activities. To get started, there are two internal MudChat variables that LLM will set need for best results. Variables are defined either in a chat.dat, or in the parameters, by using the ${VAR=VAL} and ${VAR+VAL} syntax. 'VAR' would be the name of the variable, and VAL would be the value to set to it. VAR+VAL is the syntax for appending to a previously defined variable. The variable relevant to AI/LLM is LLMPROMPT and LLMMEM. LLMMEM is the number of messages that the session will remember, not including the first one, which is always remembered no matter what. Without setting this variable, the default amount of memory is about 10 messages. LLMPROMPT is the message that is sent to the LLM preceding the its first input when the session is created. Without setting this variable, the default prompt would be empty. Of these, the LLMPROMPT is most important, as it is normally used to establish the rules for its personality. The default chat.dat file uses the following LLMPROMPT definition: "Pretend to be a ${GENDERNAME} ${RACE} whose name is ${NAME}, and who lives in a ${THEMEDESC} area called $%INAREA($n)%. You are currently at ${ROOMDESC}, are usually seen by others as "${DISPLAY}. ${DESCRIPTION}". Your moral alignment is ${ALIGNMENTDESC}, and your personality traits are ${PERSONALITY}. Please only deliver dialog responses, never emote, and keep responses under 3 sentences. Begin now: ". You'll notice how many variables are referenced in building this string for the AI to consume, but also note the last sentence, that strives to keep the AI brief and well formatted as dialog. When writing your matching trigger patterns, you can write them in 3 different ways to be LLM aware: L(hi|hello) The first is to prefix it with a capital L, which denotes a trigger pattern that will ONLY be used if CoffeeMud has an LLM integrated and active. It otherwise works normally. .(hi|hello) The second is to prefix it with a period, which denotes a trigger pattern that will ONLY be used if CoffeeMud does not have any active LLM integration, but is 'stock'. (hi|hello) The last is to not put a prefix at all, but use the normal matching character (, [, etc. These trigger patterns will be evaluated regardless of LLM integration. The next special LLM feature is around the LLM response, which is prefixed with a single quote character ': (here there) The single quote character does not work like the double quote. Instead of the message after the quote being spoken by the NPC, it is instead sent to the LLM, and the NPC will then say whatever the LLM responds with. Some MUDChat Power TricksSuppose you have a city called Yares. In this city are various mobs - guards, shopkeepers, commoners, bankers, etc.. You can setup groups in the chat.dat called guard, shopkeeper, banker, commoner, etc, and give them each appropriate patterns and responses for their type. Then, you setup two more .DAT files, Yares and World.
In
Yares, you can put a bunch of patterns in relevant to getting around in the
city (like 'weapons' Now, back in Chat.dat, you created more groups, called YaresGuard, YaresShopkeeper, etc... The only lines that went into each were: %Yares.dat %filename includes the filename's contents in-line (as if it were typed in) This sets up each type to know a little about their city, something about the world, and gave them some text for their profession. So, in our system, if a new player is walking around Yares, they can ask a cityguard where Market Street is or where they can find a healer and get useful answers (well, not if you want to code misinformation for a chuckle) |
|