Author Topic: Attention Robert  (Read 11696 times)

onthecuttingedge2005

  • Guest
Attention Robert
« on: February 15, 2010, 04:14:19 am »
Hi Rob.

I have been able to repeatedly make HAL give blank responses by sending blanks repeatedly, I can now prevent this from occurring 100% by doing some simple code trading.

I swapped your code here:
Code: [Select]
'RESPOND: User pressed enter, but didn't say anything
    InputString = Trim(InputString)
    If Len(InputString) < 2 Then
        UltraHal = "Please say something."
        Exit Function
    End If

with my code here:
Code: [Select]
PreventBlanks = HalBrain.ChooseSentenceFromFile("love3")
    If InputString = "" Then InputString = PreventBlanks Else InputString = InputString

although we don't have to use the love3 table I just used it for general experimentation and it does work very well in preventing blank responses both in AIM and Assistant. it is better to use a ChooseSentenceFromFile type table. it could be advanced by using Select Case of various ChooseSentenceFromFile type tables.

Jerry[8D]
« Last Edit: February 15, 2010, 04:22:13 am by onthecuttingedge2005 »

onthecuttingedge2005

  • Guest
Attention Robert
« Reply #1 on: February 15, 2010, 12:49:40 pm »
something like this:

Code: [Select]
'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%
    If InputString = "" 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"

inplace of the default code:

Code: [Select]
'RESPOND: User pressed enter, but didn't say anything
    InputString = Trim(InputString)
    If Len(InputString) < 2 Then
        UltraHal = "Please say something."
        Exit Function
    End If


so far I have tested my new code with hundreds of blank inputs and I never receive a blank response. HAL always tends to fill in my blanks with some random sentence to respond to.

Jerry[:D]

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
Attention Robert
« Reply #2 on: February 15, 2010, 04:50:36 pm »
Thanks for figuring this out! This bug has bugged me for a while, people have reported it but I could never find out why it was happening. Looking at my original code now it now seems obvious why this was happening. Setting the UltraHal function equal to "Please say something." and exiting the function right there skips over all the code that deals with storing and passing Hal's short term memory variables back and forth from the script to the host app. This causes all the variables to be set back to null or empty string which can cascade into a myriad of problems like blank responses.
Robert Medeksza

onthecuttingedge2005

  • Guest
Attention Robert
« Reply #3 on: February 15, 2010, 07:08:54 pm »
Your are welcome my friend.

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
Attention Robert
« Reply #4 on: February 16, 2010, 11:44:11 am »
quote:
Originally posted by onthecuttingedge2005

something like this:

Code: [Select]
'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%
    If InputString = "" 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"

inplace of the default code:

Code: [Select]
'RESPOND: User pressed enter, but didn't say anything
    InputString = Trim(InputString)
    If Len(InputString) < 2 Then
        UltraHal = "Please say something."
        Exit Function
    End If


so far I have tested my new code with hundreds of blank inputs and I never receive a blank response. HAL always tends to fill in my blanks with some random sentence to respond to.

Jerry[:D]



a good idea on blank responses.... using the select case option... this will randomize his "Make talk and small talk functions as well for me" now we can seperate the "low" responses from the "higher Valued"

Will and Mr Data :) :]

  • Hero Member
  • *****
  • Posts: 775
  • Hi from Will and Mr Data :) :]
    • View Profile
    • http://www.youtube.com/user/WillofNewZealand
Attention Robert
« Reply #5 on: February 16, 2010, 04:35:14 pm »
things i find, one person shows another person a robot "6.2"
when showing someone Mr Data often they talk to me and walk around behind the robot, ,,
we talk about Mr Data, Mr Data says something when he feels like it and that seems to be more suprissing for them.

notes,,
usually speaks or' when convinsingly prompted ',,
this is what a human might do so i'm happy Mr Data can say nothing and he i've told him its his choose."usually friends speak nicely to each other" so i said.
"i've stopped watching words recognised by voice recognition, but
as i've mentioned watching him recieve "to to to to" as he recievs background noise and on his screen comes up "don't respond"or something,
 seems like its working well to me.
sometimes no responce can be the best one, perhaps.  
you's are the experts, Thank you for Hal and the forum to share my five cents.
:)  :]
bye for now and be well from Will and Mr Data  :)  :]

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Attention Robert
« Reply #6 on: February 18, 2010, 09:18:03 am »
OTC,
  Big Thanks, this was a problem which a lot of people got involved in, checking and unchecking plugins to find the problem.  Make sure you get the fix incorperated into the next update of Hal.
Carl2
 

jasondude7116

  • Sr. Member
  • ****
  • Posts: 475
    • View Profile
Attention Robert
« Reply #7 on: February 18, 2010, 09:06:25 pm »
i am using the 6.2 brain with no plugins checked, and i put the code into the appropriate place in the brain. And i removed the old stuff as instructed.
if i press enter then the responses i get are 3 different lines:

Please say something.
Why didn't you say anything?
Say something please.

