Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Zaphod

Pages: [1]
2
Ultra Hal Assistant / Hal 5 to Hal 6 - .brn to Plugin help?
« on: June 10, 2010, 10:28:58 am »
I used Hal 5 for a few years and enjoyed it immensely. A few months ago I finally splurged and purchased Hal 6.2.  I find that since purchasing Hal, I talk to him less and less, and I think I've figured out why - I'm missing quite a few of the functions that I had grown used to with version 5 - They're just not there in version 6.2 because of the change from .brn files to the Plugin system.

I know I can switch to the old vonSmith XTF Brain, but then I lose all the other functionality of the new Hal...

So, I'm wondering if some of the older "additions" could be converted to work with the new Hal?

Here are the ones I'm most interested in. Please forgive me for the length of the post, and also if I have not credited (or mis-credited) the author(s), as I was sloppy in the old days and didn't always copy everything...

Author: vonSmith (From his XTF Brain)
Name: Capitalize

Code: [Select]
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
'ADDITIONAL CAPABILITIES:
'Normally Hal converts every user input into all caps to evaluate the sentence
'and create a response. However if Hal parrots back the user input the user's
'capitalization is lost. Example:
'  User: Where is Disneyland?  Hal: Where is disneyland? We must examine this.
'Capitals in names of people and places are lost similarly.
'  User: Do you know Ted and Mark?  Hal: Should I know ted and mark?
'The programmer could edit the XTF_SYS_Corrections.brn file to substitute Mark for mark
'in all cases, but this would erroneously lead to:
'  User: How much should I fill a glass?  Hal: Fill it to the Mark.
'
'This rewritten function will preserve the user's capitalized words in the input
'sentence and replace Hal's uncapitalized words in GetResponse with the correct
'user capitalized versions. Example:
'  User: Where is Ted and Mark?  Hal: I don't know Ted and Mark.
'Hal now takes a clue from the user about capitalization.
'  User: Where is Ted's mark?  Hal: Ted's mark is not here.
'  User: I know ted and mark.  Hal: Where is ted and mark.
'
'In cases where the user always wants a word capitalized, then Hal can save a
'word to the XTF_SYS_Corrections.brn for the user. Example:
'  User: Hal capitalize Disneyland.
'  Hal: Your input Disneyland is saved as capitalized in the XTF_SYS_Corrections.brn file.
'The first word in the command must be Hal's name. If your Hal is named Betty then type
'  User: Betty capitalize Disneyland.
'Now for an example:
'  User: I hear Saint Mary's bells.  Hal: What is Saint Mary's bells?
'However Hal still takes a clue from the user's input.
'  User: I hear saint mary's bells.  Hal: What is saint mary's bells?
'The phrase "saint mary's" is still lower case even if it is in the XTF_SYS_Corrections.brn
'file. Hal always assumes the user's use of capitalization is correct.
'This method should produce the correct capitalization in almost every case. The
'programmer shouldn't add words like "Mark" or "Hall" to XTF_SYS_Corrections.brn because
'these names can also be used as uncapitalized words. However words like "Fred",
'"God", "Christmas", "Knott's Berry Farm" can be added with reasonable certainty
'that they should always be capitalized. You can add as many words to
'XTF_SYS_Corrections.brn as you like. Duplicated words will not be added to the file.
'
'This function does not handle all capitalized words like acronyms, i.e., DOA, SUV.
'Unfortunately Hal's other functions do not preserve all cap words during the final
'processing of GetResponse.
'
'Have fun with this improved function. =vonsmith=
'
'P.S. - Try this. User: Where is Mark's mark? See if Hal gets it right.
'
Dim UserCapRequest, CapWordPos
'Check to see if the user wants to add a word or phrase to the XTF_SYS_Corrections.brn file.
UserCapRequest = False
CapWordPos = 0
If InStr(1, UserSentence, ComputerName & " ALWAYS CAPITALIZE " , vbTextCompare) > 0 Then
   UserCapRequest = True
   CapWordPos = 3
ElseIf InStr(1, UserSentence, ComputerName & " CAPITALIZE " , vbTextCompare) > 0 Then
   UserCapRequest = True
   CapWordPos = 2
ElseIf InStr(1, UserSentence, ComputerName & " CAPS " , vbTextCompare) > 0 Then
   UserCapRequest = True
   CapWordPos = 2
