I made a password in python.Now how do i make the blender game engine react to it?

Can you be a little more specific on what you want to do and what part have you got working already?

I am trying to make a program in the blender game engine to anwer the question i ask it and have a conversation with me like a real person.I want to make it so that i can put it in my firstpersonshooter.I will need it definitely.I did it in logic bricks but it stopped working.It was a mess of logic bricks.

You are trying to create a conversational AI? That is pretty ambitious. Try taking courses at some university in computer science, psychology, sociology, and probably a whole host of others.
People dedicate their lives to doing this, and they still aren’t the results aren’t that great yet.

The thing is that the human mind is complex. From birth we train it with social skills, language and a whole host of other things. Some of these we don’t even know we know. It then becomes very hard to put these into a computer.

The only way I can think of of creating a conversational AI is a bit like Shakespeare’s monkeys. (if you have enough monkeys at typewriters hitting keys randomly, one will eventually write Hamlet). If you set up a python script to change and expand itself, and let it run long enough, eventually you will have the worlds best AI. Technically, the initial code is really easy to write, but the length of time for it to actually produce a working AI is pretty much infinite.

In short:
What does ‘have a conversation with me’ actually mean?

You could have a look at the source code of “Eliza” for inspiration.
There are ports for all different programming languages on the web.



I think there are some Dialog solutions in the resource forum.

Such things are not that difficult.
Because of it’s dynamic nature I recommend to use Python as you discovered already.

I have thought of another solution to make a computer game have a conversation with me.This solution uses logic bricks.The logic bricks can identify passwords but i think they can identify sentences and what type of sentences they are.Like for instance questions from a regular sentence.This solution will work if the logic bricks allow it without getting bugs in them.I will post a simple blend of it.

I made a password in python.Now how do i make the blender game engine react to it?

I am trying to make a program in the blender game engine to anwer the question i ask it and have a conversation with me like a real person.

How are these 2 things even remotely same? Password? AI? Conversation like real person?

I’m getting really frustrated with people asking for help and barely explaining what they want in completely broken English.

Sorry for not telling you what ai means.By ai i mean artificial intelligence.Look at the definition of artificial intelligence on wikipedia websight.Another words artificial intelligence is a broad term.

You haven’t used the word “AI”, “artificial intelligence” or anything of that sort ONCE in your posts. You are the one who has problem with knowing what it is. The other people including me have to do guessing based on some incoherent phrases like “making and reacting to password” that make no sense in the context you put them.

I’m just sayng if you showed put effort into your questions you would get help. I’m sure whatever you’re trying to do is easy in python if you have done it with logic bricks as well.

Do you want something like a non-player character (NPC)?

I am trying to make a npc that i can have a conversation with?But i need the password code to make it work.

What do you mean by “password”? Here’s a quick definition and it is not clear what you mean in that context.

Do you mean that you want your NPC to react to certain keywords in certain way? Like if you type in “hello” they respond with “Hello, player” or something?

I want the npc’s to answer the questions I ask them.

Ok, that is about the hardest thing ever unless the questions are pre scripted, then it is simple.
but to handle ANY question?

Then you would need IBM’s watson?

So one more thing: Do you want to allow the player to type their question freely or choose from n amount of alternatives you have programmed in?

Choose from from the many questions i have programmed in.Then the npc will answer one of those.

So you don’t mean AI. You mean dialogue options.

That’s not too hard in python.

  1. You first need a subtitle system that shows the text and dialogue options(list of questions) and shows a cursor that enables the player to point which option he wants
  2. You make list of player questions and list of NPC replies
  3. You make a function to input the list of player questions to subtitle system to show them along with your cursor
  4. You make a function to the NPC where it scans the cursor index number input and reads the appropriate answer out of his list of answers

Tips on that:

  1. Use BGE text for dialogue options, name the objects like “DialogueOption0”, “DialogueOption1”, “DialogueOption2” etc. and default to contain nothing so they aren’t visible. Cursor is some plane with a cursor texture you like and you move it worldPosition == scene.objects[“DialogueOption” + str(n)].worldPosition.copy() with keyboard adjusting n between 0 and len(dialogueoptions). Store n in the cursor object property called “index” for example.
  2. player[“DialogueOptions”] = [“Where’s the bus?”, “Where’s the aeroplane?”, “Where’s the submarine?”]
    NPC[“DialogueOptions”] = [“West of here”, “North of here”, “East of here”]
    Or you could actually just store the 2 lists in some empty that marks the dialogue between the characters and refer to that object in your system.

#example mechanic
i = 0
while i < len(playerDialogueOptions):
    scene.objects["DialogueOption" + str(i)]["Text"] = playerDialogueOptions[i] example mechanics
myReply = cont.own["DialogueOptions"][scene.objects["cursor"]["index"]]

Or you could actually make a dictionary where a certain keyword in the player entry returns a certain dictionary entry to make your NPC more versatile in conversations.

I want to use up and down arrow keys to select which question and enter key to confirm selection.

Okay? And you don’t know how to do it in either python or logic?