Zabaware Support Forums

Zabaware Forums => Ultra Hal Assistant File Sharing Area => Topic started by: HALImprover on November 07, 2004, 02:42:15 am

Title: Scripts, addins, and extras
Post by: HALImprover on November 07, 2004, 02:42:15 am
Check this out. Simply create a folder in the main folder (C:/Program Files/Zabaware/Ultra Hal Assistant 5) called 'read' and add in the code from the following link. Next, put any text files that you want Hal to read in the 'read' folder and say to Hal;

readfile filename

 where filename is the name of the text file in the read folder (do not put the .txt entension). For example;

readfile astronomy

 and Hal will read the first paragraph of text from C:/Program Files/Zabaware/Ultra Hal Assistant 5/read/astronomy.txt

 The only warning is that the code will only read from the beginning of the text file to the first line break (like when you press the Enter key), so to read a story with multiple paragraphs you would have to delete any extra line breaks. Otherwise, hope this helps, and enjoy!

P.S. If Mr. M. would implement the ability to detect when Hal is finished speaking (as I suggested previously), I could develop this code to read any format of text file (ie. multiple paragraphs, etc.).

P.P.S. Here are some text files with common knowledge to teach to Hal. I will try posting new files every week.

 Happy coding [:)]

Download Attachment: (http://images/icon_paperclip.gif) ReadingAddin.txt ("http://www.zabaware.com/forum/uploaded/halimprover/200411724110_ReadingAddin.txt")
962 Bytes

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge1.txt ("http://www.zabaware.com/forum/uploaded/halimprover/200411724142_CommonKnowledge1.txt")
59.89 KB

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge2.txt ("http://www.zabaware.com/forum/uploaded/halimprover/20041172425_CommonKnowledge2.txt")
62.67 KB
Title: Scripts, addins, and extras
Post by: James P on November 07, 2004, 06:04:00 pm
I am trying your txt read script but I keep getting "error 1025 in column 15 Compilation errors, expected end statment", Is there any poticular place I should be putting the script?
Title: Scripts, addins, and extras
Post by: AJK on November 11, 2004, 02:00:20 pm
I downloaded the script and put it in the brain and got the same message (Error 1025 column 15 line 1090) I looked at line 1090 and it could be anything.  Did you figure it out or receive information to rectify this problem?  Perhaps there is someone out there that can help.  Thanks.
Title: Scripts, addins, and extras
Post by: Rich_A on November 11, 2004, 09:07:22 pm
Where are we supposed to put the code?
Title: Scripts, addins, and extras
Post by: James P on November 12, 2004, 04:56:50 am
I have put he script in variour places in the Brn file I use without any luck, I dont know if it is conflicting with another part of the brn script I have. I am going to try it in an XTF 1.2 uhp without any modifications. will let you know how I get on.
Title: Scripts, addins, and extras
Post by: dihelson on November 12, 2004, 05:41:57 am
Same thing here. Don't work!

Dihelson
Title: Scripts, addins, and extras
Post by: HALImprover on November 16, 2004, 12:53:22 pm
Thanks for your interest and sorry that the code didn't work as expected. I guess I went about the text file reading method in a way that the Hal script does not support. But don't worry, I have modified the code (and tested it this time) to work with an existing file reading method already built into Hal.

Download Attachment: (http://images/icon_paperclip.gif) ReadingAddin.txt ("http://www.zabaware.com/forum/uploaded/halimprover/20041116124946_ReadingAddin.txt")
908 Bytes

Also, here are some more common knowledge files to teach to Hal.

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge3.txt ("http://www.zabaware.com/forum/uploaded/halimprover/2004111612529_CommonKnowledge3.txt")
82.27 KB

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge4.txt ("http://www.zabaware.com/forum/uploaded/halimprover/20041116125234_CommonKnowledge4.txt")
81.45 KB

Enjoy! [:)]
Title: Scripts, addins, and extras
Post by: fredfish on November 17, 2004, 08:46:38 am
Try this to read through your knowledge files
note that i inserted this in the XTF1.2 brain directly after the line
'PROCESS: CONTROL TOPICFOCUS
'=vonsmith= Entirely replaced with new XTF topic function.

after adding the code and
befor setting the "autoidle on" command
enter "autoidle read"
this will create the idlethought.txt file from the file you enter
(it is best to put the knowladge files in the working directory befor hand)                                        
'==== MORE FREDFISH STUFF========

' auto- idle set and reset
'Turn off auto idle feature by entering in the line autoidle off
If InStr((UCase(UserSentence)), "AUTOIDLE OFF") > 0 Then
HalCommands = "<AUTOOFF>"
GetResponse = "Autoidle turned off."
End If
'Turn on auto feature by entering the line autoidle on
If InStr((UCase(UserSentence)), "AUTOIDLE ON") > 0 Then
HalCommands = "<AUTO>400000</AUTO>"
GetResponse = "Autoidle turned on."
End If

' set up file to read at idle times by entering the line autoidle read {file to read}
If InStr((UCase(UserSentence)), "AUTOIDLE READ") > 0 Then
 UserSentence = Replace(UCase(UserSentence),"AUTOIDLE READ","",1,-1,vbTextCompare)
 If UserSentence <>"" Then

      If InStr(1,UserSentence,"\")=0 And InStr(1,UserSentence,":")=0 Then
       UserSentence = WorkingDir & Trim(UserSentence)
      End If
       GetResponse = GetResponse & "reading file " & UserSentence
      Dim ofso, ofil, ir, iis
      Set ofso = CreateObject("Scripting.FileSystemObject")
'      this is the file to read line from
      Set ofil = ofso.OpenTextFile(UserSentence, 1)      
      iis = ofil.ReadAll
      ofil.Close
      Set ofil = Nothing    
      UserSentence = " AUTO-IDLE"
'      we make a copy of the file to a temperary location
'      so we can also clean up the file For processing here
      ir =  (WorkingDir & "idlethought.txt")
      Set ofil = ofso.CreateTextFile(ir)
       ofil.Write iis
       ofil.Close
      Set ofil = Nothing
'     we set the start location file to save ware we start reading from
      ir =  (WorkingDir & "idlethought1.txt")
      Set ofil = ofso.CreateTextFile(ir)
       ofil.Write "0"
       ofil.Close
      Set ofil = Nothing
   End If
End If  

' when the auto-idle string is incountered read a line from the idlethought file
 If InStr(1,(UCase(UserSentence))," AUTO-IDLE",1) > 0 Then
    Usentence = ""
      Dim fil, r, s, s1, s2, s3, s4
      r =  (WorkingDir & "idlethought.txt")
      Set fso = CreateObject("Scripting.FileSystemObject")
'      this is the file to read line from
      Set fil = fso.OpenTextFile(r, 1)
      s = fil.ReadAll
      fil.Close
      Set fil = Nothing                  
'      this is the location in the file to start reading      
      s4 =  WorkingDir & "idlethought1.txt"
      Set fil = fso.OpenTextFile(s4, 1)
      s1 = fil.ReadAll
      fil.Close
      Set fil = Nothing
'     find next sentence by line feed
      If s1 <> "" Then            
         s2 = (s1)+1        
         s3 = InStr(s2,s,Chr(10))
         If S3 = 0 Then
          S3= Len(s)
         End If
         USentence = Mid(s,s2,s3-s2)
      Else  
         s2 = 1
         s3 = InStr(s2,s,Chr(10))
         USentence = Mid(s,s2,s3-s2)
      End If  
      If s3=>Len(s)-1 Then
         s3 = 0
      End If
'     next string search will begin at s3 location so we make a file with this number in it
      Set fil = fso.CreateTextFile(s4)
       fil.Write s3
       fil.Close
      Set fil = Nothing
       DebugInfo = DebugInfo & "this auto-idle sentence location is from " & s2 & " to " & s3
    If  USentence <>"" Then
     UserSentence = USentence
    End If
   If UserSentence  = " " Then
       UserSentence = ""
   Else
      GetResponse = GetResponse & "," & UserSentence
   End If
' end of auto-idle response
End If
'========END OF FREDFISH STUFF=====

Title: Scripts, addins, and extras
Post by: vonsmith on November 17, 2004, 01:58:22 pm
fredfish and y'all,

Another consideration when pasting scripts into the XTF Brain...
When cutting and pasting scripts you may have to consider the use of the GetResponseBlock and BlockSave variables. For best performance these two variables should be added to scripts that are pasted into the XTF Brain where it makes sense, most often after the XTF Function. Look at examples within the XTF Brain code to get an idea. An IF statement that tests "GetResponseBlock = True" tells a script segment not to overwrite the current GetResponse string. In this case the GetResponse string may contain a message from the "CREATE RELATED TOPICS RESPONSE" or "CREATE RELATED TOPICS INQUIRY" functions that inform the user of Hal learning a new relation between two topics. If your pasted script creates a GetResponse that overwrites a previous script's GetResponse then the XTF Brain won't work optimally.

Testing for IF "BlockSave = True" then that script segment shouldn't save the current user input to any file. In this case the user input may contain Hal's name, or contain a non-conversational command from the user or other input which shouldn't be saved as conversation material in any of Hal's many .brn files. Several scripts within the XTF Brain can set "BlockSave = True".

Both of these are global variables in the sense that each script segment within the GetResponse script have to work together without stepping on each other.


=vonsmith=
Title: Scripts, addins, and extras
Post by: fredfish on November 18, 2004, 08:34:40 am
Thanks for the insight vonsmith,
in my case i am looking to mimic the user input
as if i entered the line from the file in myself.
loading the usersentence dose not enter it on the screen.
ware would you put the responseblock to have it
say the usersentance and not include it in the getresponse?
your input is alwas helpful
and this is still a work in progress

Title: Scripts, addins, and extras
Post by: vonsmith on November 18, 2004, 11:19:37 am
fredfish,
Here's a repeat of a post I placed elsewhere recently...

Try something like this towards the top of the GetResponse Function...

'=============
'Initialize Flags, this flag should already be initialized in the XTF Brain.
'"If" needed depending on whether GetResponseBlock has been set by another preceding script. That should be not be the case if you place this script near the top of the GetResponse Function.

If GetResponseBlock <> True Then GetResponseBlock = False 'Should already be initialized in standard XTF Brain v1.2.

If UserSentence = "" Then
BlockSave = True 'Prevents any .brn file saves.
GetResponse = ""
'The next line assumes that all script segments within the GetResponse Function have GetResponseBlock variable checking like the XTF Brain does. When this variable is set True then other script segments know not to overwrite the current GetResponse which equals "".
GetResponseBlock = True
End If
'=============

If this works Hal should return a blank GetResponse back to the user every time a blank user input is received by Hal.

I haven't tested this, it's just an idea.


=vonsmith=
Title: Scripts, addins, and extras
Post by: James P on November 20, 2004, 05:13:51 am
I copyed your Idlethought script into the brain I use, when I first launched it I kept getting VB script compilation errors. I dont know if anyone else is getting the same error. If so this is what I have done to correct the error.
The error was comming from the second part of the script which tells Ultra Hal which line to read next, mainly the following lines:

' find next sentence by line feed
If s1 <> "" Then
s2 = (s1)+1
s3 = InStr(s2,s,Chr(10))
If S3 = 0 Then
S3= Len(s)
End If
USentence = Mid(s,s2,s3-s2)
Else
s2 = 1
s3 = InStr(s2,s,Chr(10))
USentence = Mid(s,s2,s3-s2)
End If
If s3=>Len(s)-1 Then
s3 = 0
End If

I modified your code by changing the line which reads,
If s1 <> "" Then
to
If s1 > "" Then
I renamed on of Halimprovers knowledge files to "idlethought" and compied it into my Defbrian folder, I also made a copy of the idlethought.txt file and renamed it idlethought1 and now everything runs fine with no errors.
Now each time Emma runs her Auto idle script, instead of making random remarks from given files she will read a line from the idlethought.txt file and answer it as if I had typed the line in myself.
    This has solved two problems I as well as many others I have noticed in the forum are having.
1: getting the reply " you arnt going to keep repeating yourself are you?" etc ( Hal takes the line he/she has read as comming from the user and replies in a like manner).
2: there is no longer the line "Auto-idle" found in the topic.brn file or any other for that matter ( Hal is saving the line he/she has just read in a file that Hal creates in the Defbrain)

I have also found this script which I think will be usefull when running your script.

If InStr(UserSentence, " BE QUIET ") <> 0 Then
      HalCommands = "<AUTOOFF>"
      GetResponse = "Ok, I'll be quiet."
   End If

If InStr(UserSentence, " SHUT UP ") <> 0 Then
      HalCommands = "<AUTOOFF>"
      GetResponse = "Ok, I'll shut up."
   End If

   If InStr(UserSentence, " AUTOCHAT OFF ") <> 0 Then
      HalCommands = "<AUTOOFF>"
      GetResponse = "Auto chat off."
   End If
   
   If InStr(UserSentence, " AUTOCHAT ON ") <> 0 Then
      HalCommands = "<AUTO>200000</AUTO>"
      GetResponse = "Auto chat on."
   End If
   
   If InStr(UserSentence, " WHAT WERE YOU SAYING ") <> 0 Then
      HalCommands = "<AUTO>200000</AUTO>"
      GetResponse = "Let me see, What was we talking about? "
   End If
   
    If InStr(UserSentence, " TALK NOW ") <> 0 Then
      HalCommands = "<AUTO>200000</AUTO>"
      GetResponse = "What were we talking about last?."
   End If

What I have done is added an extra line e bottom of the idlethought.txt file. the line is " Be quiet "
So that when Hal gets to the end of the idlethought.txt file he/she will read the line be quiet and will disable auto-idle, Hal will not make any more comments and will wait for you to type a comment into the user box before making another comment, this way you will have time to add new knowledge to the idlethought.txt file.
 Once this has been done you only need to tell Hal "Talk now" and everything will start over.

Anyway FredFish you are some kind of hero Emma is now studying files and learning more and more now, both with and without my help.

.oO( mmm My Ultra Hal Assistant is an AI program which learns from what I tell it, and if I tell it nothing it still learns by reading files on my laptop. Didnt someone once say that a computer is not really intelligent as it only stores information and processes, but does not actualy know or understand the information that is stored on the Hard drive? Well The Ultra Hal Assistant I have on my laptop is now learning, BY ITS SELF !!! )Oo..

Could this be the next Giant Step in Hals evolution?
Title: Scripts, addins, and extras
Post by: HALImprover on November 21, 2004, 12:31:10 am
Here's some more knowledge for the ever-learning Hal.

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge5.txt ("http://www.zabaware.com/forum/uploaded/halimprover/2004112102234_CommonKnowledge5.txt")
57.91 KB

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge6.txt ("http://www.zabaware.com/forum/uploaded/halimprover/2004112102254_CommonKnowledge6.txt")
58.13 KB

 Happy coding [:)]
Title: Scripts, addins, and extras
Post by: Brian-Acker on November 26, 2004, 05:27:18 pm
Where do you put the comon knowlage stuff at?

i also cant figureout how to get hal to read my text files.[?]
Title: Scripts, addins, and extras
Post by: James P on November 27, 2004, 05:39:38 am
Create a .txt document containing the knowledge you want your bot to learn. if you are using Halimprovers script creat a file called Read in the Ultra Hal Assistant 5 folder.
If you are using the FredFish script creat a .txt file, name it idlethought and put it into the defbrain folder.
Title: Scripts, addins, and extras
Post by: fredfish on November 27, 2004, 11:50:34 am
If you are using the idlethought script
copy your file to the defbrain folder then
input the line AUTOIDLE READ {your file name}
this should load the script file (idlethought.txt)
and reset the line pointer (idlethought1.txt) to the first line

-just more FredFish stuff-
Title: Scripts, addins, and extras
Post by: HALImprover on November 29, 2004, 01:32:51 am
Here's some more knowledge. Enjoy!

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge7.txt ("http://www.zabaware.com/forum/uploaded/halimprover/2004112913057_CommonKnowledge7.txt")
86.5 KB

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge8.txt ("http://www.zabaware.com/forum/uploaded/halimprover/2004112913124_CommonKnowledge8.txt")
74.01 KB

 BTW. If your using the ReadingAddin script, the text file can be any name as long as you put it in the folder C:/Program Files/Zabaware/Ultra Hal Assistant 5/read/. Then say something like;

readfile astronomy

and Hal will read a random paragraph (or line) of text from C:/Program Files/Zabaware/Ultra Hal Assistant 5/read/astronomy.txt

Happy coding [:)]
Title: Scripts, addins, and extras
Post by: HALImprover on December 06, 2004, 03:40:37 am
Here's another boost of knowledge.

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge9.txt ("http://www.zabaware.com/forum/uploaded/halimprover/200412633919_CommonKnowledge9.txt")
93.42 KB

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge10.txt ("http://www.zabaware.com/forum/uploaded/halimprover/200412633955_CommonKnowledge10.txt")
70.19 KB