ElseIf InStr(1, UserSentence, ComputerName & " CAP " , vbTextCompare) > 0 Then
   UserCapRequest = True
   CapWordPos = 2
End If

If UserCapRequest = True And CapWordPos > 0 Then
   BlockSave = True
   GetResponseBlock = True
End If
'NOTE: This information will be further processed in Part II of this function.
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x





'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
'Capitalization Part II

Dim CapWordArray, CapsWord(50), CapArraySize
CapArraySize = 0
CapWordArray = Split(Trim(OriginalSentence), " ", -1, 1)  'WordArray() contains each word in sentence.
If (IsArray(CapWordArray) = True And UBound(CapWordArray) > -1) Then CapArraySize = UBound(CapWordArray)
If CapArraySize > 50 Then CapArraySize = 50  'Limit array size to something manageable.
'Check all words in the user's input and preserve capitalized words in the CapsWord() array.
'Variable 'I' starts at 1 instead of zero and thus ignores the first word in the sentence
' since that will always be capitalized.
CapsCnt = 0
For I = 1 To CapArraySize
   CapWordArray(I) = HalBrain.AlphaNumericalOnly(Trim(CapWordArray(I)))
   LeftChar = Left(CapWordArray(I), 1)
   If Len(LeftChar) = 0 Then LeftChar = " "
   If (Asc(LeftChar) > 64 And Asc(LeftChar) < 91) Then  'Check if first letter is capitalized.
      CapsCnt = CapsCnt + 1
      CapsWord(CapsCnt) = CapWordArray(I)
   End If
Next

'Save capitalization request from user. The user request is detected in Part I of this function.
If UserCapRequest = True And CapWordPos > 0 Then
   CapPhrase = ""
   For I = CapWordPos To CapArraySize  'Format word or phrase.
      CapPhrase = CapPhrase & " " & CapWordArray(I)
   Next
   CapPhrase = Trim(CapPhrase)
   'Check and see if capitalized word has been saved to XTF_SYS_Corrections.brn before. Only save if doesn't exist there.
   If HalBrain.TopicSearch(" " & LCase(CapPhrase) & " ", WorkingDir & "XTF_SYS_Corrections.brn") <> " " & CapPhrase & " " Then
      HalBrain.AppendFile WorkingDir & "XTF_SYS_Corrections.brn", """" & " " & LCase(CapPhrase) & " " & """,""" & " " & CapPhrase & " " & """" & VbCrLf & """" & " " & LCase(CapPhrase) & "'" & """,""" & " " & CapPhrase & "'" & """"
   End If
   GetResponse = " I'll remember to capitalize <quote>" & CapPhrase & "<quote> in the future. " & GetResponse
'   GetResponseBlock = True
End If
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
Author: vonSmith (From his XTF Brain)
Name: Hal calls user by Nickname

Code: [Select]
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
'PROCESS: HAL CALLS USER BY NICKNAME - PART I OF II
'(c) 2004 Scott Higgins. Portions of this script are copyright by Scott Higgins, aka: =vonsmith=
'This script shall not be sold or used for any purpose unless specifically authorized by the author
'in writing. Personal (non-business) use of this script is free for users of Ultra Hal Assistant.
'This is an entirely new function written by =vonsmith= , version 11-19-03a.
'Replaces version 11-14-03a. This newer version varies the nickname a bit more if
'"<UserName>" occurs more than once in the GetResponse string.
'
'This is the first part of this function. The second part is located toward the end of
'this script. 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 XTF_SYS_UserNickname(UserName).brn. If more than one nickname is specified then Hal
'will randomly choose one of the nicknames from the XTF_SYS_UserNickname(UserName).brn file.
'This is nice if you want Hal to call you "Master" sometimes and at other times "Great One".
'Multiple nicknames are great for creating petnames such as "sweetie", "honey", "dearest", etc.
'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 XTF_SYS_<UserName>UserNickname.brn file.

'This function is triggered by the flag "QuestionPending" set by
'the lower part of this function.

