I think I found an error in the programming...
'PROCESS: CONTROL TOPICFOCUS
'Here we set up the TopicFocus vairable so we can use it as a pointer and a counter.
'We will use this later to control Hal's "persistence" in focusing on certain subjects.
'Hal keeps "focus" on a topic for 5 sentences. After 2 sentences, Hal will lose focus from
'this topic so his entire brain is used again. However, if the user continues talking about
'the topic, Hal will regain focus again. After 2 sentences TopicFocus will be set to 1,
'which means no focus.
If TopicFocus > 5 Then TopicFocus = TopicFocus + 1
For FI = 10 To 1000 Step 10
If TopicFocus = (FI - 3) Then
TopicFocus = 1
End If
Next
If I understand TopicFocus, further down the script, TopicFocus is the actual number of the Focus file - ie, Focus15.brn ... so in the above programming, then next time through, it would become Focus16.brn... how can it stay 'on topic' like that???
This is my fix for this:
If TopicFocus > 1 Then TopicFocusCount = TopicFocusCount + 1
If TopicFocusCount > 5 Then
TopicFocusCount = 1
TopicFocus = 1
End If
The only purpose of this is to keep Hal on topic for 5 sentences (as long as the user doesn't change the topic). If the user is still talking on topic, then so will Hal (After the 5th sentence).
Then further down the script:
'PROCESS: FOCUS ON TOPIC
TopicSearch = Trim(UCase(HalBrain.TopicSearch(UserSentence, WorkingDir & "TopicFocus.Brn")))
If TopicSearch = "" Then TopicSearch = 0
If TopicSearch > 10 Then
TopicFocus = TopicSearch
TopicFocuscount = TopicSearch
DebugInfo = DebugInfo & "The user has used a keyword defined in Hal's topic focus file, and Hal is now focusing on topic #" & TopicFocus & vbCrLf
End If
If Hal's already 'focused' (or not), this part of the script can change him off topic if the user changes the topic...
My fix:
TopicSearch = Trim(UCase(HalBrain.TopicSearch(UserSentence, WorkingDir & "TopicFocus.Brn")))
If TopicSearch = "" Then
TopicSearch = 0
TopicFocus = TopicSearch
TopicFocuscount = 1
DebugInfo = DebugInfo & "The user has no keywords defined in Hal's topic focus file, and Hal is not focusing on a topic #" & TopicFocus & vbCrLf
End If
If TopicSearch > 10 Then
TopicFocus = TopicSearch
TopicFocuscount = 1
DebugInfo = DebugInfo & "The user has used a keyword defined in Hal's topic focus file, and Hal is now focusing on topic #" & TopicFocus & vbCrLf
End If
That just about does it...