PDA

View Full Version : k.. this one may hurt your head



dudeman
August 24th, 2002, 11:35 PM
Heh special thanks to dan for helping me out with the code on my previous project, I would've never got any farther with out him.. (can you figure out that on keystroke thing =))

Ok.. lets say I'm making a fake ai chat.

The user would be asked something, lets say how old are you.. he would answer whatever blah blah. I'm 17.

The fake ai would see if he said anything about 17..

He would say something like "you know I like xxxx", how would I pick up the word "I like" so it can trigger something?

Another easy one.. he says "lol" or "LOL", or any form of it anywhere in a sentance, how would I detect he said that and trigger something like "whats so funny?"

Also; Is there something that would act like a wild as in *lol*, which would pick it up anywhere in the sentance?

Thanks.. hehe :)

eyezberg
August 25th, 2002, 03:33 AM
Didn't understand a single thing about what you want..?!

sbeener
August 25th, 2002, 12:22 PM
pretty ambitious project...

you'll want to make yourself familiar with the String object. String.indexOf will partially solve some of those problems.

you also might want to check out regular expressions. although flash has no built in support, some kind folks have written and released a custom RegExp class which adds the support.

check it out here:
http://www.jurjans.lv/flash/RegExp.html

or here:
http://homepage.ntlworld.com/andy_black/andy/flash/regexp/