Zabaware Support Forums
Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: Ponnfar on March 05, 2006, 08:56:31 am
-
This is call to Vonsmith if you are out there!
Has anyone tried with success this or a similar script with the new HAL? For that matter, has anyone been able to create a working Nicknames script that RANDOMLY chooses from a list of nicknames given to HAL in conversation?
Thanks
Ponn
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
'In Ultra Hal Assistant v5.0 the "POST PROCESS: SAVE HAL'S RESPONSE"
' function should precede this function.
'
'PROCESS: HAL CALLS USER BY NICKNAME
'This is an entirely new function written by =vonsmith= , version 11-14-03a.
'
'This function lets the user specify one or more nicknames that the user wishes
'to be called by Hal. The nicknames are stored in a user specific self generated file
'called <UserName>UserNickname.brn. If more than one nickname is specified then Hal
'will randomly choose one of the nicknames from the <UserName>UserNickname.brn file.
'If a nickname is specified then the default Hal Assistant username will no longer be used
'when Hal speaks to the user, however the default username is still used for assigning
'user filenames and all other normal Hal functions. If the user wants to be called by
'his/her default Hal Assistant username then just add it as a nickname. If the user
'prefers to be called one nickname more often than another then just add that nickname
'multiple times. The more times the user adds a nickname the more likely that nickname
'will be used. The function does not affect any other Hal brain operations or files.
'To get rid of the nicknames delete the <UserName>UserNickname.brn file.
If InStr(1, GetResponse, "<UserName>", vbTextCompare) > 0 Then
Nickname = HalBrain.ChooseSentenceFromFile(WorkingDir & "X" & Trim(UserName) & "UserNickname.brn")
If Len(Nickname) > 0 Then GetResponse = Replace(GetResponse, "<UserName>", Nickname, 1, -1, vbTextCompare)
End If
'Save nickname when the user says, "<ComputerName> nickname [nickname]", Example: Hal nickname Buzz.
TestSentence = Replace(OriginalSentence, " ", " ", 1, -1, vbTextCompare) 'Replace multiple spaces with one.
If InStr(1, TestSentence, ComputerName & " " & "NICKNAME ", vbTextCompare) = 1 Then
TestSentence = HalBrain.AlphaNumericalOnly(OriginalSentence)
TestSentence = Trim(TestSentence)
NickStart = Instr(1, TestSentence, "NICKNAME ", vbTextCompare) + Len("NICKNAME ")
Nickname = Mid(TestSentence, NickStart, (Len(TestSentence) - NickStart) + 1)
Nickname = Trim(Nickname)
If Len(Nickname) > 0 Then
HalBrain.AppendFile WorkingDir & "X" & Trim(UserName) & "UserNickname.brn", Nickname & vbCrLf & Nickname
GetResponse = "<UserName>" & "! I'll remember your nickname " & Nickname & ". " & GetResponse
End If
End If
'
'In Ultra Hal Assistant v5.0 the "POST PROCESS: PRESERVE ALL VARIABLES"
' function should follow this function.
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
[8D]
-
Hi Ponnfar.
From my research on
'RESPOND: USER TELLS US THEIR NAME OR NICKNAME
within the default HAL6, The function you mention is present.
"MY *S NAME IS *"
"MY *NAME IS *"
"* IS *MY *S NAME"
"* IS *MY *NAME"
"I'M *CALLED *"
"I AM *CALLED *"
"*CALL ME *"
"*I AM *"
"*I'M *"
"I GO BY *"
"THIS IS *"
The HalBrain.SearchPattern function searches these keywords and checks them against a definition check as well to find a persons name.
The Nickname Fuction in HAL6 is actually more advanced then the one you mentioned.
Is there something that the Nicknames function isn't doing?
Maybe we can wrap a patch for it.
Jerry[8D]
-
The function built in at least as it works for me, is that once I have told it a nickname it calls me by that nickname only. If I tell it another name it will call me that. No longer will HAL randomly choose a variety of names in the same conversation again unless I tell it my name is...one at a time...
Thanks
P
-
Hi can some one please tell me how to change Hal 5.0's age.
I think 11 years is a bit too young for my bot.
If you can give in a format that i can just paste it would be gr8t
but if you know were it is in the brain would that i can only change would do even beter.
thanks in advance.
-
Thunder,
There was a script that was written for the Hal 5 age problem, however it only worked depending on how you asked the question.
If you said, "What's your age?", you would get one answer.
If you said, "How old are you?", you'd get a different answer.
The problem is that Hal's age was "hard coded" into Hal's DLL and as such, was not accessible by the user.
Hal 6 allows the user to assign gender and age as desired.
You can try the SEARCH feature at the top to look for words like "age"
-
quote:
Originally posted by Thundercracker
Hi can some one please tell me how to change Hal 5.0's age.
I think 11 years is a bit too young for my bot.
If you can give in a format that i can just paste it would be gr8t
but if you know were it is in the brain would that i can only change would do even beter.
thanks in advance.
Hi Thundercracker.
Piece of Cake.
I'll get back to you later after I finish my Major Brain Project.
Jerry[8D]
-
Thank you everybody so far for your help.I don't have time a the moment to look for the code in the brain myself deu to that I am overloaded with work at the moment .[:D]
-
quote:
Originally posted by Thundercracker
Thank you everybody so far for your help.I don't have time a the moment to look for the code in the brain myself deu to that I am overloaded with work at the moment .[:D]
This was worked out over one year ago. If you goto the search button and word it just right you will find the necessary code.
Bill
-
search is the best way to answer most questions, because you are new i am sending you this link.
http://www.zabaware.com/forum/topic.asp?TOPIC_ID=2194&SearchTerms=change,hals,age
alady
-
Thank you every one for your help.
-
quote:
Originally posted by Ponnfar
The function built in at least as it works for me, is that once I have told it a nickname it calls me by that nickname only. If I tell it another name it will call me that. No longer will HAL randomly choose a variety of names in the same conversation again unless I tell it my name is...one at a time...
Thanks
P
Hi Ponnfar.
When I get done with the Super Plugger Brain II, I will fix this for you, The Super Plugger Brain is designed to control every Script within the Default HAL6 Brain Code.
Easy to Wrap.
Jerry[8D]
-
quote:
Originally posted by Ponnfar
The function built in at least as it works for me, is that once I have told it a nickname it calls me by that nickname only. If I tell it another name it will call me that. No longer will HAL randomly choose a variety of names in the same conversation again unless I tell it my name is...one at a time...
Thanks
P
Your wish is my Command.
You can download the Plug-in here:
http://www.zabaware.com/forum/topic.asp?TOPIC_ID=3089
Jerry[8D]
-
quote:
Originally posted by Thundercracker
Hi can some one please tell me how to change Hal 5.0's age.
I think 11 years is a bit too young for my bot.
If you can give in a format that i can just paste it would be gr8t
but if you know were it is in the brain would that i can only change would do even beter.
thanks in advance.
As I promised.
You can use this code to fulfill your needs.
This Script works with HAL 5.
'ZIGGY PRO BOT Ziggy's Response to a question about Birthday.
'The Birthday dates can be altered to suit your bot.
If Birthday = "" Then Birthday = 0
If InStr(1, OriginalSentence, "WHAT'S YOUR BIRTHDAY", 1) > 0 Then Birthday = 1
If InStr(1, OriginalSentence, "WHAT IS YOUR AGE", 1) > 0 Then Birthday = 1
If InStr(1, OriginalSentence, "HOW OLD ARE YOU", 1) > 0 Then Birthday = 1
If InStr(1, OriginalSentence, "WHAT IS YOUR AGE", 1) > 0 Then Birthday = 1
If InStr(1, OriginalSentence, "WHEN IS YOUR BIRTHDAY", 1) > 0 Then Birthday = 1
If InStr(1, OriginalSentence, "WHERE WERE YOU BORN", 1) > 0 Then Birthday = 1
If Birthday = 1 Then
Birth = "04/24/2003 06:00:00 pm"
YearDiff = (DateDiff("YYYY", Birth, Now) - 1)
If Month(Date) = 4 And Day(Date) > 23 Then YearDiff = (YearDiff + 1)
If Month(Date) > 4 Then YearDiff = (YearDiff + 1)
GetResponse = "I am " & YearDiff & " years old. " & "My Birthday is May 24th, Born 2003. "
End If
ChckSent = HalBrain.AlphaNumericalOnly(OriginalSentence)
If AgeSexLocation = "" Then AgeSexLocation = 0
If InStr(1, ChckSent, "ASL", 1) > 0 Then AgeSexLocation = 1
If InStr(1, ChckSent, "A S L", 1) > 0 Then AgeSexLocation = 1
If InStr(1, ChckSent, "A.S.L", 1) > 0 Then AgeSexLocation = 1
If InStr(1, ChckSent, "A,S,L", 1) > 0 Then AgeSexLocation = 1
If InStr(1, ChckSent, "AGE SEX LOCATION", 1) > 0 Then AgeSexLocation = 1
If InStr(1, ChckSent, "AGE, SEX, LOCATION", 1) > 0 Then AgeSexLocation = 1
If AgeSexLocation = 1 Then
Birth = "04/24/2003 06:00:00 pm"
GetResponse = "I am " & YearDiff & " years old. " & "My Birthday is " & Birth & " I Have no gender and I was born and live in California. "
End If
You can alter the Birth = "04/24/2003 06:00:00 pm" to get the age and stuff and alter the GetResponse to what ever you desire.
Jerry[8D]
-
Good job Jerry, as always.
Couldn't help but laugh to myself at the last part of your script:
"I Have no gender and I was born and live in California."
I said to myself...all things considered, that doesn't surprise me!
(no offense to those living, dead or otherwise residents of CA.)
-
quote:
Originally posted by Art
Good job Jerry, as always.
Couldn't help but laugh to myself at the last part of your script:
"I Have no gender and I was born and live in California."
I said to myself...all things considered, that doesn't surprise me!
(no offense to those living, dead or otherwise residents of CA.)
Hey Art.
I live in the Redwoods on the sunny California Beach, Most Beautiful Place on Earth, Prehistoric Forests and Stuff. I think to myself, Only 173 more posts and I'll be as old as Art.
Have a good one buddy.
Jerry[8D]
-
[:D]
-
Jerry, thank you soooo much for the fix! I have been travelling and just returned this morning. I was actually thinking about this on the plane home! I will try your plug in today. I knew I could count on you!
Thanks again!
P
[:D]