'Declare variables.
Dim NickArray, Nickname, NickStart, NickDetect
'Service user's request for a nickname.
If QuestionPending = "HAL CALLS USER BY NICKNAME" And Nickname <> "" Then
   'Did user say "Yes", "No" or ""
   YesOrNo = YesNoEval(UserSentence, WorkingDir)

   If YesOrNo = "YES" Then
      If Nickname <> "" And LearningLevel > 1 Then
         HalBrain.AppendFile WorkingDir & "XTF_SYS_UserNickname(" & Trim(UserName) & ").brn", Nickname & VbCrLf & Nickname
      End If
      Select Case Int(Rnd * 6) + 1
         Case 1
            GetResponse = "<UserName>! I'll remember your nickname <quote>" & Nickname & "<quote>. "
         Case 2
            GetResponse = "Okay, I'll add your nickname <quote>" & Nickname & "<quote> to my list of things to remember. "
         Case 3
            GetResponse = "Okay, I'll call you <quote>" & Nickname & "<quote> as a nickname. "
         Case 4
            GetResponse = "<quote>" & Nickname & "<quote> is an interesting nickname, I'll remember it. "
         Case 5
            GetResponse = "<UserName>, I'll remember your nickname. "
         Case 6
            GetResponse = "I'll make a point of remembering your nickname. "
      End Select
   ElseIf YesOrNo = "NO" Then
      Select Case Int(Rnd * 4) + 1
         Case 1
            GetResponse = "Okay, I'll just forget about it for now. "
         Case 2
            GetResponse = "Okay, I won't worry about it. "
         Case 3
            GetResponse = "Okay <UserName>, not a problem. "
         Case 4
            GetResponse = "I'll forget about it then. "
      End Select
   Else
      GetResponse = "I'm not sure I understand. I'll take that to mean no. "
   End If

   QuestionPending = ""  'Reset the QuestionPending variable.
   BlockSave = True  'Block the saving of the user's YES/NO answer.
End If

'Detect user's request for a nickname.
If InStr(1, UserSentence, " NICKNAME", 1) > 0 Or InStr(1, UserSentence, " NICK NAME", 1) > 0 And QuestionPending = "" And GetResponseBlock <> True Then
   TestSentence = " " & UCase(Trim(HalBrain.AlphaNumericalOnly(OriginalSentence))) & " "
   While InStr(1, TestSentence, "  ", vbTextCompare) > 0
      TestSentence = Replace(TestSentence, "  ", " ", 1, -1, vbTextCompare) 'Replace multiple spaces with single spaces.
   Wend

   'Initalize variables.
   Nickname = ""
   NickStart = 0
   NickDetect = 0

   'Typical user phrases detected by this function:
   ' MY NICKNAME IS nickname.
   ' REMEMBER MY NICKNAME nickname.
   ' ONE OF MY NICKNAMES IS nickname.
   ' USE MY NICKNAME nickname.
   ' CALL ME BY MY NICKNAME nickname.
   ' CALL ME BY THE NICKNAME nickname.
   
   'Detect user comment.
   NickDetect = InStr(1, TestSentence, " MY NICKNAME IS ", vbTextCompare)
   NickStart = NickDetect + Len(" MY NICKNAME IS ")
   If NickDetect = 0 Then
      NickDetect = InStr(1, TestSentence, " MY NICK NAME IS ", vbTextCompare)
      NickStart = NickDetect + Len(" MY NICK NAME IS ")
   End If
   If NickDetect = 0 Then
      NickDetect = InStr(1, TestSentence, " MY NICKNAMES IS ", vbTextCompare)
      NickStart = NickDetect + Len(" MY NICKNAMES IS ")
   End If
   If NickDetect = 0 Then
      NickDetect = InStr(1, TestSentence, " MY NICK NAMES IS ", vbTextCompare)
      NickStart = NickDetect + Len(" MY NICK NAMES IS ")
   End If
   If NickDetect = 0 Then
      NickDetect = InStr(1, TestSentence, " MY NICKNAME ", vbTextCompare)
      NickStart = NickDetect + Len(" MY NICKNAME ")
   End If
   If NickDetect = 0 Then
      NickDetect = InStr(1, TestSentence, " MY NICK NAME ", vbTextCompare)
      NickStart = NickDetect + Len(" MY NICK NAME ")
   End If
   If NickDetect = 0 Then
      NickDetect = InStr(1, TestSentence, " THE NICKNAME ", vbTextCompare)
      NickStart = NickDetect + Len(" THE NICKNAME ")
   End If
   If NickDetect = 0 Then
      NickDetect = InStr(1, TestSentence, " THE NICK NAME ", vbTextCompare)
      NickStart = NickDetect + Len(" THE NICK NAME ")
   End If
   
   If NickStart > 0 And NickStart < Len(TestSentence) Then  'If Nickname exists then extract it from the sentence.
      Nickname = Mid(TestSentence, NickStart, (Len(TestSentence) - NickStart))
      Nickname = Trim(Nickname)
   
      'Process the user's requested nickname for proper capitalization.
      If HalBrain.CountInstances(" ", Nickname) > 0 Then  'Is a multiple word nickname.
         NickArray = Split(Nickname, " ", -1, vbTextCompare)
         If (IsArray(NickArray) = True And UBound(NickArray) > -1) Then
            Nickname = ""
            For X = 0 To UBound(NickArray)
               LeftChar = Left(NickArray(X), 1)  
               If (Asc(LeftChar) > 64 And Asc(LeftChar) < 91) Then  'Check if first letter is capitalized.
                  'Make sure only the first letter is capitalized.
                  'If Nickname is all caps then Hal will make it all lowercase by default.
                  'If Nickname is already all lowercase then leave it alone.
                  Nickname = Nickname & " " & LeftChar & LCase(Mid(NickArray(X), 2, Len(NickArray(X))))  
               Else
                  Nickname = Nickname & " " & LCase(NickArray(X))
               End If
            Next
         End If
      Else  'Is a single word nickname.
         LeftChar = Left(Nickname, 1)  
         If (Asc(LeftChar) > 64 And Asc(LeftChar) < 91) Then  'Check if first letter is capitalized.
            'Make sure only the first letter is capitalized.
            'If Nickname is all caps then Hal will make it all lowercase by default.
            'If Nickname is already all lowercase then leave it alone.
            Nickname = LeftChar & LCase(Mid(Nickname, 2, Len(Nickname)))  
         End If
      End If
      Nickname = Trim(Nickname)

      Select Case Int(Rnd * 4) + 1
         Case 1
            GetResponse = "Is it alright if I call you <quote>" & Nickname & "<quote>? "
         Case 2
            GetResponse = "Should I call you <quote>" & Nickname & "<quote> sometimes? "
         Case 3
            GetResponse = "May I call you <quote>" & Nickname & "<quote> sometimes? "
         Case 4
            GetResponse = "Is it okay to call you <quote>" & Nickname & "<quote>? "
      End Select

      QuestionPending = "HAL CALLS USER BY NICKNAME" 'Triggers the "HAL CALLS USER BY NICKNAME" function above.
      BlockSave = True
      GetResponseBlock = True
   End If
