dupa

Author Topic: How do I?  (Read 3603 times)

ramccoid

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
How do I?
« on: May 22, 2007, 07:09:36 am »
How do I stop HAL from adding it's own input into my responses that I've scripted?
example:
If I wanted HAL to say just "The time is 12pm" with out HAL adding something like "Quick answers won't work. The time is 12pm". How would I go about stopping HAL adding to my scripted sentences?
Roy.
 

onthecuttingedge2005

  • Guest
How do I?
« Reply #1 on: May 22, 2007, 10:37:58 am »
quote:
Originally posted by ramccoid

How do I stop HAL from adding it's own input into my responses that I've scripted?
example:
If I wanted HAL to say just "The time is 12pm" with out HAL adding something like "Quick answers won't work. The time is 12pm". How would I go about stopping HAL adding to my scripted sentences?
Roy.



Hi ramccoid.

You might have some luck with the default script inside your default brains code:

Code: [Select]
'RESPOND: GETRESPONSE
    'Get a response from Hal's brain for each sentence individually.
    'If a response from a sentence indicates a special flag, then Hal
    'will give only the response to that sentence, and not process
    'any other sentences. Otherwise Hal will respond to each sentence.
    'Hal will respond to a max of 3 sentences at once.
    SentenceCount = UBound(Sentences)
    If SentenceCount > 2 Then SentenceCount = 2
    LowQualityResponse = ""
    If GoodSentence <> True Then 'Only respond if a predefined response hasn't already been selected
   For i = 0 To SentenceCount
       TempParent = HalBrain.AddDebug("Debug", "Begin Processing Sentence " & CStr(i + 1), vbCyan)
       HalBrain.AddDebug TempParent, "Sentence: " & Sentences(i)
       HalBrain.DebugWatch "", "NewSent"
       Sentences(i) = Trim(Sentences(i))
       If Len(Sentences(i)) > 1 Then
           GoodSentence = True
           CurResponse = GetResponse(Sentences(i), UserName, ComputerName, LearningLevel, HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, LastTopicList) & vbCrLf
           If InStr(1, CurResponse, "<LOWQUALITY>", vbTextCompare) Then
               'If Hal's response to the current sentence is of a low-quality nature, then we hold out
               'for a better response with a different sentence, but if there is no better response
               'then we will use only the first low-quality response we came across.
               If LowQualityResponse = "" Then LowQualityResponse = CurResponse
           ElseIf InStr(1, CurResponse, "<TOPIC>", vbTextCompare) Or InStr(1, CurResponse, "<YESRES>", vbTextCompare) Or InStr(1, CurResponse, "<EXCLUSIVE>", vbTextCompare) Then
               'If Hal's response indicates an exclusivity tag, then we erase any response Hal may have
               'already had, respond with the exclusive response, and cease processing more sentences
               UltraHal = CurResponse & vbCrLf
               Exit For
           Else
               'Since there are no special tags, we just append the new response to the previous one
               'if the response was not already given
               If InStr(1, UltraHal, CurResponse, vbTextCompare) = 0 Then UltraHal = UltraHal & " . " & CurResponse & vbCrLf
           End If
           'If we received a tag to stop processing more sentences, we leave the loop
           If InStr(1, CurResponse, "<NOMORE>", vbTextCompare) Then Exit For
       End If
   Next
    End if
    'If we have no normal quality responses, we will use our low quality response
    UltraHal = Trim(UltraHal)
    If UltraHal = "" Then UltraHal = Trim(LowQualityResponse)

you may try something like from the above default code and modify:

If SentenceCount > 2 Then SentenceCount = 1

this will only allow HAL to reply once even if there are more user sentences.

make sure you backup your original code before you modify.

Jerry[8D]

ramccoid

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
How do I?
« Reply #2 on: May 22, 2007, 01:46:02 pm »
Thanks Jerry I'll back up my code and give it a try.
Roy.
 

onthecuttingedge2005

  • Guest
How do I?
« Reply #3 on: May 22, 2007, 06:45:45 pm »
quote:
Originally posted by ramccoid

Thanks Jerry I'll back up my code and give it a try.
Roy.



Hi ramccoid.

you could also do your scripting in the 'UltraHal' portion of the brain and use the <NOMORE> command at the end of the UltraHal response

Example:

If InStr(1, Search, "1( HELLO )", 1) > 0 Then
UltraHal = " Hello " & "<NOMORE>"
End If

Jerry[8D]



ramccoid

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
How do I?
« Reply #4 on: May 23, 2007, 10:03:12 am »


Hi Jerry and many thanks. I tried the altering the main brain script but it was to no avail but was a good exercise in playing around with the main script, since I had backed it up as you advised, so it made no difference if I messed it up, which I did not. I going to play around with it some more.

quote:
If InStr(1, Search, "1( HELLO )", 1) > 0 Then
UltraHal = " Hello " & "<NOMORE>"
End If


This looks interesting. I'm going to try this out and see what happens.
Thanks again,
Roy.
 

onthecuttingedge2005

  • Guest
How do I?
« Reply #5 on: May 23, 2007, 11:14:43 am »
quote:
Originally posted by ramccoid



Hi Jerry and many thanks. I tried the altering the main brain script but it was to no avail but was a good exercise in playing around with the main script, since I had backed it up as you advised, so it made no difference if I messed it up, which I did not. I going to play around with it some more.

quote:
If InStr(1, Search, "1( HELLO )", 1) > 0 Then
UltraHal = " Hello " & "<NOMORE>"
End If


This looks interesting. I'm going to try this out and see what happens.
Thanks again,
Roy.



Hi ramccoid.

here are the areas that you could script.

'most upper portion of the UltraHal response area
'but is bound by the AUTO-IDLE command.
Rem PLUGIN: AUTO-IDLE

'upper portion of the UltraHal response area that is not bound by AUTO-IDLE
Rem PLUGIN: PRE-PROCESS

'Lower portion of the UltraHal response area that is not bound by AUTO-IDLE, this area is a good place to use the <NOMORE> command
'in your code.
Rem PLUGIN: POST-PROCESS

'All the areas here are in the GetResponse area of the brain.
Rem PLUGIN: CUSTOMMEM
Rem PLUGIN: PLUGINAREA1
Rem PLUGIN: PLUGINAREA2
Rem PLUGIN: PLUGINAREA3
Rem PLUGIN: PLUGINAREA4
Rem PLUGIN: PLUGINAREA5
Rem PLUGIN: PLUGINAREA6
Rem PLUGIN: PLUGINAREA7

'this area is the lowest area in the GetResponse portion of the brain
'from descending order.
Rem PLUGIN: CUSTOMMEM2

'this area is for subs and functions.
Rem PLUGIN: SCRIPT_LOAD
Rem PLUGIN: SCRIPT_UNLOAD
Rem PLUGIN: MINUTE_TIMER
Rem PLUGIN: FUNCTIONS

Jerry[8D]
« Last Edit: May 23, 2007, 11:18:28 am by onthecuttingedge2005 »

ramccoid

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
How do I?
« Reply #6 on: May 23, 2007, 02:23:24 pm »
Wow!!! thanks Jerry,
Every thing appears more clear since you've explained this about all the area types. I have been experimenting with them but never quite understood what they all meant, until now.
Thanks you so very much for this enlightenment. You won't believe how appreciative and valuable this information is to me.
All the very best to you,
Roy.