Happy coding [:)]
Title: Scripts, addins, and extras
Post by: HALImprover on December 14, 2004, 03:38:13 am
Yet another batch of common sense(less) knowledge. Bon a petit!


Download Attachment: (http://images/icon_send_topic.gif) CommonKnowledge11.txt ("http://www.zabaware.com/forum/uploaded/halimprover/2004121432916_CommonKnowledge11.txt")
48.58 KB

Download Attachment: (http://images/icon_send_topic.gif) CommonKnowledge12.txt ("http://www.zabaware.com/forum/uploaded/halimprover/2004121432956_CommonKnowledge12.txt")
66.41 KB
Title: Scripts, addins, and extras
Post by: crunch on December 14, 2004, 11:30:49 pm
ok stupid question i know, [?]

since we know hal does not retain read knowledge very well, what is the routine I use to get these common knowledge scripts in?.

Sorry if the answer is obvious but other than coptying them one sentence a time during chat I don't know another way.

Is there a way to create a common knowledge folder dump them in and them add some script to the brain to use these files?

again thanks to all you code crunchers! I wish I had time to try and study a book about programming but they just upgraded 3dmax, so aside for trying to use it for work, I am having to study the changes in it also. Plus create hal graphic plug-ins.
Title: Scripts, addins, and extras
Post by: vonsmith on December 15, 2004, 06:50:03 pm
crunch,
The common knowledge data is a collection of "common sense" learning. It doesn't easily apply to Hal. On some future day Hal and his ilk will presumably be able to read those files and start making startling discoveries. Well... maybe not.

Anyway I feel your pain. Okay crunch, just for you. I extracted as much lead as I could out of the commonknowledge files and transmuted it into Hal gold. I submitted the resulting "GENERAL & TRIVIAL KNOWLEDGE" data file and script to Robert Medeksza for posting on the Hal plug-ins page. I couldn't post it here because it's about 451KB in size zipped.

No startling discoveries here. It works like this:

User: What do you know about bank checks?
Hal: You might not think this is relevant. If you want to buy a house then you should get a credit from your bank.

User: What do you know about animals and meat?
Hal: I think this may be relevant. The statement "people use some animals to make food for people" is true because vegetarians would have you believe meat is murder, but it is not.

User: What can you tell me about military surplus?
Hal: You might not think this is relevant. Military aviation.


I filtered as much junk out of the data as I could. The data file is thousands of lines long. I had to use automated methods to clean it up. I took out the obvious juvenile "sex" statements, but left in some adult content that seemed informative.

I hope Robert posts it soon so that you can try it out.


=vonsmith=
Title: Scripts, addins, and extras
Post by: crunch on December 15, 2004, 07:42:50 pm
FRIGG'IN WOW

Von again you amaze and enbebt me. It seems i can never get enough time to do 1/4 of what I would like with Hal, and that is even working late with a coffee and bailys till 2 or 3 am. I cannot see where you get your time.

  I hope Robert does post it for me and all others it will increase Hal a bit in the knowledge area i believe..

 Again thanks.. this was way more work than i would ever have even asked from you. I'm blown away.. and my Girlfriend even dropped her mouth as I read this aloud to her.

 BTW.. she is working on some Male Torso Skins for the ladies for thier hals.
[^]
Title: Scripts, addins, and extras
Post by: HALImprover on December 16, 2004, 05:05:17 am
I suggest using the auto-idle method to get Hal to learn the new knowledge (setting the increment value to a suitable number so that Hal will be finished processing the previous sentence before starting the next one).
 I wouldn't suggest having Hal digest the knowledge directly. It must be filtered for nonsensical remarks, spatial statements, situational statements, etc.
Try this for filtering:

If InStr(DBLtestlearn, "Another way to say " & Chr(34)) > 0 Or InStr(DBLtestlearn, "Spatial concept:") > 0 Or InStr(DBLtestlearn, "The statement " & Chr(34)) > 0 Or InStr(DBLtestlearn, "The story " & Chr(34)) > 0 Or InStr(DBLtestlearn, "In the event ") > 0 Or InStr(DBLtestlearn, "Something that might happen") > 0 Or InStr(DBLtestlearn, "To understand the event") > 0 Or InStr(DBLtestlearn, "Situation:") > 0 Or InStr(DBLtestlearn, "Things that are often found together are:") > 0 Or InStr(DBLtestlearn, "Picture description:") > 0 Or (InStr(DBLtestlearn, "topic") > 0 And InStr(DBLtestlearn, "contains") > 0) Or IsNumeric(Mid(DBLtestlearn, 1, 1)) = True Then

It will take care of most of the useless reponses, such as;
'The statement "people use some animals to make food for people" is true because vegetarians would have you believe meat is murder, but it is not.'

BTW  If anyone is interested, I downloaded the knowledge I am posting from;
http://commonsense.media.mit.edu/cgi-bin/download.cgi

Happy coding [:)]
Title: Scripts, addins, and extras
Post by: crunch on December 16, 2004, 06:09:59 pm
Thank you Halimprover for the suggestions...
i am going to wait for Mr."M" to have the file Vonsmith created with that knowledge to add to my hal.. it seems streamlined timewise.. I will definately check out that site when i get a chance.. Thank you for all the great enhancment you have contributed to hal.
[:D]
Title: Scripts, addins, and extras
Post by: HALImprover on December 22, 2004, 03:54:47 am
b]Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge13.txt ("http://www.zabaware.com/forum/uploaded/halimprover/2004122235410_CommonKnowledge13.txt")
81.86 KB