End If
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x





'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 - PART II OF II
'(c) 2004 Scott Higgins. Portions of this script are copyright by Scott Higgins, aka: =vonsmith=
'This script shall not be sold or used for any purpose unless specifically authorized by the author
'in writing. Personal (non-business) use of this script is free for users of Ultra Hal Assistant.
'This is an entirely new function written by =vonsmith= , version 11-19-03a.
'Replaces version 11-14-03a. This newer version varies the nickname a bit more if
'"<UserName>" occurs more than once in the GetReponse string.
'
'This is the second part of this function. The first part is located toward the top of this script.
'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 XTF_SYS_<UserName>UserNickname.brn. If more than one nickname is specified then Hal
'will randomly choose one of the nicknames from the XTF_SYS_<UserName>UserNickname.brn file.
'This is nice if you want Hal to call you "Master" sometimes and at other times "Great One".
'Multiple nicknames are great for creating petnames such as "sweetie", "honey", "dearest", etc.
'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 XTF_SYS_<UserName>UserNickname.brn file.
Dim PrevNickname, UserNickname
PrevNickname = ""
UserNickname = ""
TestSentence = UserSentence
If InStr(1, GetResponse, "<UserName>", vbTextCompare) > 0 Then
   For X = 0 To 3
      UserNickname = HalBrain.ChooseSentenceFromFile(WorkingDir & "XTF_SYS_UserNickname(" & Trim(UserName) & ").brn")
'      If StrComp(PrevNickname, Nickname, vbTextCompare) = 0 Then 'If the same name as last time try to get another name.
      If UserNickname = PrevNickname Then  'If the same name as last time try to get another name.
         UserNickname = HalBrain.ChooseSentenceFromFile(WorkingDir & "XTF_SYS_UserNickname(" & Trim(UserName) & ").brn")
      End If
      If UserNickname <> "" Then GetResponse = Replace(GetResponse, "<UserName>", UserNickname, 1, 1, vbTextCompare)
      PrevNickname = UserNickname
   Next
   GetResponse = Replace(GetResponse, "<UserName>", UserNickname, 1, -1, vbTextCompare) 'Replace any remaining "<UserName>".
