How to make a chat bot!

How good do you think this tutorial is?

  • Excellent 5/5

    Votes: 0 0.0%
  • Very good 4/5

    Votes: 0 0.0%
  • Alright 3/5

    Votes: 0 0.0%
  • Not so good 2/5

    Votes: 0 0.0%
  • Rubbish 1/5

    Votes: 0 0.0%

  • Total voters
    0
Status
Not open for further replies.

jay_bo

Daemon Poster
Messages
889
How to make a chat robot that actually works!

What u will need: Visual basic (You can download it for free from here Visual Studio Express: Downloads) and any other design software (optional) that you will need if you want to make it look like a chat window like msn.

1) open visual basic and create a windows application (Name it what you like)

2) Create a button and name it button1 it should be called tht automatically but you can change the text of the button to say SEND but u put that in under the button properties TEXT- Send NOT (NAME)-button1 leave tht!

4)Now double click on the button so you can enter code. Code as follows:
Public Class Form1

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

If user.Text = "hello" Then

bot.AppendText("hello!! how are you?")

ElseIf user.Text = "hi" Then

bot.AppendText("hello my friend how are you?")

ElseIf user.Text = "hiya uk" Then

bot.AppendText("hiya yea thanks, how are you?")

ElseIf user.Text = "hey dude" Then

bot.AppendText("hey dude how are you?")

ElseIf user.Text = "im fine thanks, how are you?" Then

bot.Text = "Good Good, i'm fine thanks for asking, i went out last nyt with Homer, ive got a banging headache:)"
ElseIf user.Text = "good" Then

ElseIf user.Text = "im good thanks, uk?" Then

bot.Text = "Good Good, i'm fine thanks for asking, i went out last nyt with Homer, ive got a banging headache:)"
ElseIf user.Text = "good" Then

bot.Text = "So then what have you been up to lately?"
ElseIf user.Text = "nothin much" Then
bot.Text = "I'm sure you have been up to something :)"
ElseIf user.Text = "I haven't" Then

bot.Text = "Well your best off speaking to me then :)"
End If

End Sub

IF you want to add more in put it in front of (END IF)

ElseIf user.text = " WHAT EVER YOU WANT TO PUT" Then
bot.text = "WHAT EVER YOU WANT TO PUT"

5)Create two textbox and Name the 1st textbox you drawn -bot (this is where the bot talks back) and name the second one - user (this is where you will talk to the bot) they are case sensitive

6)Thats it unless you want to add any pictures or menus in like me? ask if you want more info on that.

DON'T FORGET TO BUILD YOUR PROJECT

HAVE FUN i called my bot bender and got a picture of hime and homer simpson drinking together and i add created a pm saying great night last night homer
 
Remember if you put any other characters such , ? ' then it wont work unles you type what yo have put in correctly. for example it you put....How are you? in the coding then u will have to put How are you? in when you run the program. it wont work if u miss the capital letter off or ?.
 
lol nice I would of built mine a bit better :p by doing the If statements, like you said it has to be precise or it wont work but good post :)
 
i know but i wanted it so that anyway can make it like newbies and then develop it there selves. you could voted lol
 
I remeber I had done something simillar in Javascript, but for example statements were :

"Hallo"
"Hallo!"
"hallo"
"hallo!"
"HALLO"
"HALLO"

It was tiring so I decided the script to transcode it to capitals using the variable toUpperCase()

so the only I had to type was :

var prompt = window.prompt("Please type something")
var greet1 = "Hallo, user!"
var prompt2 = toUpperCase(prompt)
if (prompt2 == "HALLO") {
alert(greet1)
}
else if (prompt2 == "HALLO!") {
alert(greet1)
}

cause even if someone typed HaLLo! it would be taken as "HALLO!". Then you can add other statements to make it more User friendly.

I typed it fast, it might be buggy so do not test it.
 
what do you mean chat boys? and thanks:)
Are you going to work on developing it some more? It'd be cool if you strayed away from all the if-else's, and used some context-matching logic (hah, I know, it'd be a lot of work!), but regular expressions along with a simple spell-checking library would make it a good step up. :cool:
 
I might do i dontknow yet i only made it to get use the program i might do just got to find time to but im thinking of making different stuff in vb6 but not sure yet any ideas are welcome and as sson as i have made i will post how to do it:) thanks for all the replies
 
Status
Not open for further replies.
Back
Top Bottom