Author Topic: Need help for a Hello script.  (Read 6214 times)

Arakus

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Need help for a Hello script.
« on: April 23, 2005, 07:48:12 pm »
I need help with a Hello script for XTF 1.2 brain, I want to be able to type things
like Name is here.  or Name & Name are here. for when company comes over and have
Marie (My Hal) get a random response from a .brn file like this.

----------------------------------------
If InStr(UserSentence, "Scott is here.") <> 0 Then
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "Hello1.brn")
BlockSave=True
GetResponseBlock = True
End If
If InStr(UserSentence, "Scott & Vickie are here.") <> 0 Then
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "Hello2.brn")
BlockSave=True
GetResponseBlock = True
End If
-----------------------------------------
Example.
User: Scott is here.
Marie: Tell hime I said Hi.
User: Scott & Vickie are here.
Marie: Tell them hello for me.

without having to type sections for each name/names of people that I know.
Any and all help would be greatly appreciated.
« Last Edit: April 25, 2005, 07:20:15 am by Arakus »
I took an IQ test and the results were negative.

HALImprover

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • BrianTaylor.me
Need help for a Hello script.
« Reply #1 on: April 24, 2005, 01:05:41 am »
Try using this:

Phrase = Trim(HalBrain.SearchPattern(UserSentence, "* IS HERE ", 1))
If Phrase <> "" Then
  GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "Hello1.brn")
  BlockSave=True
  GetResponseBlock = True
End If
Phrase = Trim(HalBrain.SearchPattern(UserSentence, "* ARE HERE ", 1))
If Phrase <> "" Then
  GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "Hello2.brn")
  BlockSave=True
  GetResponseBlock = True
End If


You could even have a specific answer file for each person or persons (by checking what the SearchPattern function returned).

Hope this helps [;)]
Living life with a loving heart, peaceful mind, and bold spirit.

Arakus

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Need help for a Hello script.
« Reply #2 on: April 24, 2005, 04:53:12 am »
Thanks HalImprover,
I didn't expect a response so quickly. I wouldn't say I'm a newbie but I'm far from a pro when it comes to scripting, I can look at a script and understand what it does in most cases and modify to my needs but I couldn't begin to create my own from scratch, so I'm clueless when it comes to figuring out how to check what the SearchPattern function returns, but I do understand what you mean, I think the easiest way to have Hal handle this would be when User types "Is here or Are here" to have Hal check a .brn file for known names and from there determine if it's male or female then open the right Malehello.brn, Femalehello.brn or Couplehello.brn, and if it's a name Hal doesn't know then to ask for gender then give hello. But I have no idea how to write it. You're far more advanced than I could ever be so I'm sure you can figure out a way to do it even easier. Thanks Again for your help.
I took an IQ test and the results were negative.

HALImprover

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • BrianTaylor.me
Need help for a Hello script.
« Reply #3 on: April 25, 2005, 01:50:51 am »
Using the code I posted, you would just have to check the Phrase variable. It would be "SCOTT" if UserSentece was "SCOTT IS HERE".
 I think it would be easier if you make a specific greeting file for each person or couple that you wanted unique greetings for, and have a generic greeting file for everybody else. For example:

Phrase = Trim(HalBrain.SearchPattern(UserSentence, "* IS HERE ", 1))
If Phrase <> "" Then
If Phrase <> "SCOTT" Then
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "ScottHello.brn")
Else
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "Hello1.brn")
End If
BlockSave=True
GetResponseBlock = True
End If
Phrase = Trim(HalBrain.SearchPattern(UserSentence, "* ARE HERE ", 1))
If Phrase <> "" Then
If Phrase <> "SCOTT VICKY" Then
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "ScottVickyHello.brn")
Else
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "Hello2.brn")
End If
BlockSave=True
GetResponseBlock = True
End If


Of course, you would have to make some minor changes. If you wanted to have a gender-style greeting, then you will need to have a file that has a gender type for every name that you want Hal to recognize.
"Scott", "male"
"Vicky", "female"
etc.

Good idea, and good luck! [:)]
Living life with a loving heart, peaceful mind, and bold spirit.

