how do make a text bar that you can talk with?

Talk about making games.

how do make a text bar that you can talk with?

Postby Kooldudese » Sun Feb 04, 2007 1:32 am

how do you make a text bar that you can type in and then when you press enter the text comes spelling itself out?
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

Postby Sgt. Sparky » Tue Feb 13, 2007 4:03 am

when enter (return) is pressed. all you need to do is have this script
Code: Select all
if(strncmp(text, "Hey there", 10) < .3)
{
    strcpy(Reply.text, "hey,\nhow are you?");
}
you can use that for many, MANY phrases, but you may need to change it ALOT for complex phrases. :D I hope that helps
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Sgt. Sparky » Tue Feb 13, 2007 4:05 am

let me make you a better demo, I made a Base for a chatting program I will post it tomarrow. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Fuzzy » Tue Feb 13, 2007 3:53 pm

your best bet would be to parse the words. Divide the input into words and have the program figure them out one by one. Group them into types, and build a generic sentence, or better, segments of a sentence.

For example, "hi" "hello" "hey there" "how are you" are all the same, so you reduce it to "hi" or "greet" internally. from there, you formulate a response. this way, you will not need so many ifs and cases. internally, it might look like...

"<greet> <me>" and from that, you build an response "<greet> <player> <mood>" building the stuff in <> from variables.

So you start with
"Hi there robot how are you?" and respond with "hi Fuzzy, I am fine".

This way, if i say "hi there robot" you respond "hi Fuzzy" and its the exact same code that handles it.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest