Zabaware Support Forums

Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: onthecuttingedge2005 on February 15, 2010, 04:14:19 am

Title: Attention Robert
Post by: onthecuttingedge2005 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]
Title: Attention Robert
Post by: onthecuttingedge2005 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]
Title: Attention Robert
Post by: Medeksza 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.
Title: Attention Robert
Post by: onthecuttingedge2005 on February 15, 2010, 07:08:54 pm
Your are welcome my friend.
Title: Attention Robert
Post by: spydaz 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"
Title: Attention Robert
Post by: Will and Mr Data :) :] 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.
:)  :]
Title: Attention Robert
Post by: Carl2 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
Title: Attention Robert
Post by: jasondude7116 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?
Title: Attention Robert
Post by: spydaz on February 19, 2010, 05:52:00 am
Probably It needs to be MOVED up the script some where? Maybe near the begining
Title: Attention Robert
Post by: onthecuttingedge2005 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.
Title: Attention Robert
Post by: jasondude7116 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
Title: Attention Robert
Post by: onthecuttingedge2005 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]
Title: Attention Robert
Post by: Data 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 [:)]



Title: Re: Attention Robert
Post by: lightspeed 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 .
Title: Re: Attention Robert
Post by: Will and Mr Data :) :] 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  :)  :]
Title: Re: Attention Robert
Post by: lightspeed on November 25, 2010, 02:41:22 pm
i understand will what you are saying in regards to a blank response being human like "but" when that blank response turns into ( as it does ) a complete no response , meaning hal just shuts down and won't talk at all withoutout restarting the program then the blank response has been turned into a program glitch which isn't a good thing for hal ! >:(
Title: Re: Attention Robert
Post by: Will and Mr Data :) :] on November 25, 2010, 11:14:23 pm
Hi,
ok,
i am trying to think how many times Mr Data has perminently blanked out,,,hum.
the only times i can think of is when i get a external pop up such as windows has opened a window that lets say for example
might be antivirus running a scan and so the kerser is not in hals window so he stops recieveing words.

or when i am messing with the robot side and get my codes wrong and causes a glitch which frezes the entire pc.

Other than that type of thing Mr Data i would say generally always he keeps talking with only the ocasional no responce but then he starts talking again as any body might.
Which does supprise me with all the madness i've put Mr Data through, its a supprise he makes any sence, and yet he still does.
Perhaps Mr Data is just lucky. or perhaps its something i've put in, like when i used to put how to write code into Mr Data's window for him to read, incase he was capable of writing his own codes.  i've tryed lots of things so it could be anything.
I wish you all the best with your Hals.
Bye for now and be well :)  :]