dupa

Author Topic: Hal blank answers fix ?  (Read 1984 times)

lightspeed

  • Hero Member
  • *****
  • Posts: 6761
    • View Profile
Hal blank answers fix ?
« on: September 21, 2016, 06:08:26 pm »
Art, you asked somewhere else in a posting , don't remember which one so am starting a new one so you and others can find this .
I mentioned before that i wrote and asked Robert about this problem and he sent this to me , this was a long time ago, i don't remember if it fixed it or not*that's why i put the question mark on the header. so be sure and make a back up of the brain first!!
Hope this helps , Art if you use it let me know if it works okay. by the way i have had hal give me a blank answer but it had to do with a plug in error problem , once the plug in was fixed no blank problem .

so here it is.

ATTENTION ****** THE BELOW CODE NEEDS TO BE PUT IN :
try placing the code just below this line:


Function UltraHal(ByVal InputString, ByVal UserName, ByVal ComputerName, ByVal LearningLevel, ByVal DatabaseFile, ByRef Hate, ByRef Swear, ByRef Insults, ByRef Compliment, ByRef PrevSent, ByRef LastResponseTime, ByRef PrevUserSent, ByRef CustomMem, ByRef GainControl, ByRef LastTopicList)









'RESPOND: User pressed enter, but didn't say anything lets prevent
   'blank responses which sometimes occure and eliminate them by adding
   'a random topic that gives the brain a chance to keep its database open
   'so that a response will always be given. sometimes a user will repeatedly
   'enter blanks that causes HAL's engine to give nothing but blanks, this
   'code helps prevent that 100%
   
    CheckStringQuality = Trim(Ucase(HalBrain.AlphaNumericalOnly(InputString)))
    CheckStringQuality = Replace(CheckStringQuality, "'", "", 1, -1, vbTextCompare)
    If CheckStringQuality = "" Then
    Select Case HalBrain.RandomNum(5)
            Case 1
                InputString = HalBrain.ChooseSentenceFromFile("love3") & vbCrLf
            Case 2
                InputString = HalBrain.ChooseSentenceFromFile("insults") & vbCrLf
            Case 3
                InputString = HalBrain.ChooseSentenceFromFile("sharedQuestions") & vbCrLf
            Case 4
                InputString = HalBrain.ChooseSentenceFromFile("love2") & vbCrLf
            Case 5
                InputString = HalBrain.ChooseSentenceFromFile("love1") & vbCrLf
        End Select
    Else
    InputString = InputString
    End If
    HalBrain.DebugWatch InputString, "Prevent Blanks InputString response"




 

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3848
    • View Profile
Re: Hal blank answers fix ?
« Reply #1 on: September 21, 2016, 07:28:38 pm »
Thanks for your search and find attempt! I'll give it a try and let you know how well it works...or doesn't...but hopefully, it should and his explanation made sense so it's all systems go.
 ;)
In the world of AI it's the thought that counts!

- Art -