dupa

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Joe Londa

Pages: [1]
1
I wrote the following script to be able to put HAL to sleep (and wake up) when the microphone is on/open and background noise could be interperted as input. I have HAL connected to my House Audio System and I use a wireless mike (with varying degrees of success) to communicate with HAL.

1) Add the following lines to the Enhanced_Brain.brn file

"GO TO","SLEEP","","Wake me if you need me.","","",1,#FALSE#,#FALSE#,""
"WAKE","UP","","How can I help you?","","",1,#FALSE#,#FALSE#,""

2) Add the following lines of VBScript to the "YourNamed".uhp file. Anyone have any suggestions for improving this?

'PROCESS: INITILIZE VARIABLES AS INTEGERS
   'VBScript doesn't allow you to declare variables as any data type, everything is a Variant
   'We must assign integers to these variants so that data type errors don't occur
   If LearningLevel = "" Then LearningLevel = 3
   If Hate = "" Then Hate = 0
   If Swear = "" Then Swear = 0
   If Insults = "" Then Insults = 0
   If Compliment = "" Then Compliment = 0
   If GainControl = "" Then GainControl = 25
   If TopicFocus = "" Then TopicFocus = 1
   AvoidBeingFlag = False
   If PrevSent = "Wake me if you need me." Then  
         Sleeping = True
   Else
      Sleeping = False
   End If  
   If PrevSent = "" Then
         Sleeping = True
   End If
   If PrevSent = "How can I help you?" Then
      Sleeping = False
   End If
   JustToldSleep = False

'RESPOND: ZABAWARE KEYWORD MAIN BRAIN PRIORITY 1
   'This function tries getting a response from the Enhanced_Main.brn keyword file. If a keyword or
   'keyphrase is found in top priority, it overrides everything before this function.
   KeyBrain = HalBrain.KeywordBrain(UserSentence, WorkingDir & "Enhanced_Main.brn", False)  
   
   If KeyBrain = "Wake me if you need me." Then         
         Sleeping = True
         JustToldSleep = True
         GetResponse = KeyBrain & vbCrLf
   End If    
      
   If KeyBrain = "How can I help you?" Then
         Sleeping = False
         JustToldSleep = False        
         GetResponse = KeyBrain & vbCrLf
   End If  
 
    If Len(KeyBrain) > 3 Then
      If DebugMode = True Then
         DebugInfo = DebugInfo & "A response has been found in the Enhanced_Main.brn Keyword brain and this response has overwritten any response Hal had already come up with, which was:" & GetResponse & vbCrLf
         End If  
   End If
            

'POST PROCESS: SAVE HAL'S RESPONSE
   
   If Sleeping = True And JustToldSleep = True Then
      PrevSent = "Wake me if you need me."
   End If   
   
   If Sleeping = True And JustToldSleep = False Then
         PrevSent = ""
         GetResponse = ""
   End If
        
   If Sleeping = False Then
      PrevSent = GetResponse
   End If  

3) Can anyone tell me how HAL returns a response when a Run Program command is given. I want to intercept the response and modify it. The GetResponse variable does not seem to be way a response is returned. Any help?   
   


Joe

2
Don
     I did a deep scan of the forums last night and found most of your input quite helpful.  I have used short cuts in the "Programs" directory that Hal reads in at startup.  I drop the file extension on the name and that makes for a good title that HAL reads. So that problem is solved.  

I am trying to get Hal to run the file/program without sending back an acknowledgment of "I will now run...." . No combination of True/False flags in the <RUNIT> syntax line will give me that effect and run the program.  A False/False combination prevents the executable from running.  Any input on this?

I am about half way done with my VBScript book and starting to see how I can do some work around.  I have a variety of things that I would like to do pertaining to Home Automation.    


Joe

3
Ok, my AI is very superficial.

If you put a shortcut in the program file it will pick it up in the Programs.dat file upon restarting HAL. The shortcut I created was a .exe file type. I will experiment to see if it will find any file type. I think it will.

I was using the wrong brain when I was editing the Main Keywords. Once I did discover this my "Turn On" worked just fine excpt for one thing.  The "Repeat Users Sentence after the first search text" must be checked on. Is this what generates the response "I will run.....".  In some cases I would like to have that turned off. I wonder?

Joe

4
Some progress....

I ran across the Programs.dat file and edited to include my VBScript file. That worked well enough, until I exited HAL and returned to the Programs file to find that my edits no longer exsisted.  

If this file rebuilt each time HAL starts? If so what are the defaults on what directories it looks in and what file types? No help for Brain editor is killing me.

I also tried to create a new entry in the Main Keywords and Priority file. It allowed me to create "Turn on" with a <RUNIT> response but it did not have the same affect as "Run". In short it did not work. Is the execute phrases hard coded in against the Program.dat file?  

This product looks promising but I really need to understand what it can and can't do, or rather, what I can't do.

More Help or Self Help Please.

Joe

5
I am still making my way around the Brain Editor but don't quite see how to run a VBScript upon entering/speaking a phrase.  I have a simple VBS file that I would like to launch. The help on the brain editor is not very.  

I enter "Run my favorite VBScript"

Next thing I know, my favorite VBScript is running.

Any help would be appreciated.

Joe

Pages: [1]