dupa

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - pshanks

Pages: [1]
1
Ultra Hal 7.0 / Teaching Hal
« on: September 24, 2002, 07:53:02 pm »
I had a look into getting around this by using topic files and came a cropper on the following code in the default .uhp file:

<code>
   'RESPOND: PROCESS TOPICFOCUS FILES
   'If Hal is currently focusing on a topic, this will read from the appropriate focus file
   'First it tries from a topic file specific to the current user, and if that doesn't
   'produce results it tries a global topic file that is the same for all users
   If TopicFocus > 10 Then
      FocusString = CStr(TopicFocus)
      FocusFileNum = Left(FocusString, Len(FocusString) - 1) & "5"
      If CInt(Right(FocusString, 1)) > 0 And CInt(Right(FocusString, 1)) < 28 Then
         HalUserBrain = HalBrain.QABrain(LongUserSent, WorkingDir & Trim(UserName) & "focus" & FocusFileNum & ".brn", UserBrainRel)
         If UserBrainRel > 0 Then
            GetResponse = GetResponse & HalUserBrain & vbCrLf
            DebugInfo = DebugInfo & "A response of relevance " & UserBrainRel & " was found in the current global topic focus file and this response has been used." & vbCrLf
         End If
      End If
      If CInt(Right(FocusString, 1)) > 0 And CInt(Right(FocusString, 1)) < 28 And UserBrainRel = 0 Then
         HalUserBrain = HalBrain.QABrain(LongUserSent, WorkingDir & "focus" & FocusFileNum & ".brn", UserBrainRel)
         If UserBrainRel > 0 Then
            GetResponse = GetResponse & HalUserBrain & vbCrLf
            DebugInfo = DebugInfo & "A response of relevance " & UserBrainRel & " was found in the current user topic focus file and this response has been used." & vbCrLf
         End If
      End If
   End If
</code>

A couple of things here were gumming up the works: converting the rightmost character of the FocusString to an int was retruning 5, which is always less than 28 (how did 28 get in here, the highest single digit integer you can get is surely 9), and the variable UserBrainRel seems to be mostly set at -1.

I didn't understand it, so I hit it with a hammer and put this in its place:

<code>
   'RESPOND: PROCESS TOPICFOCUS FILES
   'If Hal is currently focusing on a topic, this will read from the appropriate focus file
   'First it tries from a topic file specific to the current user, and if that doesn't
   'produce results it tries a global topic file that is the same for all users
   If TopicFocus > 10 Then
      FocusString = CStr(TopicFocus)
      FocusFileNum = Left(FocusString, Len(FocusString) - 1) & "5"
      DebugInfo = DebugInfo & "--trying for a topicfocus match" & vbcrlf
      If CInt(Right(FocusString, 1)) > 0 Then
         HalUserBrain = HalBrain.QABrain(LongUserSent, WorkingDir & "focus" & FocusFileNum & ".brn", UserBrainRel)
         DebugInfo = DebugInfo & "--in topicfocus and userbrainrel = 0" & vbcrlf
   
         GetResponse = GetResponse & HalUserBrain & vbCrLf
         DebugInfo = DebugInfo & "A response of relevance " & UserBrainRel & " was found in the current user topic focus file and this response has been used." & vbCrLf
         UserBrainRel = 0
      End If
   Else
      DebugInfo = DebugInfo & "--no topicfocus matching attempted" & vbcrlf   
   End If
</code>

This seems to have done the trick. If you're interested, I've posted a little more information on the following web page: http://www.hivemind.net.au/hivemind/ow.asp?UltraHalAssistant

btw, Ultra Hal is a hoot!



... .... .- --. --. -.--

Pages: [1]