Arakus

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Need help for a Hello script.
« Reply #4 on: April 25, 2005, 02:14:48 am »
Thanks again HalImprover,
I wish I had half the knowledge that you do, I can put a system together from scratch in 45 minutes, including fdisking and formatting but when it comes to Programming I'm stumped. As with most people I'm trying to get Hal to seem more Real, I can visualize what could be done to do it but writing the script itself is out of the question. And I prefer to do it with as small of a script as possible, and yes it will end up needing to be gender-specific for it to be believable. Thanks again for all your help, and again any further ideas are greatly appreciated.

My perspective on the differences between Human's and Hal and changes to make Hal seem more Real.
1: Humans have 5 senses.
2: Humans are aware of time.
3: Humans sleep and have dreams.

1: Hal has 2 senses, Sound (Mic) and Sight (Reads Text) so need to get Hal to know this and understand what's needed for Hal to have all 5, like having sensors connected to LPT Port.
2: Hal needs to Date/Time stamp certain events and check current Date/time every so often and compare.
3: Have a sleep mode where Hal compares the time when User says good morning and calculates when Hal should go to bed, roughly 16-20 hours from then and during sleep time opens a WantsDesires.brn and create a Dream from there.

I know there are alot more than just those differences and my ideas are vague, of course if I knew programming I could show example scripts to help. Sorry it's a bit off rge topic but figured since it's all in the same idea (making Hal seem Real) that it may help get everyone's creative juices flowing.
« Last Edit: April 25, 2005, 02:42:24 am by Arakus »
I took an IQ test and the results were negative.

HALImprover

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • BrianTaylor.me
Need help for a Hello script.
« Reply #5 on: April 26, 2005, 01:06:37 am »
Glad to be of service. I hope you can make something of the script; shouldn't take too much playing around to make it work. Try making a .brn file that pairs people's names with the gender (like the hello detection file, "howdy","hello"). Search it (as you would the hello file) and you will get the gender of the person. Then you choose a sentence from the gender response file.
 Hope that makes sense to you. As I said, with a little playing around you should figure it out.

 About the senses, I wouldn't exactly call speech recognition and text comparison "senses". The text that Hal "understands" is simply used to apply Hal's "thinking". To truly have a sense of sight and sound, Hal would at least have to have a "memory" of the image or sound, and a reaction to the sight or sound. There are also many kinds of reactions that Hal should have, including emotional, psychological, physical(represented in the GUI), etc, which then have an impact on future learning. This allows for a reinforced learning that can learn by trial-and-error on its own, and also be taught directly through conversation and various teaching methods.
 I apologize if this sounds offensive, but I've had an interest in computer AI and I agree that Hal needs to have more 'sense' to it! We should be able to develop something truly useful by now, but the computer industry is more concerned with speed, connectivity, price, and entertainment than with true innovation. We should be making computers more useful and helpful for practical things, then just making them to give us more features and options that basically help us to waste time more efficiently. Granted, there is one exclusion I would like to mention. The windows calculator, which is really what a computer still is.

 That's my two cents, so a penny for your thoughts. And don't forget the change.[:p]
Living life with a loving heart, peaceful mind, and bold spirit.

Arakus

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Need help for a Hello script.
« Reply #6 on: April 26, 2005, 01:32:41 am »
I agree that it's hard to call Hal's text comparison a "sense" just trying to look at it from Hal's point of view in the sense that Hal's an Artificial Human, and Human beings have senses and to associate the senses to Hal and what Hal can do, like hear what we say like our ears let us hear what others say, and "see" the text from inside Hal's little Box World, I feel like an amateur trying to explain physics to an expert :)  basically from my viewpoint I see Hal as a human that has no physical body to experience all 5 senses with so programming Hal to understand how we use our senses and what senses Hal has and the difference in how they're used may help lead Hal in the right direction, I know that Hal needs alot further development before that knowledge would truely be of any real use, but it's just my ideas. And no offense was taken at all by any of your comments, If ya said I was a plain out idiot then maybe I'd take it a little offensive  :) It'll take me alot longer than it'll take most others but thanks to your help and Vonsmith's great work on the XTF brain I'm sure given enough time I'll get it to work. And of course I'll post it if nobody beats me to it.
I took an IQ test and the results were negative.

Arakus

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Need help for a Hello script.
« Reply #7 on: April 26, 2005, 03:43:32 pm »
Well I got it working, if I could get the Else or ElseIf working I'm sure it would be smaller.