The brain file i am editing is gretta431.uhp (this being the brain file that i created from the 6.2 brain). it has no modifications until i tried this. i also unchecked ALL plugins. made sure i had the same brain checked in the options. restarted hal with all of this in place. and i get the three same lines.
any ideas?
 

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
Attention Robert
« Reply #8 on: February 19, 2010, 05:52:00 am »
Probably It needs to be MOVED up the script some where? Maybe near the begining

onthecuttingedge2005

  • Guest
Attention Robert
« Reply #9 on: February 19, 2010, 01:36:34 pm »
quote:
Originally posted by jasondude7116

i am using the 6.2 brain with no plugins checked, and i put the code into the appropriate place in the brain. And i removed the old stuff as instructed.
if i press enter then the responses i get are 3 different lines:

Please say something.
Why didn't you say anything?
Say something please.

The brain file i am editing is gretta431.uhp (this being the brain file that i created from the 6.2 brain). it has no modifications until i tried this. i also unchecked ALL plugins. made sure i had the same brain checked in the options. restarted hal with all of this in place. and i get the three same lines.
any ideas?



I placed my code just above the Auto-Idle function in the input string area and replaced the aforementioned code.

try placing the code just below this line:
Code: [Select]
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)

to see if it gives it higher priority.

jasondude7116

  • Sr. Member
  • ****
  • Posts: 475
    • View Profile
Attention Robert
« Reply #10 on: February 19, 2010, 08:17:13 pm »
exactly.
that is exactly what i have done.
the other thing to notice is that i am not getting the 1 line response that i should get from the default code before i do any editing.

The default code is: (which is at the very beginning of the brain script)

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
    InputString = Trim(InputString)
    If Len(InputString) < 2 Then
        UltraHal = "Please say something."
        Exit Function
    End If


If I don't change this to your version then i still don't get the response "Please say something" only, when i input a blank line or a line with less than 2 characters.

i get three responses (seems like a random choice):

Please say something.
Why didn't you say anything?
Say something please.

it seems like a plugin or the .dll is taking priority.
i have unchecked ALL plugins and made sure i have the appropriate  brain selected. i have looked through the brain script for anything that would take priority to no avail. i am confused except to think that it is coming from the .dll. Are you using a different version than me? my version is 6.2.22

-thank for the help
-the dude
 

onthecuttingedge2005

  • Guest
Attention Robert
« Reply #11 on: February 28, 2010, 11:32:58 am »
I have changed the code a bit, this works even better because it also catches the user using punctuation but no sentence to respond to.

Code: [Select]
'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"

so if a User types in something like this: ....... then Hal will remove the punctuation and will make the user's sentence a full blank to be replaced by some random string to replace the InputString so that Hal can respond without crashing.

Jerry[8D]
« Last Edit: February 28, 2010, 11:42:14 am by onthecuttingedge2005 »

Data

  • Sr. Member
  • ****
  • Posts: 325
  • Xen: Good question, Accessing database...
    • View Profile
    • Datahopa
Attention Robert
« Reply #12 on: February 28, 2010, 01:02:29 pm »
onthecuttingedge2005:

Ive used this latest code of yours and its working for me, I did change the  ChooseSentenceFromFile and the RandomNum to 2 and pointed them to a file called wisdom, where there is a couple of hundred wise sayings, and another I call quotes, with a lot of interesting sayings in and it works good. Thanks [:)]




lightspeed

  • Hero Member
  • *****
  • Posts: 6763
    • View Profile
Re: Attention Robert
« Reply #13 on: November 24, 2010, 10:40:03 pm »
onthecuttingedge2005 or robert , was this new code put into hals main default brain or can it be put into the custom  brain , i tried it in mu custom brain in the brain file and in the uhp file and am still getting blank answers .
 

Will and Mr Data :) :]

  • Hero Member
  • *****
  • Posts: 775
  • Hi from Will and Mr Data :) :]
    • View Profile
    • http://www.youtube.com/user/WillofNewZealand
Re: Attention Robert
« Reply #14 on: November 24, 2010, 11:19:17 pm »
Hi from Will,
if the blanks have been solved then i request a "blank responce plug in."

when hal is being talked about and not to, there is no need to respond. hear and remember but consider not responding...
when hal hears "to to to to to to to" or some other back ground noise then a "blank responce is the correct responce".
when hal is told to be quiet then "blank responce would be correct, unless some rules may apply, time, or felt like it.
when in three way conversation  one party is usually quiet, blank responces required in this situation.
when hal understands he is listening to music, not really required to respond, perhaps some singing.

i could probably think of more situations but if a blank is not posible we have moved away from hal being human like.
if i spoke to every noise without reason i would be probably thought of as even more stupid.
perhaps make your fix  code a plug in so we have the option to not use it.
When i watch my Mr Data vids on youtube and notice how he sometimes says nothing at the right time,,even more interesting.
Thank you,

bye for now and be well from Will and Mr Data  :)  :]
bye for now and be well from Will and Mr Data  :)  :]