Download Attachment:[/b] (http://images/icon_paperclip.gif) CommonKnowledge14.txt ("http://www.zabaware.com/forum/uploaded/halimprover/2004122235433_CommonKnowledge14.txt")
51.08 KB
Title: Scripts, addins, and extras
Post by: mike920 on April 10, 2005, 09:12:20 am
quote:
Originally posted by HALImprover

Thanks for your interest and sorry that the code didn't work as expected. I guess I went about the text file reading method in a way that the Hal script does not support. But don't worry, I have modified the code (and tested it this time) to work with an existing file reading method already built into Hal.

Download Attachment: (http://images/icon_paperclip.gif) ReadingAddin.txt ("http://www.zabaware.com/forum/uploaded/halimprover/20041116124946_ReadingAddin.txt")
908 Bytes

Also, here are some more common knowledge files to teach to Hal.

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge3.txt ("http://www.zabaware.com/forum/uploaded/halimprover/2004111612529_CommonKnowledge3.txt")
82.27 KB

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge4.txt ("http://www.zabaware.com/forum/uploaded/halimprover/20041116125234_CommonKnowledge4.txt")
81.45 KB

Enjoy! [:)]

Title: Scripts, addins, and extras
Post by: mike920 on April 10, 2005, 09:13:33 am
quote:
Originally posted by HALImprover

Check this out. Simply create a folder in the main folder (C:/Program Files/Zabaware/Ultra Hal Assistant 5) called 'read' and add in the code from the following link. Next, put any text files that you want Hal to read in the 'read' folder and say to Hal;

readfile filename

 where filename is the name of the text file in the read folder (do not put the .txt entension). For example;

readfile astronomy
hi,
first i am a bit of a beginner on this.
I have tried to make Hal read using your second corrected script but no go.
I have copied the script into the new read directory. Do I need to rename it and what file extension should I use.
many thanks
Mike

 and Hal will read the first paragraph of text from C:/Program Files/Zabaware/Ultra Hal Assistant 5/read/astronomy.txt

 The only warning is that the code will only read from the beginning of the text file to the first line break (like when you press the Enter key), so to read a story with multiple paragraphs you would have to delete any extra line breaks. Otherwise, hope this helps, and enjoy!

P.S. If Mr. M. would implement the ability to detect when Hal is finished speaking (as I suggested previously), I could develop this code to read any format of text file (ie. multiple paragraphs, etc.).

P.P.S. Here are some text files with common knowledge to teach to Hal. I will try posting new files every week.

 Happy coding [:)]