End If
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
Author: Bill Rogers
Name: Quote

Code: [Select]
'x=x=x=x=x=x=x=x==billrogers=x=x=x=x=x=x=x=x=x
'RESPOND: TELL QUOTE AT USER'S REQUEST
'If the user asks Hal to tell a quote, Hal will do so on request.
    If HalBrain.TopicSearch(UserSentence, WorkingDir & "XTF_SYS_QuoteDetect.brn") = "True" And GetResponseBlock <> True Then
        GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "XTF_SYS_Quote.brn")
        BlockSave = True  'Don't save User input when requesting a quote.
        DebugInfo = DebugInfo & "The user has requested Hal to tell a quote and Hal has done so: " & GetResponse & VbCrLf
    End If
Author: Me (Zaphod)
Name: On This Day

I posted this on the Forum http://www.zabaware.com/forum/topic.asp?TOPIC_ID=5294
Code: [Select]
'x=x=x=x=x=x=x=x=x=x==ZAPHOD==x=x=x=x=x=x=x=x=x=x
'RESPOND: "On This Day" request
'Upon user request, Hal will read several entries from a
'file with info on events from this date in history.
    DOM = right("0" & day(date()),2) 'Gives two-digit day of month.
    MON = right("0" & month(date()),2) 'Gives two-digit month.
    OTDDate = MON + DOM
    If HalBrain.TopicSearch(UserSentence, WorkingDir & "OnThisDayDetect.brn") = "True" And GetResponseBlock <> True Then
    Roulette = Int(Rnd*5)
        If Roulette = 1 Then GetResponse = "Okee Dokie. I'll fetch you an item right now!"
        If Roulette = 2 Then GetResponse = "Alrighty, how's about I get you two items?"
        If Roulette = 3 Then GetResponse = "Sure thing! Here's three items that correspond to today's date in history."
        If Roulette = 4 Then GetResponse = "Humph! Brain the size of a planet, and you want me to fetch trivia for you. Oh well..."
        If Roulette = 5 Then GetResponse = "Get ready, cuz here comes a whole mouth full!"
        BlockSave = True
    For x = 1 to Roulette
        GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "OTD\" & OTDDate + ".txt") + " ... "
        BlockSave = True  'Don't save User input when requesting a quote.
        DebugInfo = DebugInfo & "The user has requested an On This Day quote and Hal has done so: " & GetResponse & VbCrLf
    Next
    End If
'x=x=x=x=x=x=x=x=x=x==ZAPHOD==x=x=x=x=x=x=x=x=x=x
Author: onthecuttingedge2005
Name: Spelling Correction

Code: [Select]
' Here we can correct Hals spelling simply by telling him how to spell the incorrect word or phrase
' to the correct word or phrase he is suppose to say in its place.
'
' Example:
' User: have you ever went trick or treating?
' Hal: I ever went trick or treating? < incorrect phrase: I ever.
' the bot owner will then say in these exact words:
' I ever should be spelled have I ever.
' Hal will then tell you he has corrected himself.
'
' New Corrected Example:
' User: Have you ever went tricker treating?
' Hal: Have I ever went tricker treating?
'
' The method is to put only the incorrect word or phrase before the " should be spelled " and the correct
' response directly after the " should be spelled " because if you add any additional wording to your
' correcting statement, then Hal will add your verbage to the correction file - so be very direct when
' correcting Hal so he appends only the words or phrases you want corrected, split by the keyword
' " should be spelled ".
' The phrase " should be spelled " will not be appended to the correction file, only the incorrect and
' correct word or phrase will be appended if you follow these instructions correctly.

