'This section uses the auto response feature and allows Hal to respond with random 'comments. You can choose either 'wait' type comments or 'learn' type comments. If InStr(OriginalSentence, " AUTO-IDLE ") <> 0 Then idleHalType = "learn" If idleHalType = "wait" Then 'If you want Hal to wait for you to come back and talk to him set idleHalType to 'wait'. GetResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "UserIdle.brn") Else If Rnd * 100 < 40 Then 'This portion allows Hal to generate random sentences to respond to. 'Using this feature may allow you to expand your chat database faster. 'If you want Hal to learn from auto-responses set idleHalType to 'learn'. If Rnd * 100 > 80 Then idleHalQuestion = HalBrain.ChooseSentenceFromFile(WorkingDir & "TopicFocus.brn") idleHalQuestion = LCase(Trim(Mid(idleHalQuestion, 2, InStr(idleHalQuestion, ",") - 3))) Else idleHalQuestion = HalBrain.ChooseSentenceFromFile(WorkingDir & "assoc_subject.brn") idleHalQuestion = LCase(Trim(Replace(idleHalQuestion, "@", ""))) End If idleHalQuestion = Replace(HalBrain.ChooseSentenceFromFile(WorkingDir & "SmallTalkSent.Brn"), "", idleHalQuestion) ElseIf Rnd * 100 < 75 Then idlePartOne = Trim(HalBrain.ChooseSentenceFromFile(WorkingDir & "random_subject.brn")) idlePartTwo = Trim(HalBrain.ChooseSentenceFromFile(WorkingDir & "random_predicate.brn")) idlePartThree = HalBrain.ChooseSentenceFromFile(WorkingDir & "random_adjective.brn") idleRoulette = Int(Rnd * 100) If idlePartOne = idlePartTwo Or idleRoulette > 50 Then idlePartTwo = HalBrain.ChooseSentenceFromFile(WorkingDir & "random_adjective.brn") End If idlePartOne = Replace(Replace(idlePartOne, "vbCrLf", " "), "^p", " ") idlePartTwo = Replace(Replace(idlePartTwo, "vbCrLf", " "), "^p", " ") idlePartThree = Replace(Replace(idlePartThree, "vbCrLf", " "), "^p", " ") idlePartOne = LCase(HalBrain.AlphaNumericalOnly(idlePartOne)) idlePartTwo = LCase(HalBrain.AlphaNumericalOnly(idlePartTwo)) idlePartThree = LCase(HalBrain.AlphaNumericalOnly(idlePartThree)) idleHalQuestion = HalBrain.ChooseSentenceFromFile(WorkingDir & "assembly.brn") idleHalQuestion = Replace(idleHalQuestion, "", idlePartOne) idleHalQuestion = Replace(idleHalQuestion, "", idlePartTwo) idleHalQuestion = Replace(idleHalQuestion, "", idlePartThree) Else idleHalQuestion = HalBrain.SentenceGenerator(WorkingDir & "sentgen.brn") End If If InStr(idleHalQuestion, "") Then idleHalQuestion = Replace(Replace(idleHalQuestion, "", ""), ",", "") End If HalCommands = "" & idleHalQuestion & "" End If End If