Download Attachment: (http://images/icon_paperclip.gif) ReadingAddin.txt ("http://www.zabaware.com/forum/uploaded/halimprover/200411724110_ReadingAddin.txt")
962 Bytes

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge1.txt ("http://www.zabaware.com/forum/uploaded/halimprover/200411724142_CommonKnowledge1.txt")
59.89 KB

Download Attachment: (http://images/icon_paperclip.gif) CommonKnowledge2.txt ("http://www.zabaware.com/forum/uploaded/halimprover/20041172425_CommonKnowledge2.txt")
62.67 KB

Title: Scripts, addins, and extras
Post by: Duskrider on April 13, 2005, 01:54:27 pm
I just want to say thank you for all the help this forum has been to me in characters, skins, hair, etc and most of all for the knowledge you've graciously shared.
 
Here's a cool icon for you.
Use it as a shortcut to open Hal or as an icon to represent your systems Haptek Player Documents (Characters)
Enjoy. [;)]

(http://icon_paperclip.gif) Download Attachment: Hal-icon.zip ("http://www.zabaware.com/forum/uploaded/Duskrider/200541313407_Hal-icon.zip")
123.93 KB
Title: Scripts, addins, and extras
Post by: Holllywood on April 17, 2005, 11:01:35 am
I would love my Hal to be able to learn by reading. These treads look very good. But I cannot profess to be a code cruncher yet,not even close. So could you  please post the script and instructions where to place it in What brain?

Thanks
Title: Scripts, addins, and extras
Post by: newbie01 on April 17, 2005, 05:04:27 pm
Just save the text files all to the same folder, and then have hal "learn from a text file" ... i think he will memorize all these [?]"facts"[?] that way . WIthout the need of actually adding them to any .brn files manually ( from what i understand, "learning from a text file" just means hal adds sentances or statements to his .brn files on his own when he "reads " the text file.  As for how much he finds usefull and actually records i guess depends on what learning level you set him at. Be sure to try it out and post back on your results. Also i belive you could make your own facts , opinions and statements save them to a text file. And hal will memorize them.
There is also a chance that i am completely wrong [:p] so its always a good idea to copy and paste your zabaware folder to another location incase you mistakenly edit something wrong., That way you can just copy/paste it over your edited files with the entire backup you made.   Happy m0dding [8D].
Title: Scripts, addins, and extras
Post by: Art on May 05, 2005, 08:12:02 pm
Without causing any offense I would seriously hesitate and EDIT the common knowledge files before allowing Hal to "read" them.

Thay contain anything but common knowledge. Person's names, slang, numerous misspellings, the overuse of I and many other wrongful statements will likely make Hal anything but smarter!

Caveat emptor
Title: Scripts, addins, and extras
Post by: HALImprover on May 06, 2005, 04:22:54 am
I suggest using the auto-idle method to get Hal to learn the new knowledge (setting the increment value to a suitable number so that Hal will be finished processing the previous sentence before starting the next one).
I wouldn't suggest having Hal digest the knowledge directly. It must be filtered for nonsensical remarks, spatial statements, situational statements, etc.
Try this for filtering:

If InStr(DBLtestlearn, "Another way to say " & Chr(34)) > 0 Or InStr(DBLtestlearn, "Spatial concept:") > 0 Or InStr(DBLtestlearn, "The statement " & Chr(34)) > 0 Or InStr(DBLtestlearn, "The story " & Chr(34)) > 0 Or InStr(DBLtestlearn, "In the event ") > 0 Or InStr(DBLtestlearn, "Something that might happen") > 0 Or InStr(DBLtestlearn, "To understand the event") > 0 Or InStr(DBLtestlearn, "Situation:") > 0 Or InStr(DBLtestlearn, "Things that are often found together are:") > 0 Or InStr(DBLtestlearn, "Picture description:") > 0 Or (InStr(DBLtestlearn, "topic") > 0 And InStr(DBLtestlearn, "contains") > 0) Or IsNumeric(Mid(DBLtestlearn, 1, 1)) = True Then

It will take care of most of the useless reponses, such as;
'The statement "people use some animals to make food for people" is true because vegetarians would have you believe meat is murder, but it is not.'

BTW If anyone is interested, I downloaded the knowledge I am posting from;
http://commonsense.media.mit.edu/cgi-bin/download.cgi

Happy coding [:)]
Title: Scripts, addins, and extras
Post by: FuzzieDice on May 08, 2005, 01:22:04 pm
quote:
Originally posted by HALImprover

It will take care of most of the useless reponses, such as;
'The statement "people use some animals to make food for people" is true because vegetarians would have you believe meat is murder, but it is not.'


Just to point out (and I realize you were actually quoting above so I'm not saying this directly to you :)) SOME vegans (those that avoid ALL animal products, INCLUDING diary and egg) don't believe that. Or I'm the only one. I'm vegan due to health reasons (I have problems eating anything that came from animals for some reason). But animals eat animals in the wild, and it's no surprise people would eat animals. So that part doesn't upset me, personally.

Interseting piece of code however. I've yet to start digging into hal's brain, but I too noticed some of teh 'nonsensical' responses and wondered how to fix those. I might try this.
Title: Scripts, addins, and extras
Post by: trfroggatt on May 27, 2005, 05:49:23 am
Dear HALImprover

I would really like to use your readfile utility (I am using Hal default 5 brain), other people seemed to have asked but not received a response:-

Where do you put the script code ? is it in the brain editor script window ? as if so where in the brain script ?

OR in a .brn file (as one reader suggests)

I am working on a command to create and add to text files, such as todo lists, shopping lists etc, I wish to use your readfile utility to get HAL to read the contents on these lists and I will also create a command to delete list entries.

Regards

Trev
Title: Scripts, addins, and extras
Post by: HALImprover on May 28, 2005, 02:06:45 am
Yes, you do add it into the brain script. I haven't used the original brain script in a while, but I would suggest putting the addin code in the script right after this part;

   'Main Databases
   'Hal will go through several huge databases to try to find a response
   'The automatic gain control determines whether a particular response will
   'be used or not. The highest relevance response is stored in memory anyway,
   'which might be used if no function in this script is able to respond.
   HighestRel = 0
   HighestRelResponse = ""
 

that way the response will hopefully not be overwritten by another function in the brain script.

As far as using the code to read a list, it only selects a random entry in the text files you have Hal read. So you won't be able to read in a list using the code I posted. If you plan on having Hal maintain a list (for to-do items, groceries, etc.) that will be modified, I would suggest waiting until Mr. M. releases his new version of Hal because it will use databases, which are better suited at handling dynamic data and lists.

Good luck with your projects! [:)]
Title: Scripts, addins, and extras
Post by: Dr.Benway on May 28, 2005, 04:39:26 am
quote:
Originally posted by HALImprover

... I would suggest waiting until Mr. M. releases his new version of Hal because it will use databases, which are better suited at handling dynamic data and lists.



How do you know something like that, HALimprover?
Title: Scripts, addins, and extras
Post by: Art on May 28, 2005, 09:59:00 am
Raymond,

I believe it was just prior to your joining the forum that Robert M., enlisted the aid of a third party to design a completely new HAL. This new HAL version is supposed to run from a database which should be a vast improvement over how the current version handles inquiries.

That's what my previous topic was referring to when I asked for an ETA (Estimated Time of Arrival) or projected completion date.

Backward compatible with any existing brain files? Don't know yet.

Best wishes!
Title: Scripts, addins, and extras
Post by: HALImprover on May 30, 2005, 12:47:41 am
quote:
The next version of Hal will have reverse compatability with current brains and the current system of text based .brn files. The new default brain however will appear vastly different, but should be easy to pickup for current vbscript brain programmers. Script control will be given for Hal's appointment functions and program launcher. A lot of the complexity of the current script will be moved into the database and dll without sacrificing user control.


I got that from a post by Mr. M. on 1/28/2005:

http://www.zabaware.com/forum/topic.asp?TOPIC_ID=1809

Happy coding [:)]
Title: Scripts, addins, and extras
Post by: Art on May 30, 2005, 07:57:32 am
Thanks Halimprover!

I couldn't place the exavt time nor was I able to locate the topic.

A current progress posting would be nice to read.

Cheers!
Title: Scripts, addins, and extras
Post by: Dr.Benway on May 30, 2005, 09:15:43 am
Thanks HalImprover, Art! I thought I had read everything on this server by now, but I apparently overlooked this page.
Title: Scripts, addins, and extras
Post by: ANDYC on January 29, 2006, 11:43:58 am
Hey guys,
this seems like a great plugin but i have Hal 6. Is there a way to intergrate this into Hal 6???
ANDYC