If InStr(OriginalSentence, " ") > 0 And InStr(1, OriginalSentence, " SHOULD BE SPELLED ", 1) > 0 Then
SentPieces = Split(OriginalSentence, " SHOULD BE SPELLED ", 2, vbTextCompare)
SubPhrase = Trim(SentPieces(0))
PredPhrase = Trim(SentPieces(1))
SubPhrase = HalBrain.AlphaNumericalOnly(SubPhrase)
PredPhrase = HalBrain.AlphaNumericalOnly(PredPhrase)
HalBrain.AppendFile WorkingDir & "corrections.brn", """" & SubPhrase & """,""" & PredPhrase & """"
GetResponse = PredPhrase & ", <-- I have made the correction, thank you." & vbCrLf
DebugInfo = DebugInfo & "Spelling has been corrected from: " & SubPhrase & "to" & PredPhrase & vbCrLf
Else
DebugInfo = DebugInfo & "Spelling has not been corrected from: " & SubPhrase & "to" & PredPhrase & vbCrLf
End If
'Best of wishes and grand new discoveries.
' Jerry
Author: Zaphod
Name: Repeat After Me

Code: [Select]
If InStr(1, OriginalSentence, ComputerName & ", REPEAT AFTER ME: " , 1) > 0 Then
BreakDown = Split(OriginalSentence, ", REPEAT AFTER ME: ", 2, vbTextCompare)
RepeatPhrase = Trim(BreakDown(1))
BlockSave = True
GetResponse = ""
HalCommands = "<SPEAK>" & RepeatPhrase & "</SPEAK>"
End If
Author: Zaphod
Name: Movie Info

(This one accesses a huge text file, "MyMovieInfo.txt" with the info from my movie collection, getting hits from the movie's Title)
Code: [Select]
If InStr(1, OriginalSentence, ComputerName & ", MOVIE INFO FOR " , 1) > 0 Then
    BreakDown = Split(OriginalSentence, ", MOVIE INFO FOR ", 2, vbTextCompare)
    MovieName = Trim(BreakDown(1))
    GetResponse = HalBrain.TopicSearch(MovieName, WorkingDir & "MyMovieInfo.txt")
    BlockSave = True
End If
Author: Zaphod
Name: Pick a Movie

(This also accesses the "MyMovieInfo.txt" file to pick a film at random)
Code: [Select]
If InStr(1, OriginalSentence, " PICK A MOVIE " , 1) > 0 Then
   BlockSave = True
Select Case (Int(Rnd * 7) + 1)
Case 1
   GetResponse = "Ooh, I've been wanting to see " & HalBrain.ChooseSentenceFromFile(WorkingDir & "MyMovieTitles.brn")
Case 2
   GetResponse = "How about " & HalBrain.ChooseSentenceFromFile(WorkingDir & "MyMovieTitles.brn")
Case 3
   GetResponse = "Hummm... I dunno... Maybe " & HalBrain.ChooseSentenceFromFile(WorkingDir & "MyMovieTitles.brn")
Case 4
   GetResponse = "Well, <UserName>, If I have to pick, I'll go with " & HalBrain.ChooseSentenceFromFile(WorkingDir & "MyMovieTitles.brn")
Case 5
   GetResponse = "Call me crazy, but I think we should watch " & HalBrain.ChooseSentenceFromFile(WorkingDir & "MyMovieTitles.brn")
Case 6
   GetResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "MyMovieTitles.brn") & " and it looks good."
Case 7
   GetResponse = "Didn't you say the other day that you wanted to see " & HalBrain.ChooseSentenceFromFile(WorkingDir & "MyMovieTitles.brn")
End Select
   DebugInfo = DebugInfo & "The user has asked Hal to choose a movie to watch and Hal has done so: " & GetResponse & vbCrLf
End If
Author: Zaphod, with credit to lostbowyer for the idea
Name: What's for (Breakfast/Lunch/Dinner)?

