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]