ID:153593
 
I'm trying to come up with a conversation system, perhaps one that could be stored in datums, that will allow players to talk to an NPC and get a list of conversation topics, returning a bit of speech depending on what conversation topic was taken. That's simple enough, but I'm also trying to get each option to check a flag to see if it appears to the player or not. For example, if flag[89] is true, then the topic appears. If not, then the player doesn't see it. I'm trying to come up with this on my own, but I'd like to see if anyone else has any suggestions on a good way to do this in the mean time.

(Incidentally, I want to come up with a way to load in special functions from dialog too, like shopkeepers or other non conversational NPC interactions. I'm not quite sure how it should be done and my mind's a bit fuzzy right now... And the idea behind storing them in datums is so I can just give each NPC a dialog variable and point it to a datum.)
I'll have to deal with this in one of my projects, too. =)

Perhaps each conversation topic could be its own datum? Then you could call procs belonging to the topic; one to determine whether to display the topic (by default, always display it), and one to determine what happens when the player chooses it (by default, just display the datum's conversation text). That gives you a lot of flexibility so far as special dialogue features, such as shops.

You'd probably want to read the conversations out of a data file, to avoid manually creating every single datum. I envision having a line in the data file for each conversation topic, like this:

/conversationpath;Conversation topic;Conversation text

So for example:

/talk;So what do you do?;"I make cheese."
/talk;Nice weather we're having.;"It's lousy, bugger off."
/talk/shop/cheesemaker;I wish to acquire some cheesy comestibles.;The cheesemaker shows you his wares.
/talk/quest/cheesequest;Never fear, blessed cheesemaker! I will fetch your cheddar!;"I'll believe it when I see it. But fine, go and get the damn cheddar if you really want to."

Where /talk would be the basic talk datum, /talk/shop/cheesemaker would be a datum that shows you a cheese shop, and /talk/quest/cheesequest would give you the Quest To Find The Cheese. (Yeah, I know, it's cheesy.)

That doesn't cover the actual conversation datums, but you get the idea. =)
In response to Crispy
I think the answer is in a combination. The way my MUD handles this, is with a /talk datum and a /keyword datum. Here's the breakdown:

1. Recieving input to the /talk datum
2. Parse the input, see if it matches any of the /keyword 's.
3.
a. If no, exit procedure
b. If yes, send /keyword.mainphrase to Input()
4. Decide what to do, when Input(/keyword.mainphrase) is called

You can see the specifics in the public version of Intermundia, under the quests.dm file.
In response to Alathon
Alathon wrote:
I think the answer is in a combination. The way my MUD handles this, is with a /talk datum and a /keyword datum. Here's the breakdown:

1. Recieving input to the /talk datum
2. Parse the input, see if it matches any of the /keyword 's.
3.
a. If no, exit procedure
b. If yes, send /keyword.mainphrase to Input()
4. Decide what to do, when Input(/keyword.mainphrase) is called

You can see the specifics in the public version of Intermundia, under the quests.dm file.


Just as a side note, it would be cool if certiant words caused an exit, and sometimes you had to use several key words.
Ie, I walk up to the King of Tarranaunt and yell "What up bitch, were da princess at?", he would get angry (or simply not respond) because of the use of foul language in his courtroom, despite the fact I said all the keywords. Maybe it would go as far as him throwing you out of the Castle.
Also, if Im begging a wizard to heal me and I just say "Heal me great wizard" he wont, I have to say "Heal me please oh great wizard".
In response to DarkView
DarkView wrote:
Also, if Im begging a wizard to heal me and I just say "Heal me great wizard" he wont, I have to say "Heal me please oh great wizard".

This kind of thing sounds fun but often isn't. There is nothing more frustrating than sitting there typing phrases over and over when you KNOW what you want to say and the computer KNOWS what you are trying to say, and instead you just get "I didn't understand that" or whatever as responses because you didn't say the magic phrase.

Hunting for the right phrase is not fun, especially when there will be times when due to mis-spellings (by the player or the developer) or whatever, or not having English as a first language, you can't possibly get it right.

After living through this in EverQuest, I now understand why every subsequent MMOG I've played has dumped that approach and just gives you responses or links in the text to click.
In response to Deadron
After living through this in EverQuest, I now understand why every subsequent MMOG I've played has dumped that approach and just gives you responses or links in the text to click.

In my case, I say "screw it" and still use speech recognition. Except I don't do exact keyword matching -- I'm planning on using a more complicated formula that tries to determine the meaning of the sentence. It's far from a chat bot, but it should at least recognise the difference between "Go *%@#%& yourself" and "Go there yourself!"
In response to Spuzzum
Spuzzum wrote:
After living through this in EverQuest, I now understand why every subsequent MMOG I've played has dumped that approach and just gives you responses or links in the text to click.

In my case, I say "screw it" and still use speech recognition. Except I don't do exact keyword matching -- I'm planning on using a more complicated formula that tries to determine the meaning of the sentence. It's far from a chat bot, but it should at least recognise the difference between "Go *%@#%& yourself" and "Go there yourself!"

It's a useful exercise for a programmer.

I'm not sure it contributes a whit to the player experience, though!
In response to Deadron
Well the way I see it is, instead of writing conversation lines there could just be key words in a general specific area...

perhaps that specific wizard, first starts an engaging earlier conversation when you meet him and stated that he likes polite and nice people... That evil ones can go to hell. Well then if you just say, "GIVE me the Info now bitch!" he's probably going to try to kill you. While if you say please, or could you kindly (kindly and please being key words, not necessarily sentances, just things to trigger a response) I think it would work out better. Like a hint conversation first before the actual entering in of words...