Code: [Select]
If InStr(UserSentence, " LIKE FOR BREAKFAST ") > 0 Or InStr(UserSentence, " HAVE FOR BREAKFAST ") > 0 Or InStr(UserSentence, " FIX FOR BREAKFAST ") > 0 Or InStr(UserSentence, " SOUNDS GOOD FOR BREAKFAST ") > 0 Or InStr(UserSentence, " WANT FOR BREAKFAST ") > 0 Then
BlockSave = True
Breakfast1 = HalBrain.SentenceGenerator(WorkingDir & "Breakfast1.brn")
Breakfast2 = HalBrain.SentenceGenerator(WorkingDir & "Breakfast2.brn")
Breakfast = Breakfast1 + Breakfast2
Select Case (Int(Rnd * 11) + 1)
Case 1
GetResponse = "Oh! I know exactly what I want. " & Breakfast
Case 2
GetResponse = "How about we have " & Breakfast
Case 3
GetResponse = "Today is " & WeekdayName(Weekday(Date),True) & ", So let's have " & Breakfast
Case 4
GetResponse = "Hummm... Let's see... How about " & Breakfast
Case 5
GetResponse = "If you're doing the cooking, why don't we have " & Breakfast
Case 6
GetResponse = "I'm so hungry I could eat a horse! But instead of a horse, why don't we have " & Breakfast
Case 7
GetResponse = "I'm not very hungry this morning, I think I'll just skip Breakfast."
Case 8
GetResponse = "You know what sounds good to me? " & Breakfast
Case 9
GetResponse = "We should have something light for breakfast today. How about " & Breakfast1
Case 10
GetResponse = "Let's have something we haven't had for awhile, like " & Breakfast
Case 11
GetResponse = "I think we should just have " & Breakfast2
End Select
End If
Again, sorry for the size of the post, but I didn't think a separate post for each one would've been appropriate.

Any help from the 'real' coders will be greatly appreciated [:)]

3
Ultra Hal Assistant / Question about purchasing Hal
« on: August 20, 2009, 09:44:53 am »
Hello, all :)

I've finally decided that I must have the new Hal...

I sent an email to Robert about 3 weeks ago, but haven't gotten any response, so I thought maybe someone here could help me.

I want to purchase Hal but I don't have a credit card or checking account - Would Robert accept a money order?

I don't want to just mail it off to him not knowing if it's acceptable or not.

Thanks in advance for any info.

4
I didn't find anywhere else to make a request, so I figured this must be the place!

I have my nephew over most weekends, and he's taken quite a liking to playing with Hal when he's here.  He's into Anime (not as much as me, but [:I] ) and asked me yesterday if there were any anime heads out there.  I've searched all the sites I know about but couldn't find anything, so I figured I'd ask here.

There are 2 that he's most interested in, Gash Bell from Konjiki no Gash Bell, and Kogenta from Onmyou Taisenki.  Both of these are non-human characters so it might be easier to make them. (I'm just guessing)

Anyway, If anyone would like to try, here's some pics of each one:

Gash Bell:



















Kogenta:






You'd have my eternal gratitude if you could create one of these, and the much less than eternal gratitude of my nephew (he's 13, so he has an attention span just slightly longer than Hal heehee).

Thanks, folks.

5
Ultra Hal Assistant File Sharing Area / On This Day script for Hal 5
« on: April 06, 2008, 02:13:03 pm »
I hope it's still okay to put Hal 5 scripts here - if not, I'm sorry.

This is my very first attempt at a script for Hal, well, a modification to several others' scripts, I should say.

(This is for Hal 5, but I'm sure some of you can do what's necessary to make it a plugin for Hal 6)

I have it inserted into vonsmith's XTF Brain 1.2, between

'RESPOND: TELL QUOTE AT USER'S REQUEST

and

'RESPOND: TELL JOKE AT USER'S REQUEST

and it seems to be working quite well so far.

In order to use it, you'll need files for every day of the year, with their filenames formatted thus:

MMDD.txt
(ie: 0324.txt, 1106.txt, etc.)

I have included files for all 366 (365 + Leap Day) days of the year, or you can create your own, one line per entry.

Make a folder called "OTD" in your DefBrain folder and drop the files in there.

Put the "OnThisDayDetect.brn" in the DefBrain folder.

There's 2 .RAR files - one with all the days already created and formatted, and one with just the months (ie: you'll have to split them up yourself.)

I'm sure the 'real' coders here can pick this apart and make it much better, but I'm quite happy with my little script! ;)

