'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 = Timer
TimerResponseDiff = Timer - LastResponseTime
If TimerResponseDiff < 300 Then
TimerResponseDiff = 0
LastResponseTime = Timer
If HalBrain.CheckRepetition(OriginalSentence, "AUTO-IDLE") = True Then
Director = HalBrain.ChooseSentenceFromFile(WorkingDir & "Topic.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 & "Topic" & ".brn", SubPhrase & "" & PredPhrase & ""
DebugInfo = DebugInfo & "Hal is saving User's topic: " & SubPhrase & "" & PredPhrase & "" & VbCrLf
Else
DebugInfo = DebugInfo & "Hal is not saving User's topic: " & SubPhrase & "" & PredPhrase & "" & VbCrLf
End If
'Remember to disable " LastResponseTime = now"
'This script load below must be pasted at bottom of Hals Brain Script.
'This sub will be called when the Ultra Hal program starts up in case
'the script needs to load some modules or seperate programs. If a return
'value is given it is passed as a Hal Command to the host Hal program.
Function Script_Load()
Script_Load = "400000"
End Function