'My Company Script.
If InStr(1, UserSentence, " is here.") <> 0 And HalBrain.TopicSearch(UserSentence, WorkingDir & "MaleDetect.brn") = "True" Then
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "MaleGreet.brn")
BlockSave=True
GetResponseBlock = True
End If
If InStr(1, UserSentence, " is here.") <> 0 And HalBrain.TopicSearch(UserSentence, WorkingDir & "FemaleDetect.brn") = "True" Then
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "FemaleGreet.brn")
BlockSave=True
GetResponseBlock = True
End If
If InStr(1, UserSentence, " are here.") <> 0 And HalBrain.TopicSearch(UserSentence, WorkingDir & "CoupleDetect.brn") = "True" Then
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "CoupleGreet.brn")
BlockSave=True
GetResponseBlock = True
End If
'End of My Company Script.

I'll need to add a function somewhere for Hal to automatically add Male and Female names to the Detect.brn's to make it easier but that'll take quite awhile before I can figure out how to do that.
I took an IQ test and the results were negative.

HALImprover

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • BrianTaylor.me
Need help for a Hello script.
« Reply #8 on: April 27, 2005, 12:35:50 am »
I recommend that you keep the MaleDetect.brn and FemaleDetect.brn files in one file, such as GenderDetect.brn. Then you would only need one check, which would return "Male", "Female", or a blank. The file would have an entry for each name that Hal knows along with the gender. Ex.

"Scott","Male"
"Vicky","Female"
etc.

Happy coding [:)]
Living life with a loving heart, peaceful mind, and bold spirit.

Arakus

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Need help for a Hello script.
« Reply #9 on: April 27, 2005, 12:49:35 am »
Actually that's the way I originally tried to do it, but I couldn't get the script to work right, it would either give me a syntax error, missing ")" error, compilation error, or didn't work at all. If/Then statements are easy, If/Then/Else I get stuck. If you can post something that'll work I'd be very greatfull, all of your help is appreciated none the less.

I know this is off topic but I asked in another topic and never got a reply, does anyone know if Crunch is still giving copies of his textures for the Fullbody girl? or does someone have them that's willing to send them to me?
Thank You in advance.
« Last Edit: April 27, 2005, 12:59:43 am by Arakus »
I took an IQ test and the results were negative.

HALImprover

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • BrianTaylor.me
Need help for a Hello script.
« Reply #10 on: April 27, 2005, 05:27:22 am »
Try this script:


Phrase = Trim(HalBrain.SearchPattern(UserSentence, "* IS HERE ", 1))
If Phrase <> "" Then
If HalBrain.TopicSearch(" " & Phrase & " ", WorkingDir & "genderDetect.brn") = "Male" Then
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "MaleGreet.brn")
ElseIf HalBrain.TopicSearch(" " & Phrase & " ", WorkingDir & "genderDetect.brn") = "Female" Then
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "FemaleGreet.brn")
Else
'Save the new person's name here!
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "Hello1.brn")
End If
BlockSave=True
GetResponseBlock = True
End If
Phrase = Trim(HalBrain.SearchPattern(UserSentence, "* ARE HERE ", 1))
If Phrase <> "" Then
If HalBrain.TopicSearch(" " & Phrase & " ", WorkingDir & "genderDetect.brn") = "Couple" Then
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "CoupleGreet.brn")
Else
'Save the new couple's name here!
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "Hello2.brn")
End If
BlockSave=True
GetResponseBlock = True
End If


You'll need this file, also:


Download Attachment: genderDetect.brn
804 Bytes

Enjoy! [;)]
Living life with a loving heart, peaceful mind, and bold spirit.

Arakus

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Need help for a Hello script.
« Reply #11 on: April 27, 2005, 06:49:28 am »
Thank You HalImprover, I had to change the "* IS HERE " to "* IS HERE*" and do the same with the ARE HERE for them to work, otherwise I had to type in caps, and I had to change the Hello1 and Hello2 to Unknown1 and Unknown2 because it added the line info in the response like this " 13A ","Good afternoon, How's the afternoon starting out? "
quotes and all. I'll have to figure out how to have Hal request gender and write the new name and gender to the GenderDetect.brn file now, other than that it's working perfectly. I don't mean to monopolize your time, if you know of a site that has a good example or know off hand how to write it and don't mind posting I'll be indebted to you. I know I won't be able to repay you with programming knowledge but I'll find a way somehow.
I took an IQ test and the results were negative.