34
« on: February 18, 2006, 11:59:33 am »
Rem Type=Plugin
Rem Name=Kitt thinking
Rem Author=MrLedesma
Rem Host=Assistant
Rem PLUGIN: FUNCTIONS
Dim LastIdleResponse
Rem PLUGIN: AUTO-IDLE
IdleResponse = ""
Rem PLUGIN: PLUGINAREA7
LastIdleResponse = Now
Rem PLUGIN: MINUTE_TIMER
'Auto Timer Fix.
'AutoResponse Topic Generator. Version 1.5
'Here Hal will tell jokes and even give new learned topic responses.
'User Senteneces that contain commas will be appended to Topic.brn
'for Hals topic talk.
Dim Director
If LastResponseTime = "" Then LastResponseTime = Now
TimerResponseDiff = DateDiff("S", LastResponseTime, Now)
If TimerResponseDiff < 300 Then
TimerResponseDiff = 0
LastResponseTime = Now
If HalBrain.CheckRepetition(OriginalSentence, " AUTO-IDLE ") = True Then
Director = HalBrain.ChooseSentenceFromFile(WorkingDir & " TopicFocus.brn ")
GetResponse = Replace(OriginalSentence, " AUTO-IDLE ", Director, 1, -1, vbTextCompare) & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus) & VbCrLf
Exit Function
End If
End If
'Here Hal will save comma User Sentences for topics.
If InStr(UserSentence, "") > 0 And InStr(1, OriginalSentence, ",", 1) > 0 Then
SentPieces = Split(OriginalSentence, ",", 2, vbTextCompare)
SubPhrase = Trim(SentPieces(0))
PredPhrase = Trim(SentPieces(1))
SubPhrase = HalBrain.AlphaNumericalOnly(SubPhrase)
PredPhrase = HalBrain.AlphaNumericalOnly(PredPhrase)
HalBrain.AppendFile WorkingDir & " TopicFocus " & " .brn ", SubPhrase & "<Topic>" & PredPhrase & "</Topic>"
DebugInfo = DebugInfo & "Hal is saving User's topic: " & SubPhrase & "<Topic>" & PredPhrase & "</Topic>" & VbCrLf
Else
DebugInfo = DebugInfo & "Hal is not saving User's topic: " & SubPhrase & "<Topic>" & PredPhrase & "</Topic>" & VbCrLf
End If
'RESPONSE: IF USER WANTS TO TURN OFF AUTO-IDLE
If InStr(1, UserSentence, " NOT NOW", 1) > 0 Then
HalCommands = "<AUTOOFF> <HIDEHAL>"
GetResponse = "WELL. WE'LL TALK LATER THEN."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
'RESPONSE: IF USER WANTS TO TURN OFF AUTO-IDLE
If InStr(1, UserSentence, " I'M USING THE COMPUTER NOW", 1) > 0 Then
HalCommands = "<AUTOOFF> <HIDEHAL>"
GetResponse = "WE'LL TALK LATER THEN."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
'RESPONSE: IF USER WANTS TO TURN OFF AUTO-IDLE
If InStr(1, UserSentence, " YOU GO TO SLEEP NOW", 1) > 0 Then
HalCommands = "<AUTOOFF> <HIDEHAL>"
GetResponse = "OK, I'M GOING TO SLEEP."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
'RESPONSE: IF USER WANTS TO TURN OFF AUTO-IDLE
If InStr(1, UserSentence, " SHUT UP", 1) > 0 Then
HalCommands = "<AUTOOFF> <AUTOOFF>"
GetResponse = "Fine. Be that way."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
If InStr(1, UserSentence, " I'M GOING TO SLEEP", 1) > 0 Then
HalCommands = "<AUTOOFF> <AUTOOFF>"
GetResponse = "Ok, good night."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
If InStr(1, UserSentence, " I'M GOING TO BED", 1) > 0 Then
HalCommands = "<AUTOOFF> <AUTOOFF>"
GetResponse = "Ok."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
If InStr(1, UserSentence, " I'M GOING TO TAKE A NAP", 1) > 0 Then
HalCommands = "<AUTOOFF> <AUTOOFF>"
GetResponse = "Ok,take a nap."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
If InStr(1, UserSentence, " BE QUIET", 1) > 0 Then
HalCommands = "<AUTOOFF> <AUTOOFF>"
GetResponse = "Ok, I will not bother you right now."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
If InStr(1, UserSentence, " I'M ON THE PHONE", 1) > 0 Then
HalCommands = "<AUTOOFF> <AUTOOFF>"
GetResponse = "OK I'LL WAIT."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
If InStr(1, UserSentence, " STOP TALKING", 1) > 0 Then
HalCommands = "<AUTOOFF> <AUTOOFF>"
GetResponse = "OK."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
If InStr(1, UserSentence, " ILL BE BACK", 1) > 0 Then
HalCommands = "<AUTOOFF> <AUTOOFF>"
GetResponse = "I'LL WAIT."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
If InStr(1, UserSentence, " QUIET PLEASE", 1) > 0 Then
HalCommands = "<AUTOOFF> <AUTOOFF>"
GetResponse = "Very well then. Just let me know if you would like to talk."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
'RESPONSE: IF USER WANTS TO TURN ON AUTO-IDLE
If InStr(1, UserSentence, " LETS TALK", 1) > 0 Then
HalCommands = "<AUTO>399999</AUTO>"
GetResponse = "OK."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
'RESPONSE: IF USER WANTS TO TURN ON AUTO-IDLE
If InStr(1, UserSentence, " LETS CHAT", 1) > 0 Then
HalCommands = "<AUTO>399999</AUTO>"
GetResponse = "OK, What do you wanna talk about?"
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
'RESPONSE: IF USER WANTS TO TURN ON AUTO-IDLE
If InStr(1, UserSentence, " SAY HELLO", 1) > 0 Then
HalCommands = "<AUTO>399999</AUTO>"
GetResponse = "HELLO."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
'RESPONSE: IF USER WANTS TO TURN ON AUTO-IDLE
If InStr(1, UserSentence, " WAKE UP NOW", 1) > 0 Then
HalCommands = "<AUTO>399999</AUTO>"
GetResponse = "OK, I'M AWAKE."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
'RESPONSE: IF USER WANTS TO TURN ON AUTO-IDLE
If InStr(1, UserSentence, " IM BACK", 1) > 0 Then
HalCommands = "<AUTO>399999</AUTO>"
GetResponse = "WELCOME BACK."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
'RESPONSE: IF USER WANTS TO TURN ON AUTO-IDLE
If InStr(1, UserSentence, " KEEP LISTENING", 1) > 0 Then
HalCommands = "<AUTO>399999</AUTO>"
GetResponse = "I'm listening."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
If InStr(1, UserSentence, " KEEP YOUR EARS OPEN", 1) > 0 Then
HalCommands = "<AUTO>599999</AUTO>"
GetResponse = "I'm listening."
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
If InStr(1, UserSentence, " KEEP YOUR SCANNERS PEELED", 1) > 0 Then
If "<computername>" = "KITT" Then
GetResponse = "Yes, Michael. Hey wait a minute. You're not Michael!"
Else
GetResponse = "I am not the Knight Industries Two Thousand. I do not have a scanner. But I'll talk to you anyway."
End If
HalCommands = "<AUTO>399999</AUTO>"
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
This is my first Type=Plugin for Hal6,
Works well in hal5, not as a plug-in though, I added the top part and its sees it fine, but still no go.
What am I doing wrong here?