Page 1 of 1

A chat functoin that replies

PostPosted: Wed Oct 15, 2008 10:08 pm
by supa-tails
Ok, I have been having trouble with this for way to long now, and my small forums doesn't have too many people who understand good code (Except Kall and J2Graves) But I want to know how to make a text actor reply to what you say using a if command, example:
If ( textinput.text = "hi")
{textoutput.text = "hello! =D"}
I know this code won't work and I have a longer script for it in the game but it doesn't work anyway so I am just giving an example. Please help :D

Re: A chat functoin that replies

PostPosted: Thu Oct 16, 2008 2:10 am
by feral
supa-tails wrote:Ok, I have been having trouble with this for way to long now, and my small forums doesn't have too many people who understand good code (Except Kall and J2Graves) But I want to know how to make a text actor reply to what you say using a if command, example:
If ( textinput.text = "hi")
{textoutput.text = "hello! =D"}
I know this code won't work and I have a longer script for it in the game but it doesn't work anyway so I am just giving an example. Please help :D



do you want the actor to respond to random input ? or are you going to supply a list of possible things to say ?

eg: say to actor (input box)
1. hi
2. bye
3. do you know where the dragon is ?
4. prepare to die !

select choice eg getkey pressed...

then in code
if (choice==1)
{
textactor.text="hello !"
}

etc ? ? ?

Re: A chat functoin that replies

PostPosted: Thu Oct 16, 2008 6:04 am
by Fuzzy
An ancient problem. The early adventure games like kings quest had to deal with this. What you do is compile a list of words in catagories, storing them in arrays. For example, hi, hello, hiya, hey. are all equivalent. Then special catagories like player, self, other and proper names as well for nouns. You build a type of variable to reflect what the sentence means, rather than the actual words. so you might have

01 56 which means "hello person" which is the same as "hello Fuzzy". This simplifies programing and figuring out responses!. So if the players text was encoded as 01 50, that might be "hello player" which could cause the other actor to ask why you are saying hello to yourself, or they could say "no my name is..."

You only really have to do this for the possibilities that the player could type out. The other actors responses could be canned text. Of course, you will never ever get all the possibilites, so you have to have a catch all response for "What did you say?", perhaps "Say that a different way, I dont understand."

Use proper language. Do not require the player to use lol and smilies or other internet codes. It will be far less confusing.

Re: A chat functoin that replies

PostPosted: Thu Oct 16, 2008 8:16 am
by Kalladdolf
I think what supatails wants is a chatbot that replies with certain messages to certain messages typed in by the user.
Further it should be programmable (that means that while running the chatbot, you can still customize your chatbot replies).
But that shouldn't be too difficult, I'm fixing up a demo for him.

Re: A chat functoin that replies

PostPosted: Sun Oct 26, 2008 4:03 pm
by supa-tails
Sorry for the delay in replying! :o Anyway, what I want is something where if I were to say "Hi chatbot!" then the chatbot would reply with something like "Hi supa tails!" Or whatever you set your name to be. But I would like kind of what fuzzy was saying where he randomly replies with something accordingly, such as "hi (yourname), hello (yourname), yo (yourname), hiya (yourname)" ect. With many combinations that I wouldn't mind programming, as long as I know what I'm doing. Like if you custom type your name to be "supa tails" than you custom type the chatbots name to be "kalladolf" than the following conversation might sound something like this:
"Hi Kalladolf"
"Hiya supa tails, how are you?"
than the conversation would advance like if I say:
"My day was good, how about yours?" he would reply something like:
"Great, (random sequence here)" Random sequence such as he chooses from a list of nouns, verbs, and adjectives randomly and puts them in the proper order, sounding like this:
"Great, I ate a yellow dog but he was crunchy" Just as an example, because it probably won't make sence but this is kinda the only realisticly possible way I can think of doing it.

Re: A chat functoin that replies

PostPosted: Sun Oct 26, 2008 6:31 pm
by jimmynewguy
http://game-editor.com/forum/viewtopic.php?f=1&t=6214
when i gave you that example it wasnt what you needed?

Re: A chat functoin that replies

PostPosted: Mon Oct 27, 2008 12:18 am
by supa-tails
OH YEAH! When I tried that I couldn't understand any of it. Do you think you can make something like that without the sword? something simple like:
if (textinput.text = "hi")
{textoutput.text = "hello}

Re: A chat functoin that replies

PostPosted: Mon Oct 27, 2008 10:57 am
by jimmynewguy
ok ill fix it when i get back from skewl (:lol: attempted humer)

Re: A chat functoin that replies

PostPosted: Sun Nov 02, 2008 2:25 am
by supa-tails
lol I'm waiting XD no pressure

Re: A chat functoin that replies

PostPosted: Sun Nov 02, 2008 10:16 pm
by BlarghNRawr
i just saw something and im not sure if you know this yet...

but for the chat, it just needs to recognize a few words, not the whole sentance... like instead of putting a reply for:

hello, what is your name,
or: hey, whts ur name?
or: anything else like this,

just make ge check if the line has the words name and a ? in it, then replies with his/her/its name, then you dont need to make replies for everything...

not sure if this helps :/

Re: A chat functoin that replies

PostPosted: Mon Nov 03, 2008 11:13 pm
by supa-tails
yeah that is kinda what I am going for but I don't know how complicated it will be until I learn how the scrips for this works.