CPU And Player Conversation

i want a script that will type conversations. i want to be able to just set what the computer will type when i type some of the basic set texts. Like a script to put on a GUI so i can say “Hi” and it will say “Hello”, then i say “How are you” it searches the phrase and comes up with the answer, “Fine”. i think a simple script telling it to search var __________ and answer with var ___________ . Anything, Anyone? Going Once… :arrow: :cry:

Here try this:

// press return to ask the question
var inputs : String [];
var replys : String [];

function Update () {
    for (var c : char in Input.inputString) {
        if (c == "\b") {
            if (guiText.text.Length != 0)
                guiText.text = guiText.text.Substring(0, guiText.text.Length - 1);
        }
        else if (c == "\n") {
            for (var i = 0; i < inputs.length; i++)
            {
            	if (guiText.text == inputs [i])
            	{
            		guiText.text = replys [i];
            	}
            }
        }
        else {
            guiText.text += c;
        }
    }
}

Here’s a unitypackage:

41442–1537–$conversation_762.unitypackage (4.65 KB)

If you’re trying to make a chatbot, the simplest way to start would be to find some source code for an “ELIZA” type bot, and convert that to javascript.

Probably the simplest approach to an open-ended text parser is that seen in Ultima IV (we ripped it off in Prince of Destruction, but made it a little more flexible).

In Ultima IV there are simple keywords that characters have replies for. The parser simply responds to the first word it recognizes with the appropriate reply. In our system replies could be switched on and off by global state (e.g. if you kill Bad Guy X then the responses telling you to kill him turn off and the responses congratulating and thanking you for killing him turn on) and could toggle variables on or off. That was enough to integrate the system with quests, have people open doors for you, etc.

Finally, words the parser had replies for were highlighted (drawn in red). (This would be a little hard to do in Unity3d … at least until 2.0.) Almost everyone would respond to “hello”, “name”, “job” (also ripped off from Ultima IV) and they would tend to use the other words they knew in their responses.

You could say “Hello there” (responds to hello) and “What’s your name?” (responds to name) etc. producing naturalistic conversation.

Perhaps the best known game to use this system was EverQuest.

i am unable to download the package. :cry:

Open the package, then hit command + s. Once it’s saved delete the last few letters. " .gz.txt ". At least that’s how I usually do it.

You may need to rightclick over the link and download attatched file…
AC