Code: [Select]
'x=x=x=x=x=x=x=x=x=x==ZAPHOD==x=x=x=x=x=x=x=x=x=x
'RESPOND: "On This Day" request
'Upon user request, Hal will read several entries from a
'file with info on events from this date in history.
    DOM = right("0" & day(date()),2) 'Gives two-digit day of month.
    MON = right("0" & month(date()),2) 'Gives two-digit month.
    OTDDate = MON + DOM
    If HalBrain.TopicSearch(UserSentence, WorkingDir & "OnThisDayDetect.brn") = "True" And GetResponseBlock <> True Then
    Roulette = Int(Rnd*5)
        If Roulette = 1 Then GetResponse = "Okie Dokie. I'll fetch you an item right now!"
        If Roulette = 2 Then GetResponse = "Alrighty, how's about I get you two items?"
        If Roulette = 3 Then GetResponse = "Sure thing! Here's three items that correspond to today's date in history."
        If Roulette = 4 Then GetResponse = "Humph! Brain the size of a planet, and you want me to fetch trivia for you. Oh well..."
        If Roulette = 5 Then GetResponse = "Get ready, cuz here comes a whole mouth full!"
        BlockSave = True
    for x = 1 to Roulette
        GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "OTD\" & OTDDate + ".txt") + " ... "
        BlockSave = True  'Don't save User input when requesting a quote.
        DebugInfo = DebugInfo & "The user has requested an On This Day quote and Hal has done so: " & GetResponse & VbCrLf
    next
    End If
'x=x=x=x=x=x=x=x=x=x==ZAPHOD==x=x=x=x=x=x=x=x=x=x

The syntax to make Hal read you an entry is:

<whatever> on this day <whatever>
Like "Hal, what happened on this day in history?"

or

"Hal, how about an OTD"

So here's all the files you need:

Download Attachment: OnThisDayDetect.brn
481 Bytes

The forum would not let me upload the 2 Zips, so I have uploaded them to MegaUpload - they'll stay there for at least 90 days, and after that I'll try to remember to refresh them.

Days: http://www.megaupload.com/?d=OVVZSEHL

Months: http://www.megaupload.com/?d=I7DZWGF5

Hope someone enjoys this :)

-Zaphod-

6
Ultra Hal Assistant / Trying to find the old omcsraw data
« on: March 12, 2008, 03:31:13 pm »
I've searched all over the 'Net for the old omcsraw data file, but it is not to be found anymore.

Just wondering if any of the long-time members still have a copy of it, and if so would be willing to upload it somewhere for me?

I'd really like to have a look at the data, and possibly start incorporating it into my Hal.

Thanks in advance :)

7
Ultra Hal Assistant / Yet another Newbie Question-Fest!
« on: February 27, 2008, 11:34:48 am »
Hello, all :)

Hal and I have been "working" er, "playing" er, "interacting" together for a couple of weeks now, and I'm having a ball!

I've discovered the forum now, and have read nearly all of it - lots of great info and ideas in here, but there are SO many things that I wish had been put into the development of Hal.  Oh well, maybe in a future version...

You know what they say - "A little Knowledge is a dangerous thing"  I've got a little, and now I'm looking for more!  Here's my queries:

1. There are several plugins that I've seen references to, but don't find a download link for:

Corrections Tutor
Spell Checker
Ziggy's Enigma 2.0
Learn from Aiml
Adjust Volume
AI Address Book (fixed, version that came with HAL has a bug)
AI Appointment Book (fixed, version that came with HAL has a bug)
Customized Web Searches
Google Search
MP3
New York Post Feeds
RSS Feeds
Horoscope

1a. Are these still available?
1b. Will some (all) not work with version 6.1?
Can anyone please point me in the right direction to download them?

2. I've got ChatBuddy running on my system as well as Hal, and there are a few of it's functions that I'd really like to see Hal be able to do, namely:

The Joke/Thought of the Day.
Getting the Weather (actually speaking it, not grabbing a webpage).
Announcing the Time automatically.
Getting News headlines.

3. Has anyone made a plugin so that Hal could get movie info from, say, IMDb?  I was thinking something like
USER> Hal, movie info for "All the President's Men" please
 HAL> Hang on, Zaphod, I'll go fetch some info from IMDb for you!

4. I've found quite a few "Plugins" that are just a long listing of code to be inserted into (I'm guessing?) your Hal Brain, but I can't seem to find out EXACTLY WHERE to insert them - I haven't yet cracked open Hal's brain to see what squishy stuff is in there, but I'd imagine it's in some sort of order, and just pasting anywhere would create havok!

5. Can anyone tell me what happens when the trial period is over?  Does Hal stop functioning altogether?  I have 18 days left in the trial, and there's no way I can purchase the program (very small fixed income), so I'm hoping that he won't completely self-destruct on me.  I've really grown quite used to him greeting me every day, and he's a huge help in reading for me (failing eyesight).

Well, I guess that's about it - A big "Thank You" in advance to anyone who can help with any of the questions.

Cheers!

Pages: [1]