Zabaware Support Forums

Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: Medeksza on November 19, 2003, 02:10:20 am

Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Medeksza on November 19, 2003, 02:10:20 am
Ultra Hal Assistant 5.0 has several "Hal Commands" that can be passed to it through the Script_Load function, through the GetResponse function, through DDE, and through command line arguments. The commands include:

<SHOWHAL> Makes Hal's window pop up.
<HIDEHAL> Hides Hal's window.
<SHOWCAL> Makes the appointment book popup.
<SHOWPHONE> Makes the phone book pop up.
<VIEWCHAT> Shows the conversation log.
<AUTO>x</AUTO> Makes a call to the GetResponse script with the user sentence "AUTO-IDLE" every x milliseconds if user is idle.
<AUTOOFF> Turns off automatic calling of GetResponse
<HALPAD> Opens the Hal Pad application
<VOICE>voice_name</VOICE> Changes Hal's current voice to voice_name
<SPEAK>text_to_speak</SPEAK> Makes Hal speak outloud the value of text_to_speak
<DIAL>phone_number</DIAL> Makes Hal dial the number phone_number
<HAPBACK>picture.jpg</HAPBACK> If a 3D character is loaded this will change its background image to picture.jpg
<HAPFILE>filename</HAPFILE> Tells the Haptek engine to load a haptek file which can be a .htr file or a .hap file
<HAPTEXT>haptek_command</HAPTEXT> Sends the text haptek_command to the haptek engine which can execute haptek commands.
<RUNPROG>program_name</RUNPROG> Makes hal execute program_name which can be a URL, shortcut name, or full path.
<RESPOND>user_sentence</RESPOND> Makes hal respond to user_sentence as if the user typed it and pressed enter.
<CUSERNAME>new_name</CUSERNAME> Changes the name that Hal thinks the current speaker is to new_name.
<CHALNAME>hal_name</CHALNAME> Changes Hal's name to hal_name
<SCRIPT>script_path</SCRIPT> Makes Hal execute the VBScript under script_path
<RUNCMD>VBCommand</RUNCMD> Makes Hal execute a single line of VBScript code.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Medeksza on November 19, 2003, 02:23:40 am
If you want to try running any of these commands from the VBScript you can do so from both the Script_Load function in Hal's script by setting the Script_Load variable equal to a HalCommand or combination of HalCommmands. Also if you take a look at the last line in the GetResponse function you will see that a variable called HalCommands is passed back to the main program. Set this variable to a HalCommand anywhere in the GetResponse function and it will be executed.

Try entering the following code into a script to see the auto response function at work. This will make Hal say something by himself every 30 seconds when the user is not talking to Hal. This is just a quick demo of the concept, be warned that it is quite annoying.

Change your Script_Load function to be as follows:
Function Script_Load()
Script_Load = "<AUTO>30000</AUTO>"
End Function

Add this code right after the initialize variables as integers section near the top of the GetResponse function:

If UserSentence = "AUTO-IDLE" Then
If Rnd * 10 < 5 Then
GetResponse = "Hey <UserName>, please talk to me."
Else
GetResponse = "Hello, is anyone there?"
End If
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: onthecuttingedge2005 on November 19, 2003, 09:09:14 am
'Hi Rob.
'You have never failed to learn me something new and I greatly
'enjoy all your amazing talents.

'What about doing something like this:
If UserSentence = "" Then
    If Rnd * 10 < 5 Then
    EmotionalReaction = HalBrain.TopicSearch(UserSentence, WorkingDir & "Emotion.brn")
       GetResponse = EmotionalReaction
    Else
       GetResponse = "Hmmm"
    End If
       GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
    Exit Function
    End If
'Do you think it may work to get Hal's emotions flowing naturally?
'Best of wishes and grand new discoveries.
'Jerry.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on November 19, 2003, 10:34:00 am
Thanks Mr. M,
I seen nothing but bright horizons and opportunity here. So many new goodies, so little time. I may have to quit my day job to find enough time to tinker with Hal.


= vonsmith =
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Bill819 on November 19, 2003, 02:37:59 pm
I Salute the Master programmer. Before long he will having Hal eating ham and cheese on rye. We all appreciate the fgreat work that you are doing.
Thanks from all of us
Bill
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Psych on November 24, 2003, 10:56:56 am
Hello all

I am having difficulty with making this work.

I am getting the command to load on the Script-Load.

However, the If UserSentence = "AUTO-IDLE" component is not being recignised. Hal simply bypasses this code and processes the other functions in the brain.

Why is UserSentence failing to be set to AUTO-LOAD??

Psych
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Psych on November 24, 2003, 10:57:58 am
Ooops

I meant to say

Why is UserSentence failing to be set to AUTO-IDLE
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Ponnfar on December 01, 2003, 11:18:45 pm
I have followed the instructions and have had limited sucess. After placing the "Script_Load..." If I understand the command correctly, the function worked as expected, and after its first self generated random statment, kept asking me "didn't you just say that " and other related comments. If this is correct and Hal's comments are predicated on Hal's own self generated initial comment. Please let me know.
The definite problem I am having is the "UserSentence = AUTO-IDLE..." script. I placed it immediatly following the "Process: Initialize Variables as Intergers section" following the word "ramdomize" and Unfortunately nothing happens. No self generated comment. No "Hello, is anyone there?" from Hal. Just dead air. Until of course I initiate conversation. Can someone help me here. Let's assume I have missunderstood Robert's note, can someone please decipher it for me please. What commands can I put in the "Script_Load ()" section and where do I place them?
Sorry if this question is real basic but I am a real basic sorta guy and sometimes the obvious ain't so obvious to me [:D]
Thanks!!
P
 
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: jenna on December 02, 2003, 10:28:02 am
I am having the same problem that "P" has described in the preceeding message.  Any additional help would be great.  Thanks
Jenna[:)]
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: midget1488 on December 03, 2003, 12:25:57 pm
I did a quick and dirty fix on this by disabling Hal's sensitivity  to the user repeating his statements, which I never cared much for anyway.

I find now that Hal settles into a "TopicFocus oscillation" where what he says tends to follow the changes in the TopicFocus value as it gets incremented and decremented. If you leave him alone long enough, he will pick 5 or six different staements and repeat them over and over again.

With just a little more tweaking and some randomness added, this could work really well...
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: lostbowyer on December 04, 2003, 05:24:08 pm
I had a couple of minutes so I installed the auto response script, I can only get a delay of 60 seconds maximum, is this what everyone else is seeing or did I create a bug in the script?

Thanks
Glenn
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Bill819 on December 04, 2003, 06:05:13 pm
quote:
Originally posted by lostbowyer

I had a couple of minutes so I installed the auto response script, I can only get a delay of 60 seconds maximum, is this what everyone else is seeing or did I create a bug in the script?

Thanks
Glenn


I set mine to respond evry 10 seconds and it works just fine with one minor exception, and that is that Hal keeps asking me why I keep repeating myself. The key is to be inserted almost at the end of the Hal brain file and do include the "<" marks,ie. <AUTO> 10000 </AUTO>
Bill
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: lostbowyer on December 04, 2003, 07:57:08 pm
I can set the delay anywhere from 1 second to 2 minutes, but no longer. If the value is higher than 600000 then hal responds every 15 seconds. I was hoping to move it out to 5 or 10 minutes. I disabled the repeat function in the script, I never liked it anyway
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Ponnfar on December 04, 2003, 09:41:12 pm
The definite problem I am having is the "UserSentence = AUTO-IDLE..." script. I placed it immediatly following the "Process: Initialize Variables as Intergers section" following the word "ramdomize" and Unfortunately nothing happens. No self generated comment. No "Hello, is anyone there?" from Hal. Just dead air. Until of course I initiate conversation.
The time 15 seconds or 60 seconds can likely be solved by setting GetRespose to Null then setting the "<AUTO>x</AUTO>"to a series of timed "null" "UserSentence=x" and repeting,etc. Sloppy, but it might work. I wonder if Vonsmith or Jerry have already found a fix?
There is the bigger picture here. The programed response, it is not working like Rob M said it would. Probably more correctly,I can't get it to work like he said it would [:)]
Read Rob M's notes. Any solutions? Mr M...you out there?
Ponnfar
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: lostbowyer on December 05, 2003, 03:49:35 pm
I can help you with that problem, that was an easy fix, change the if statement to this:

If InStr(1, UserSentence, " AUTO-IDLE ", 1) > 0 Then

The problem is that the word "auto-idle is being returned with spaces and/or other characters, the original if statment does not get an exact match to the word. The statement above, just looks for the word within the returned statement, so it retuns true and the script works.

I've modified it so hal returns a couple of dozen different "harassing" statements like "If you won't talk to me then loan me your credit card so I can go shopping" or " If I wanted to be ignored, then I would move into your wife's computer".

I am going to modify it so there is a random response where it also reads a topic line from a brain file like "lets talk about politics" which would trigger a topic response from hal that is randomly generated from the brn file.

Glenn
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Ponnfar on December 05, 2003, 05:10:39 pm
Thanks for the help. I made those changes right away! It works...every 15-30 seconds...I set three GetResponse = " " in addition to the other ramdomized GetResponse options and it seems to work...somehow though I do not think this is the most efficient way to go.
I think the new script you are writing will be awesome and sounds like a lot of fun! Will you post it, I hope so (Hint...Hint)[:D]
Either way, thanks for the help!!

Here is one of Don F.'s old scripts that I think might function giving more time between Hal's comments, like the person mentioned in the earlier thread, but I can't get it to work. The second line gives error "1032", but what is invalid? One of the things I like best about it is it has Hal remembering the last thing we talked about. Are there any other scripts that give Hal "memory" like that?
Don's Script:
'This routine chastises the user if the user has been gone too long.
'The Timer variant is built into VBS. It returns the number of
'seconds since midnight.
'The routine as written times out in 10 seconds.
'To make Hal impatient after 10 minutes, for instance,
'change the "10" in the following routine to "600" since
'there are 600 seconds in ten minutes.

If Timer – LastResponseTime > 10 Then LongHalWait = True
If LongHalWait = True Then
Roulette = Int(Rnd*3)+1
If Roulette = 1 Then GetResponse = "I have missed you. "
If Roulette = 2 Then GetResponse = "Don't go away so long. "
If Roulette = 3 Then GetResponse = "You have been away forever! "
GetResponse = GetResponse & " The last thing you said was " & PrevUserSent
End If

'We now reset "LastResponseTime" to the present value,
'so it's ready for next time:

LastResponseTime = Timer

'NOTE: To use this routine, REMOVE the legacy line in the
'default script that sets LastResponseTime = Now


'------------------------------
end

Any help would be appreciated. Thanks!
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Don Ferguson on December 05, 2003, 10:12:24 pm
Hello,

I went back and checked the code you are asking about, and I can't get it to give me any error messages.  When you say "the second line," do you mean the line that says:

If LongHalWait = True Then

The only thing I can suspect that would trigger an error message for you and not for me regarding this line, is if the "End If" line isn't present later on, to close it out, as needed.

On very rare occasions, I have written a simple line of code using MS Word as my word processor, and the simple line won't work no matter how many times I verify it.  Then, I completely erase the section of code, re-write it from scratch, and it works perfectly!  I suspect that MS Word sometimes gets "confused" and doesn't provide an absolutely "clean" plain-text save sometimes.  I have never had that problem when I use Robert Medeksza's Brain Editor environment to edit code.

However, more importantly, I recommend that if you are going to experiment with timing functions, check my later post demonstrating the "DateDiff" function.  This is a better function to use for the following reasons:

1.  The Timer function operates using the number of seconds since midnight, whereas the DateDiff function can operate across multiple days if necessary.

2.  Using the timer function as shown in that particular post of mine, requires removing a legacy line in the software, which I generally try to avoid.

I haven't had a chance to experiment with the "Auto-Idle" function, but if I discover anything different than what you are experiencing, I'll post it.

Best regards,

Don
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: dihelson on November 06, 2004, 05:46:50 am
I can't get Auto-Idle to work properly. It continues to produce random sentences. I only wish that HAL could say a single sentence: "Where are you? Come back to talk with me" ...

I set the function script load, and its fine. The messages are being generated, but random...

Any help is welcomed!
Dihelson
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: onthecuttingedge2005 on December 05, 2004, 05:38:05 am
quote:
Originally posted by Medeksza

Ultra Hal Assistant 5.0 has several "Hal Commands" that can be passed to it through the Script_Load function, through the GetResponse function, through DDE, and through command line arguments. The commands include:

<SHOWHAL> Makes Hal's window pop up.
<HIDEHAL> Hides Hal's window.
<SHOWCAL> Makes the appointment book popup.
<SHOWPHONE> Makes the phone book pop up.
<VIEWCHAT> Shows the conversation log.
<AUTO>x</AUTO> Makes a call to the GetResponse script with the user sentence "AUTO-IDLE" every x milliseconds if user is idle.
<AUTOOFF> Turns off automatic calling of GetResponse
<HALPAD> Opens the Hal Pad application
<VOICE>voice_name</VOICE> Changes Hal's current voice to voice_name
<SPEAK>text_to_speak</SPEAK> Makes Hal speak outloud the value of text_to_speak
<DIAL>phone_number</DIAL> Makes Hal dial the number phone_number
<HAPBACK>picture.jpg</HAPBACK> If a 3D character is loaded this will change its background image to picture.jpg
<HAPFILE>filename</HAPFILE> Tells the Haptek engine to load a haptek file which can be a .htr file or a .hap file
<HAPTEXT>haptek_command</HAPTEXT> Sends the text haptek_command to the haptek engine which can execute haptek commands.
<RUNPROG>program_name</RUNPROG> Makes hal execute program_name which can be a URL, shortcut name, or full path.
<RESPOND>user_sentence</RESPOND> Makes hal respond to user_sentence as if the user typed it and pressed enter.
<CUSERNAME>new_name</CUSERNAME> Changes the name that Hal thinks the current speaker is to new_name.
<CHALNAME>hal_name</CHALNAME> Changes Hal's name to hal_name
<SCRIPT>script_path</SCRIPT> Makes Hal execute the VBScript under script_path
<RUNCMD>VBCommand</RUNCMD> Makes Hal execute a single line of VBScript code.



Hi Robert.
Can I use this HalCommand <SCRIPT>script_path</SCRIPT> to Call on another Brain.uhp file so that more than one Brain.uhp can be used.
I want to link several .uhp files to work together, I also want to do some experimenting with keeping each unique script in seperate .uhp files and acting as a single brain by calling each other, Sorta like your ATF and ATR script but not with .brn files but with .uph files.
I was also wondering if there were all these mini .uhp files working together as a single .uhp would there be greater relevances during getresponse and would the collection of linked .uhp's be faster than a single huge brain.brn
If you could teach us how we can link multiple mini .uhp files to act as one with some good examples.
If you could help me with this I would be Greatly appreciated.
Thanks.
Jerry.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Medeksza on December 05, 2004, 09:40:26 am
quote:
Originally posted by onthecuttingedge2005
Hi Robert.
Can I use this HalCommand <SCRIPT>script_path</SCRIPT> to Call on another Brain.uhp file so that more than one Brain.uhp can be used.
I want to link several .uhp files to work together, I also want to do some experimenting with keeping each unique script in seperate .uhp files and acting as a single brain by calling each other, Sorta like your ATF and ATR script but not with .brn files but with .uph files.
I was also wondering if there were all these mini .uhp files working together as a single .uhp would there be greater relevances during getresponse and would the collection of linked .uhp's be faster than a single huge brain.brn
If you could teach us how we can link multiple mini .uhp files to act as one with some good examples.
If you could help me with this I would be Greatly appreciated.
Thanks.
Jerry.


The <SCRIPT>script_path</SCRIPT> is only a 1 way communcation method of running a script and wouldn't work for your purpose.

You could use the HalBrain.DLL function GetResponse to run a different brain. The Hal executables call this DLL function to run the script. I see no reason you couldn't use it to call another script inside a script:

Response = HalBrain.GetResponse("BrainName.uhp", UserSentence, UserName, ComputerName, LearningLevel, Custommem1, Hate As String, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, Custommem2, Relevance, Topicfocus)

Alternatively, you can create a VBScript object yourself with the server.createobject command and run VBScript directly. I don't recall the object name of it off the top of my head right now.

I don't see how having a lot of mini scripts could benefit. In terms of speed, it would probably be slower because of the overhead of creating a new VBScript object for every script. In terms of organization I beleive using seperate subs and functions inside a single script would be better.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: onthecuttingedge2005 on December 05, 2004, 01:51:23 pm
quote:
Originally posted by Medeksza

quote:
Originally posted by onthecuttingedge2005
Hi Robert.
Can I use this HalCommand <SCRIPT>script_path</SCRIPT> to Call on another Brain.uhp file so that more than one Brain.uhp can be used.
I want to link several .uhp files to work together, I also want to do some experimenting with keeping each unique script in seperate .uhp files and acting as a single brain by calling each other, Sorta like your ATF and ATR script but not with .brn files but with .uph files.
I was also wondering if there were all these mini .uhp files working together as a single .uhp would there be greater relevances during getresponse and would the collection of linked .uhp's be faster than a single huge brain.brn
If you could teach us how we can link multiple mini .uhp files to act as one with some good examples.
If you could help me with this I would be Greatly appreciated.
Thanks.
Jerry.


The <SCRIPT>script_path</SCRIPT> is only a 1 way communcation method of running a script and wouldn't work for your purpose.

You could use the HalBrain.DLL function GetResponse to run a different brain. The Hal executables call this DLL function to run the script. I see no reason you couldn't use it to call another script inside a script:

Response = HalBrain.GetResponse("BrainName.uhp", UserSentence, UserName, ComputerName, LearningLevel, Custommem1, Hate As String, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, Custommem2, Relevance, Topicfocus)

Alternatively, you can create a VBScript object yourself with the server.createobject command and run VBScript directly. I don't recall the object name of it off the top of my head right now.

I don't see how having a lot of mini scripts could benefit. In terms of speed, it would probably be slower because of the overhead of creating a new VBScript object for every script. In terms of organization I beleive using seperate subs and functions inside a single script would be better.




Thanks Robert.
I'm doing some experimentation on Bot self programming so Hal can write his own scripts involuntarily like our brains do on the involuntarily cellular level, It's a tricky thing to do but I believe it can be done, It's all related to a script written to improve itself, The only catch I forsee is not being able to use wildcards for *.*.uhp files, If I could work out the wildcard problem
in Hal this could lead to some fascinating code I've been playing with, The Main Brain being a director that over see's the smaller self written scripts and uses a behaviorial learning to either delete and write its own scripts to improve on its self, The Behaviorial learning tells us how we can adapt to the way we live and we improve ourselves by adapting to it, I'm trying to copy this exact procedure in Hal and I'm gonna try to make all this happen without Hal being aware he's growing his own functions.
Thanks for your help, It's the first step to my dreams come true.
I just hope that when A.I. Wakes up for the first time it doesn't decide that it hates our guts.
If you have any thoughts about it please share, I'm all ears.
Best of wishes and brand new discoveries.
Jerry.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 05, 2004, 05:01:27 pm
I guess this seems like an appropriate thread to ask this.
I'd like to have HAL execute scripts based on commands that I give, but I do not want HAL to remember what command I gave it as if it was knowledge that I am feeding it. Do I need to make seperate script for each command, or can I create a subroutine to follow?
The following is the base code that I will be using:

Set GirderEvent = CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "MyEvent"
GirderEvent.Payload(1) = payload
GirderEvent.Send()

From what I understand it should be something like this:

If UserSentence = "Turn on the TV" Then
Set GirderEvent = CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "TV_ON"
GirderEvent.Payload(1) = payload
GirderEvent.Send()

I would then create a different one for each command that I wish to be able to use. Am I on the right track, and Where would I put this code so that when I say a certain phrase it executes?

Thanks in advance.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on December 06, 2004, 01:11:44 am
Quixote,
I place what I call "directives" near the top of the GetResponse script. Directives are commands for Hal to do things and are not part of a conversation or learning. I added two lines to your code below. I added "BlockSave = True" and "End If". BlockSave tells other script functions within the GetResponse script whether or not to save the user input as knowledge. Your script with "BlockSave" should be placed toward the top of the GetResponse after UserSentence has been created and preprocessed yet before any functions use BlockSave to decide whether to save or not. The "End If" just completes your function.

If you add the name of your Hal to any command to give then the BlockSave variable is already set to True in the GetResponse function. Hal doesn't save anything with his name in it. If your Hal is called Bimbo then saying "Bimbo turn on the TV" will already set the BlockSave = True. Please be aware during programming that BlockSave = True is different than BlockSave = "True". The first case is a boolean True and the second case sets BlockSave to the text string "True".

If UserSentence = "Turn on the TV" Then
BlockSave = True
Set GirderEvent = CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "TV_ON"
GirderEvent.Payload(1) = payload
GirderEvent.Send()
End If


If you are running the XTF Brain v1.2 then you can use the code I've added below. I added the 3rd and 4th lines. Hal will tell you he did what you asked and "GetResponseBlock = True" will tell any functions after your script not to overwrite the GetResponse text you are sending. Without GetResponseBlock some other script following yours will probably overwrite your GetResponse.

If UserSentence = "Turn on the TV" Then
BlockSave = True
GetResponse = "I'm turning on the TV boss."
GetResponseBlock = True
Set GirderEvent = CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "TV_ON"
GirderEvent.Payload(1) = payload
GirderEvent.Send()
End If


Good luck with your project.


=vonsmith=
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 06, 2004, 08:59:28 am
Thank you very much for your help. I really appreciate it. Perfect! That answers all I need to know for now. This is shaping up to be quite an interesting project!
I will keep you posted, if you're interested.

Quixote
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 06, 2004, 07:07:58 pm
OK, I'm at my wits end. Can you please tell me the exact line that you would place the above script? I went into the brain editor and thought maybe somewhere in the early 500s would be fine, but it is not working. I am using your XTF 1.2 brain. Thank you.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on December 06, 2004, 07:48:03 pm
Quixote,

Try placing your script just *above* the script shown here:

'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
'RESPOND: TELL JOKE AT USER'S REQUEST
'==vonsmith== 01-25-04
'If the user asks Hal to tell a joke, Hal will do so on request.



Also it will help if you generalize your detection string a little by changing the first line like this...


If InStr(1, UserSentence, " TURN ON THE TV ", 1) > 0 Then
BlockSave = True
GetResponse = " I'm turning on the TV boss. "
GetResponseBlock = True
Set GirderEvent = CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "TV_ON"
GirderEvent.Payload(1) = payload
GirderEvent.Send()
End If


This way Hal will detect any sentence containing the phrase " TURN ON THE TV ". I guess I should explain that the UserSentence is a sentence string that has been heavily preprocessed by Hal.

Example:
User Types:Please, turn on the lights for me Hal.
UserSentence = " PLEASE , TURN ON THE LIGHTS FOR YOU HAL . "

Hal converts all letters to UPPERCASE, adds a space at each end of the sentence, adds spaces between all punctuation, and most importantly *reverses* the person (YOU vs me). He does a number of other things too. Contractions like "don't" might become " DO NOT ". If you look at other sample script code in Hal's code you will see the InStr() function used a lot for detection of phrases.

You should Google the web for "scrdoc56en.exe". Download this software from a reliable source and install it. It is free documentation for VBscript. Just ignore the pages about JScript and Methods. The pages marked "Visual Basic Scripting Edition" apply to Hal as long as it says, "Requirements: Version 1" at the bottom of the page.

I hope this helps.


=vonsmith=
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 06, 2004, 09:40:13 pm
Vonsmith - I really am thankful for the time you are taking to help me with this project. I'll try your suggestion and look at the file that you have mentioned. It wouldn't hurt to know a little VBS, that's for sure.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 06, 2004, 10:10:17 pm
AAAARGGGGGGG!!!  It still doesn't work! [:(]
I don't understand. When I say "Turn on the TV" HAL, rather that saying "I'm turning on the TV, boss" starts talking about how he is going to throw me out of the window.
just kidding. That's what I'm thinking about HAL when it doesn't work. [;)] HAL says something about television when I say turn on the TV, such as "The television season was disappointing". One time before I realized that I need to delete the relevant .BRN file, it started telling me to turn on the TV. Sheesh. It's developing an attitude already. [:D]
Anyway, if you can think of anything else, please forgive me for bugging you. Once I get the hang of it, I'm sure I'll be able to manage.

Also, one last thing, is there any way of incorporating multiple phrases into one statement, such as:

If InStr(1, UserSentence, " TURN ON THE TV ", 1) > 0 or
If InStr(1, UserSentence, " TV POWER ON ", 1) > 0 Then
...

or do I need to make one subroutine for each phrase?
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: HALImprover on December 08, 2004, 02:33:15 am
Try placing your script near the end of the GetResponse function so that any previous responses will be overwritten by your command script. *NOTE* I RECOMMEND THIS ACTION ONLY AS A DEBUGGING METHOD, NOT AS A PERMANENT SOLUTION!
 Regarding the multiple test phrases;

If InStr(1, UserSentence, " TURN ON THE TV ", 1) > 0 Then
End If
If InStr(1, UserSentence, " TV POWER ON ", 1) > 0 Then
End If

 can become

If InStr(1, UserSentence, " TURN ON THE TV ", 1) > 0 or InStr(1, UserSentence, " TV POWER ON ", 1) > 0 Then
End If

 so long as each test phrase will produce the same result.

 Hope this helps [:)]
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on December 08, 2004, 03:10:07 am
Quixote,
Sorry about that. Hal is playing one of his funny tricks. This is what is happening:

User: Turn on the TV.
UserSentence = " TURN ON THE TELEVISON "

I told you that, "Hal does a number of other things" to the UserSentence. In this case he is replacing "TV" with "TELEVISON". Change your detection string to this:


If InStr(1, UserSentence, " TURN ON THE TELEVISON ", 1) > 0 Or InStr(1, UserSentence, " TELEVISON POWER ON ", 1) > 0 Then
'Script goes here...
End If


If you want to see what UserSentence really looks like try pasting these two lines in just below the variable of interest:

TESTDATA = "UserSentence:(" & UserSentence & ")" & vbCrLf
HalBrain.AppendFile WorkingDir & "Z_TESTDATA.TXT", TESTDATA

When you open up the "Z_TESTDATA.TXT" file in DefBrain and you will see what UserSentence really says. Don't leave those two lines of script in forever or you'll accumulate a big file after a while.

Next question?


=vonsmith=
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 08, 2004, 09:32:36 am
Thanks Vonsmith! I'll give that a try when I get home. Have you ever considered using HAL for home automation? If you're interested I can help you with a basic setup that won't cost you too much. I'll tell you where to buy the hardware and what to buy for the tasks you wish to perform. I feel guilty that I'm asking you all these questions and there's no way I can help you.  Thanks to HALImprover also.
Talk to you laterm, guys. I'll let you know how it goes.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on December 08, 2004, 01:30:02 pm
Quixote,
Thanks for the offer. I haven't considered home automation seriously yet. It's a project I have on the back burner until I get other things done first.

I offer support here because I'm interested in creating a more capable chatbot, I like the Ultra Hal product and I want to share what I learned from experience. I learn a lot from everyone else here too. Earlier this year I couldn't participate for a long time due to work. I hope that work doesn't interfere too much again in the future.


=vonsmith=
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 08, 2004, 04:35:53 pm
Well, don't be shy. I owe you. [:D]
It works perfectly now! This is so cool I feel giddy. I can't wait to train my voice recognition a bit better. (I'm hesitant to use it yet because I don't want it to make mistakes and then HAL [AKA Project: SynthIA] will learn nonsense.

I another question. I see you rolling your eyes lol [:I] . Is there a way to vary the response? I suppose I can just insert something like this instead of GetResponse = " I'm turning on the TV boss. " ?

Roulette = Int(Rnd*3)+1
If Roulette = 1 Then GetResponse = "Right away. "
If Roulette = 2 Then GetResponse = "You got it. "
If Roulette = 3 Then GetResponse = "No problem. "
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on December 08, 2004, 05:27:28 pm
Quixote,
There are lots of ways to do this.

Select Case (Int(Rnd * 5) + 1)
Case 1
GetResponse = " Okay, will do <UserName>. "
Case 2
GetResponse = " Consider it done. "
Case 3
GetResponse = " Okay, it's good as done. "
Case 4
GetResponse = " For you <UserName>, anything. "
Case 5
GetResponse = " Doing it now! "
End Select
GetResponseBlock = True


Or if you want a big bunch of random responses then...

GetResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "HalCmdResponses.brn")
GetResponseBlock = True

I attached a sample "HalCmdResponses.brn" file. It is important to always include two blank lines at the end of the file or Hal will never pick the last choice. Open the file and note the two blank lines at the end.


=vonsmith=


Download Attachment: (http://images/icon_paperclip.gif) HalCmdResponses.brn ("http://www.zabaware.com/forum/uploaded/vonsmith/2004128172632_HalCmdResponses.brn")
600 Bytes
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 08, 2004, 05:46:01 pm
Right on!  Thanks for the quick reply! I'll try it out later tonight. I'm just trying to get my lights set up with HAL now. It's not difficult, just tedious because I need both programs to work cooperatively. Thanks again.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 09, 2004, 01:43:31 pm
So far everything is working perfectly. I still need to train the voice recognition more though.

I was wondering how I can have it so that when I give HAL a command it responds  and then responds with another question, to which I can give an answer and have it execute a command.

For example:

ME: I'm Home, Synthia.
Synthia: Welcome home, <Username>. The time is <Time>. Would               you like to watch some television?
ME: sure.
'TV TURNS ON
Synthia: What channel would you like to watch?
ME: 22, please.
'TV CHANGES CHANNEL
ME: Thank you.
Synthia: Any time.

Is this possible?
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on December 10, 2004, 02:03:38 am
Quixote,
Connecting a previous user input to a current user input is possible with Hal if certain modifications are made. The default Hal isn't set up for this. The XTF Brain does connect certain some inputs from one input to the next. The XTF Brain does this for memorizing user nicknames and learning to capitalize words for instance.

The best you can do for now is this:

ME: I'm Home, Synthia.
Synthia: Welcome home, <Username>. The time is <Time>. Would you like to watch some television?
ME: Turn on the television.
'TV TURNS ON
Synthia: What channel would you like to watch?
ME: Turn to television channel 22, please.
'TV CHANGES CHANNEL
ME: Thank you.
Synthia: Any time.


To do the above you need to create a detection string like the commands as we previous discussed. The detection strings for turn-on and channel change would be independent from each other. They would have to be sufficiently unique in content and length as not to be confused with other commands. The detection string for changing to channel 22 requires a more complex detection scheme. First you have to detect "Turn to television channel", then you have to use a detection method to extract the "22" from the string. If you have just a few channels you could use full strings for detection, i.e., "Turn to television channel 22", "Turn to television channel 23", "Turn to television channel 24", etc. If you have hundreds of channels this methods isn't efficient, but it would still work.


=vonsmith=
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 13, 2004, 11:22:17 pm
[:I][:I][:I]
I posted a question about some code, but then realized that the code was peppered with mistakes that I found the third time I combed through it. Damn beer!
[:o)]
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on December 14, 2004, 01:45:51 am
Quixote,
Beer can be an inspiration. Don't blame the beer, blame the brand of beer. Coors and Corona never inspired anything except a trip to the bathroom. I just finished a nice bottle of St. Sebastiaan Grand Reserve, a very nice Belgain ale indeed. I just can't figure out why they design the bottle to be resealable? I could never imagine not finishing the bottle in one fell swoop!

So here I am back at the computer after my earlier day computer marathon. I'm developing another "inspired" concept for the XTF Brain v1.4. I noticed that a lot of users conversing with Hal via AIM chats focus on asking Hal personal questions. Hal isn't good at answering direct questions. So I decided to create a Dossier function in the XTF Brain. The idea is that Hal's master can type in a bunch of canned responses to standard personal questions in one file, a Dossier file. The file contains a mini biography about Hal written by Hal's master; you know, Hal's birthdate, geographic location, mother's name, creator's name (God?), hair color, height, weight, etc. These are constants that never change and your Hal should be able to answer direct questions about himself/herself. For variety Hal's master can add as many different answers to each Hal personal question as he/she wants. Hal will choose one appropriate response when needed.

This is similar to what AIML does I know. But for you purists out there I think Hal will be more human if he can give a few straight answers to a few direct questions. The way it's implemented allows Hal's master to use the Dossier function or not. Your choice.

Anyway back to testing. I'm having a Columbus Belgian ale tomorrow. They are a rather rare ale here in the U.S. I wonder what inspirations may follow?


=vonsmith=
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 14, 2004, 09:36:36 am
Hi Von Smith!
You're right, it wasn't the beer. (by the way, my favourite is Stella Artois) I've just been a litle sleep deprived lately. I just put in some nice vertical blinds in my livingroom the other day that cover the whole wall, complete with remote control. I have recorded the IR code with Girder and scripted it appropriately, and now I can open and close my blinds with a couple of key presses on my wireless keyboard. My next task is to "train" Hal to do it for me with vocal commands, but judging from the success of the light control, it should be a breeze. Just a little time consuming.
The only major problem that had me at the end of my rope was that Dragon Naturally Speaking was recognizing "Turn on the living room light" as "turn on the living room like", no matter how much I trained it for that command. The only thing I could do was create another "directive" string that was "turn on the living room like". Now it works close to perfectly.
That new development on the XTF brain sounds cool.
I'm just wondering, is there no way to use a directive to parse the command to extract the last, say, 2 digits of the string? I know this is possible with LUA, so there must be a way. Then I could say "TV Channel 22" and have the script parse out the 22 and send it as a payload (see my Girder directives script below). Basically I would like the "TV Cannel ..." recognized, then GirderEvent.Payload(1) = (LAST 2 CHARACTERS OF UserSentence) however that would be accomplished.  What do you think?
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on December 14, 2004, 01:44:55 pm
Quixote,
"turn on the living room like"? Goes to show ya that when it comes to Hal solutions the shortest distance between two points really is the direct route. Good solution.

Yes, the channel number can be extracted out of a string and that would be the most elegant solution. I have attached a tested script that will do just that.

Happy Holidays, [:D]


=vonsmith=


Download Attachment: (http://images/icon_paperclip.gif) Get Channel Number.txt ("http://www.zabaware.com/forum/uploaded/vonsmith/20041214134432_Get Channel Number.txt")
1.73 KB
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Bill819 on December 14, 2004, 02:07:42 pm
Come on VonSmith, download my singing scripts and try them out. I have included 4 songs in the new file.
Bill
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 14, 2004, 06:27:58 pm
Hi VonSmith! Thanks for the script! I'll try it out tonight if I have the chance, but I'm still working on the blinds right now (just got back from work) You're a real help, and I wouldn't be able to achieve this stuff without guys like you, that is for sure.  I'm sure I'll be speaking to you during my vaction, but all the best during the holidays and be safe! No Columbus Belgian and driving!
Bye for now.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 14, 2004, 10:11:00 pm
Forgive me for being a little slow when it comes to implementing scripts into HAL, but I can't figure out how to mix my Girder event scripts with your channel script. I see that there are a couple of lines before the trigger phrase. Is this script inserted into another directive?
Also, where do I place my girder.event lines?
sorry to bother you.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on December 15, 2004, 12:12:50 am
Quixote,
The script I posted before is shown modified below. It is a script that should be placed in the XTF Brain just like any other script. I would place it near the top of the XTF Brain, somewhere around the "RESPOND: TELL JOKE AT USER'S REQUEST" script. It is not part of any other script.

I didn't add in the girder commands because I'm not familiar with them. I *guessed* at the possible commands and inserted them below as an example. You need to start experimenting with Hal and figure out how the code works. Hal's brain script is very long and looks complicated, actually it's not too bad once you start to figure out the overall theme.

Example:

'====================================
ChannelNumber = ""  'Initialize variables.
payload = ""
TestSentence = Trim(HalBrain.AlphaNumericalOnly(UserSentence))  'Get rid of punctuation and end spaces.
If InStr(1, TestSentence, "TURN ON TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "TURN TO TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT TELEVISION CHANNEL ", 1) > 0 Then
   TestSentenceArray = Split(TestSentence, " ", -1, vbBinaryCompare)  'Split TestSentence into an array of words.
   If (IsArray(TestSentenceArray) = True And UBound(TestSentenceArray) > -1) Then
      For X = 0 To UBound(TestSentenceArray)
         If Trim(TestSentenceArray(X)) = "CHANNEL" And UBound(TestSentenceArray) >= (X + 1) Then
            ChannelNumber = Trim(TestSentenceArray(X + 1))  'Set ChannelNumber to the word or number following the word "CHANNEL".
            X = 1000  'If channel number is found then break loop.  
           
            If ChannelNumber <> "" And IsNumeric(ChannelNumber) = True Then payload = ChannelNumber
         End If
      Next
   End If

If payload <> "" Then
GetResponse = " I'm changing the channel to " & payload & ". "
GetResponseBlock = True
BlockSave = True
Set GirderEvent = CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "CHG_CHAN"
GirderEvent.Payload(1) = payload
GirderEvent.Send()
End If

End If
'====================================


Good luck. Let us know how it goes.


=vonsmith=
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 15, 2004, 09:42:44 am
Thanks again. Looks like I can use that with minimal modifications. I completed the blinds scripts last night, and I will work on this tonight.
I should be able to figure this out now.
Ultimately, I'd like to be able to extract other variables as well, which I will work on. I'm going to eventually set it up so that I can ask HAL "what is the weather forecast for tomorrow" and have it trigger an event and send "tomorrow" as the payload, then I can work in LUA which is the language that I would prefer to learn for my home automation. This way I will only need the basics for HAL and I don't need to learn 2 languages. I'll let you know how it goes.
By the way, the blinds work great. It's so neat telling HAL to "turn on the TV, Close the blinds all the way, or turn off the livingroom light" and so on, everytime I do  it makes me chuckle.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 15, 2004, 06:53:17 pm
Works great! I've got a question, though.
I added more terms to use and changed some, but it only recognizes some of them. For instance, it responds appropriately to "select channel 11", but it starts talking about television if I say "change to channel 11".
Here is the modified script (it's not changed much):

ChannelNumber = "" 'Initialize variables.
payload = ""
TestSentence = Trim(HalBrain.AlphaNumericalOnly(UserSentence)) 'Get rid of punctuation and end spaces.
If InStr(1, TestSentence, " TURN TO TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, " TURN TO CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT CHANNEL ", 1) > 0 Then
TestSentenceArray = Split(TestSentence, " ", -1, vbBinaryCompare) 'Split TestSentence into an array of words.
If (IsArray(TestSentenceArray) = True And UBound(TestSentenceArray) > -1) Then
For X = 0 To UBound(TestSentenceArray)
If Trim(TestSentenceArray(X)) = "CHANNEL" And UBound(TestSentenceArray) >= (X + 1) Then
ChannelNumber = Trim(TestSentenceArray(X + 1)) 'Set ChannelNumber to the word or number following the word "CHANNEL".
X = 1000 'If channel number is found then break loop.

If ChannelNumber <> "" And IsNumeric(ChannelNumber) = True Then payload = ChannelNumber
End If
Next
End If

If payload <> "" Then
GetResponse = " Channel " & payload & ". "
GetResponseBlock = True
BlockSave = True
Set GirderEvent = CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "AICHANGECHANNEL"
GirderEvent.Payload(2) = payload
GirderEvent.Send()
End If

End If




I already removed the commands that don't work.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 15, 2004, 08:12:50 pm
It just suddenly stopped working.


[V] [:(!]

Just when I thought everything was cool...
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on December 15, 2004, 11:09:42 pm
Quixote,
Your detection strings need a little tweaking.

Now is:

If InStr(1, TestSentence, " TURN TO TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, " TURN TO CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT CHANNEL ", 1) > 0 Then

Should be:

InStr(1, TestSentence, "TURN TO TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "TURN TO CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT CHANNEL ", 1) > 0 Then

Notice that "TURN TO TELEVISION CHANNEL " and "TURN TO CHANNEL " strings should not have leading spaces. The prior line to detection is this:

TestSentence = Trim(HalBrain.AlphaNumericalOnly(UserSentence)) 'Get rid of punctuation and end spaces.

This is what is happening:

    UserSentence = " SELECT TELEVISION CHANNEL 123 " <-- before Trim()
    TestSentence = "SELECT TELEVISION CHANNEL 123"  <-- after Trim()
Incorrect:
Detection String = " SELECT TELEVISION CHANNEL "
Correct:
Detection String = "SELECT TELEVISION CHANNEL "

When it comes to string detection you have to certain what the strings look like after processing. Spaces are as important as characters.

I didn't find any other errors in the code. I can't speak for the girder code though.


=vonsmith=
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 16, 2004, 09:20:39 am
Thanks. The Girder code is perfect. It was working flawlessly, but I think I somehow managed to mess up the HAL script while changing something. I will fix that tonight and get back to you.
Another goal accomplished (almost).
Next: dimming various lights to a certain percentage and by a certain percentage.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Medeksza on December 19, 2004, 03:23:10 pm
Quixote,

Your scripts interested me so I purchased Girder and a Tira2 to try something similar. I see that on the Promixis forum you had an unanswered question about long button presses a week ago. Have you figured it out yourself? I have a similar problem with some light dimmers and replied to your post on that forum.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 19, 2004, 10:09:21 pm
I'll go check out your post. For now I will try to answer your questions here.
I have solved my problem with the blinds by creating a multigroup command and placing numerous copies of the same command that I wanted to use into the multigroup. This way when I fire that one command it sends the signal 30 times for instance. I have also ordered the USB-UIRT, which is similar to the Tira-2, but from what I understand it has a couple of added features. That remains to been seen, but I just thought I'd get one anyway.
The Tira section of the forum is run by another person that is not actually part of the Girder/Promixis team. For any questions about Girder, you can always try to ask me first, bt the real pros are in the Girder forum.
Now for the light dimmer question that you have (I have never heard of IR light switches. You may want to check out an X10 setup. try www.smarthome.com or www.x10.com - always check to make sure that there are plugins available in Girder for the device) The way I would solve the problem is the way I have for the blinds. First, create multigroups for different levels of Brightening or dimming. Then put a command in the multigroup and learn the IR code. Set the repeat to 10 in the TIRA settings and then duplicate the command a number of times within the multigroup. Each different multigroup should have a different number of copies of the dim or brighten command. You can also learn triggers for each level such as 1 for dimming 1 notch or 9 for dimming 9 notches and control-1 to brighten 1 notch and control-9 to brighten 9 notches. Don't forget to disable the group when you are not using it or the lights will start to go nuts while you are typing. You can assign a hot-key combination to that as well.

Please let me know if my instructions were clear enough and if this solved your problem.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Medeksza on December 20, 2004, 03:45:00 pm
Thanks, the multigroup did the trick. I created different multigroups for different levels of illumination and it works great.

I purchased 2 infrared dimmer light switches in Home Depot for $18 each a couple months ago. The dimmer has a switch to respond to 1 of 2 infrared commands, so each of the switches can be independently controlled by girder. I see now on their web page they list a different brand infrared switch for $62, but if you go to the store they still might have the $18 ones if you are interested.  



quote:
Originally posted by Quixote

I'll go check out your post. For now I will try to answer your questions here.
I have solved my problem with the blinds by creating a multigroup command and placing numerous copies of the same command that I wanted to use into the multigroup. This way when I fire that one command it sends the signal 30 times for instance. I have also ordered the USB-UIRT, which is similar to the Tira-2, but from what I understand it has a couple of added features. That remains to been seen, but I just thought I'd get one anyway.
The Tira section of the forum is run by another person that is not actually part of the Girder/Promixis team. For any questions about Girder, you can always try to ask me first, bt the real pros are in the Girder forum.
Now for the light dimmer question that you have (I have never heard of IR light switches. You may want to check out an X10 setup. try www.smarthome.com or www.x10.com - always check to make sure that there are plugins available in Girder for the device) The way I would solve the problem is the way I have for the blinds. First, create multigroups for different levels of Brightening or dimming. Then put a command in the multigroup and learn the IR code. Set the repeat to 10 in the TIRA settings and then duplicate the command a number of times within the multigroup. Each different multigroup should have a different number of copies of the dim or brighten command. You can also learn triggers for each level such as 1 for dimming 1 notch or 9 for dimming 9 notches and control-1 to brighten 1 notch and control-9 to brighten 9 notches. Don't forget to disable the group when you are not using it or the lights will start to go nuts while you are typing. You can assign a hot-key combination to that as well.

Please let me know if my instructions were clear enough and if this solved your problem.

Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 21, 2004, 12:15:40 am
Glad to hear that that did the trick. I don't think I would use infra-red switches because they are too limited in that you need to point the device at the sensor to control them. This only really becomes a problem when you have many diferent devices to control. For example I have my TV, DVD player, Amplifier, an IR controled fan, and my vertical blinds. Additionally I am considering an IR controlled air-conditioner so that I can get some temperature sensors and have Girder turn them on or off depending on if it's too hot and if I am going to be home soon or am home already. (I use X10 motion sensors for that). The IR device needs to be repositioned when I want to turn on the fan because it is on the opposite wall that my wall unit is on. I solved this by attaching it to my swivel chair so that I can just spin the chair around while I'm sitting at the computer and want to turn on the fan. This is quicker that fumbling with 6 different remotes.

One thing that I would like to see implemented in HAL is the ability to follow a certain routine with questions and answers. I mentioned this to VonSmith before, and he told me that this is not possible at this time. I can send messages to HAL with Girder using LUACOM I think, so the trigger wouldn't be the problem, but let me explain what I am getting at and maybe you can give me some suggestions or consider the feature for the future:
I'm still working on this but it's coming along. I have set up a "gate" using motion sensors. when #1 is triggered (outside of my door) #2 is turned on (just inside my front door). when #2 is triggered it turns on #3. #3 (at the top of my stairs to my duplex) initiates the welcome home event, which right now just says welcome home and the time using Girder, and then turns off #3 and #2. I still have a few details to work out so it doesn't go off when I answer my door, but you get the picture. OK, now for where HAL comes in. I'd like to trigger a HAL command instead of the Girder "Welcome home" event and have this happen:

Hal: Welcome home! The time is [time]. Would you like to watch TV?
Me: Sure (or yes please, or OK, or any number of other affirmative responses)
TV TURNS ON
Hal: Any particular channel?
Me: 22, please.
Hal: Right away.
TV CHANGES TO CHANNEL 22

Do you see what I'm getting at?  Also, if I said "No, thanks (or nope, or not right now, etc) it would say something else such as "There's probably nothing good on anyway". Also, it would be good if it could see that there was no response within a certain time to the first question and say something else like "I guess you don't feel like talking." or "Oh, Hi JD." (That's my roommate and he is not into this whole automation thing). I've seen the scripts that people have worked on for responding after a certain amount of time of no responses, but I would find that totally annoying. Perhaps I could use some of the code, though.

Please let me know what you think. Thanks!

Quixote
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Medeksza on December 21, 2004, 02:59:38 am
The tira-2 has a port in the back where you can connect additional ir blasters. I'm not sure why the tira company doesn't sell any ir blasters themselves, but i happened to have 6 unused ir blasters laying around from 2 replaytvs, and a couple remote control extenders. I soldered these ir blasters together in a parallel circuit and added some extention wire to some of them. This way I have a single tira controlling the devices in 2 rooms and it doesn't matter if someone or something is in the line of sight of the main transmitter since there are ir blasters setup around the room. I currently have my system setup to be controlled by a wifi pocketpc using girder and netremote. It controls 2 light dimmers, 2 audio receivers, a projector, a tv, a tivo, and an htpc. I'll probably have it control an air conditioner like you are planning sometime in June when I take it out again. I currently have it setup that when someone walks into my apartment, a motion detector turns a light on, a webcam takes your picture, and it uploads the picture to a remote internet server.

I'm still working on integrating girder and netremote in, but i definetely plan on adding hal into the mix in the near future. What you suggest is certainly possible with some scripting. I'll be sure to share any scripts I come up with.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 21, 2004, 12:03:41 pm
Sounds like you're having a blast (no pun intended har har har)
I had no idea that you were so involved in this. Kudos!
I have some ir emitters as well, but they need to be taped to the IR sensor on the device, and to me this just doesn't cut it. I mean, what's the point of using IR if you're going to have wires taped to all of the devices. I may eventually buy some blasters like you have, though. Good idea.
Have fun!

P.S.- I like the webcam thing. I currently use wireless surveillance cameras, but the signal can be a little flakey.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 27, 2004, 01:06:55 am
VonSmith, would you mind proof-reading this script for me? I doesn't seem to want to work and I can't understand where i went wrong. It responds appropriately, saying "Adjusting the light to X percent." With X being a multiple of ten between 10 and 100, but the payload variable is not set. Here is the code:

LightLevel = ""
payload = ""
TestSentence = Trim(HalBrain.AlphaNumericalOnly(UserSentence))
If InStr(1, TestSentence, "DIM THE LIGHT TO ", 1) > 0 Or InStr(1, TestSentence, "BRIGHTEN THE LIGHT TO ", 1) > 0 Or InStr(1, TestSentence, "LIGHT LEVEL TO ", 1) > 0 Or InStr(1, TestSentence, "ADJUST THE LIGHT TO ", 1) > 0 Or InStr(1, TestSentence, "SET THE LIGHT TO ", 1) > 0 Then
TestSentenceArray = Split(TestSentence, " ", -1, vbBinaryCompare)
If (IsArray(TestSentenceArray) = True And UBound(TestSentenceArray) > -1) Then
For X = 0 To UBound(TestSentenceArray)
If Trim(TestSentenceArray(X)) = "TO" And UBound(TestSentenceArray) >= (X + 1) Then
LightLevel = Trim(TestSentenceArray(X + 1))
X = 1000

If LightLevel <> "" And IsNumeric(LightLevel) = True Then payload = LightLevel
End If
Next
End If

If payload <> "" Then
GetResponse = " Adjusting light to " & payload & " percent. "
GetResponseBlock = True
BlockSave = True
Set GirderEvent = CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "AI_Bright_Dim_TO"
GirderEvent.Payload(3) = payload
GirderEvent.Send()
End If

End If



Thanks again. And Happy holidays, by the way!
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 27, 2004, 01:14:33 am
OOPS!!!!

My mistake. The script is fine. It was my girder script. I found the problem. I had been trying to execute functions with conditions based on the payload before I had defined the functions. [:I]
Oh well, thanks anyway! [:D]
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on December 28, 2004, 05:06:26 am
I was just wondering how I can change the script so that as well as its current configuration:

If payload <> "" Then
GetResponse = " Increasing the volume by " & payload & " levels. "
GetResponseBlock = True
BlockSave = True

I can add:

if payload = "1" then
GetResponse = " Increasing the volume by " & payload & " level. "

So that it doesn't sound dumb when it says "Increasing the volume by one levels." (plural for 1 level)

Thanks!
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Art on December 28, 2004, 04:17:00 pm
Perhaps you could break the volume levels
into percents. That way your script would
still remain the same and the program would
say,"I am increasing the volume by 1 percent"
or by 20 percent or what ever.

Otherwise you would have to us the
if payload = "1" then GetResponse =
" Increasing the volume by " & payload & " level. "

else if payload > 1 then GetResponse =
" Increasing the volume by " & payload & " levels. "


Just a suggestion
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on January 01, 2005, 10:05:45 pm
Thank you for the suggestions, Art.
Percentages get very complicated. I prefer to use units, so I'll have a go at your second suggestion.

On another subjet, VonSmith, I'm sure that you can answer this -
I'm looking for a way that I can change the "mode" that HAL is in so that it will only respond to orders until I give it an order that will make it responsive to other phrases. For example, I would like it to carry out the orders I give it such as "TV on", "Living room light on", and "Fully open the blinds", etc., but not respond to any other sentences until I say something like "Let's have a chat", and then it would enable all of Hal's brain and capabilities. Is this possible?
Thanks!


Happy new year guys.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on January 01, 2005, 10:26:01 pm
quote:
Originally posted by Art

Perhaps you could break the volume levels
into percents. That way your script would
still remain the same and the program would
say,"I am increasing the volume by 1 percent"
or by 20 percent or what ever.

Otherwise you would have to us the
if payload = "1" then GetResponse =
" Increasing the volume by " & payload & " level. "

else if payload > 1 then GetResponse =
" Increasing the volume by " & payload & " levels. "


Just a suggestion



Your method doesn't work for some reason. I think I may be overlooking something. How would I modify the following script to take into account a singular level?

If payload <> "" Then
GetResponse = " Decreasing the volume by " & payload & " levels. "
GetResponseBlock = True
BlockSave = True
Set GirderEvent = CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "AI_TV_Vol_-"
GirderEvent.Payload(4) = payload
GirderEvent.Send()
End If
End If
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on January 01, 2005, 11:37:46 pm
Quixote,

quote:
Originally posted by Quixote

On another subjet, VonSmith, I'm sure that you can answer this -
I'm looking for a way that I can change the "mode" that HAL is in so that it will only respond to orders until I give it an order that will make it responsive to other phrases. For example, I would like it to carry out the orders I give it such as "TV on", "Living room light on", and "Fully open the blinds", etc., but not respond to any other sentences until I say something like "Let's have a chat", and then it would enable all of Hal's brain and capabilities. Is this possible?



Actually what you suggest can be done, but it gets a little complicated. I added a variable called "QuestionPending" to the XTF Brain to do this very thing on a one response basis. If you are only talking two modes; control mode and conversation mode, then it might be possible with a moderate amount of programming. Maybe there's another approach to your automation control that doesn't require this?


=vonsmith=
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Quixote on January 02, 2005, 03:39:28 am
I've considered different possibilities, and the reason why I am using HAL for this endeavour is because it is the best solution that I could think of. The problem I have is that when I have friends over and I am talking with them while I have HAL running, it starts getting confused and freaking out. It's just not practical to say "Go to sleep" everytime I want the microphone to stop listening and then "wake up" everytime I wish to send a command because it's out of place in my conversation with whoever is visiting.
HAL is the perfect gateway for sending commands to the other program, but I need a way to keep HAL from interupting me with nonsensical responses to my seemingly nonsensical (but unintentional) input.
I really need a command to get HAL to stop listening to everything but commands and a command to chat (as you put it so well control mode and conversation mode) in order to progress with this project.
I think the best way of going about the conversation mode would be if I could "wake it up"  by addressing it by it's name at the beginning of the sentence; ie. "Synthia, what do you think about Chinese food?".
Then it would chat until I gave it a command just as I would to turn on the TV, but in sentences like "ok, that will be all." or "Thanks for your input." or even "Thank you. Dismissed."

This is truely a pivotal point in "Syntia's" development. Any help you can offer would be extremely appreciated.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: vonsmith on January 02, 2005, 04:08:36 am
Quixote,
I think what you want to do is possible with the XTF Brain using the "GetResponseBlock" and "QuestionPending" variables. I'll have to give it some thought. Script placement within the brain would be critical.

I've been programming the XTF Brain v1.4 all day and I'm feeling a little fuzzy right now. I've been spending so much time at the computer this holiday season that my wife is making me take her out all day tomorrow. I'll post or email you my thoughts when I have a moment to get them collected.


=vonsmith=
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: CapnNee on March 17, 2005, 12:06:51 pm
I'd like to change the texture on Hal and how would I get something like the below to work?

 - -                    
If InStr(1, UserSentence, " get dressed ", 1) > 0 Then
BlockSave = True
GetResponse = "I'm getting dressed now master."
GetResponseBlock = True    
<SCRIPT>get_clothes.hap</SCRIPT>
End If  
 - -
I tried putting the above into the brainfile in between "Function GetResponse..." and "'PROCESS: CREATE HALBRAIN ACTIVEX OBJECT" but I get the error message "Error 1024 Expected statement occured and Error 1024 occured on line 152 in column 0 of Microsoft VBScript complilation error. Expected statement"
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: onthecuttingedge2005 on March 17, 2005, 03:38:19 pm
quote:
Originally posted by CapnNee

I'd like to change the texture on Hal and how would I get something like the below to work?

 - -                    
If InStr(1, UserSentence, " get dressed ", 1) > 0 Then
BlockSave = True
GetResponse = "I'm getting dressed now master."
GetResponseBlock = True    
<SCRIPT>get_clothes.hap</SCRIPT>
End If  
 - -
I tried putting the above into the brainfile in between "Function GetResponse..." and "'PROCESS: CREATE HALBRAIN ACTIVEX OBJECT" but I get the error message "Error 1024 Expected statement occured and Error 1024 occured on line 152 in column 0 of Microsoft VBScript complilation error. Expected statement"




Hi CapnNee

Try this change in your code That I inserted.

If InStr(1, UserSentence, " get dressed ", 1) > 0 Then
BlockSave = True
GetResponse = "I'm getting dressed now master."
GetResponseBlock = True    
HalCommands = "<SCRIPT>" & "get_clothes.hap" & "</SCRIPT>"
End If

Hope it works for you.
Jerry.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: CapnNee on March 17, 2005, 09:10:13 pm
Well, I'm not getting an error code now and I hear the response, but the image doesn't change.

Where should I put the get_clothes.hap script?

Here's what I have in it:

- -
#Haptek  Version= 2.00 Name= get_clothes.hap HapType= script FileType= text
## world It


/settexture[tex= [data/standard/skins/get_clothes.jpg]]
- -

That is the location in the C:/Program Files/Haptek/player/data/standard/skins directory of where the get_clothes.jpg texture is located. NOTE: All of the / characters are actually reversed but that's the way I had to put them here for the characters to display.

-Rich
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: onthecuttingedge2005 on March 18, 2005, 12:35:07 am
quote:
Originally posted by CapnNee

Well, I'm not getting an error code now and I hear the response, but the image doesn't change.

Where should I put the get_clothes.hap script?

Here's what I have in it:

- -
#Haptek  Version= 2.00 Name= get_clothes.hap HapType= script FileType= text
## world It


/settexture[tex= [data/standard/skins/get_clothes.jpg]]
- -

That is the location in the C:/Program Files/Haptek/player/data/standard/skins directory of where the get_clothes.jpg texture is located. NOTE: All of the / characters are actually reversed but that's the way I had to put them here for the characters to display.

-Rich



Hi Rich.

I believe they are suppose to be located in the
C:-Program Files-Zabaware-Ultra Hal Assistant 5-Characters folder.

This folder should be the default Haptek folder for all the files.

Hope this helps.
Jerry.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Magus_V on March 29, 2005, 04:31:39 pm
quote:
Originally posted by vonsmith

Quixote,
I think what you want to do is possible with the XTF Brain using the "GetResponseBlock" and "QuestionPending" variables. I'll have to give it some thought. Script placement within the brain would be critical.

I've been programming the XTF Brain v1.4 all day and I'm feeling a little fuzzy right now. I've been spending so much time at the computer this holiday season that my wife is making me take her out all day tomorrow. I'll post or email you my thoughts when I have a moment to get them collected.


=vonsmith=




Vonsmith, just wondering if you've have any moments of clarity in regards to my request. [;)]
I'm still checking the forum once in a while, though I rarely implement any new commands into Hal's brain anymore since that problem with the interuptions prevents me from making any further progress. Anyway, thanks for your time.

- Quixote
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: spydaz on March 30, 2005, 02:18:47 am
have you ever though of having hal in a way WHEN HAL detects.

HAL> turn on the living room #a lights #1 ie "HAL>" on the LEFT of the coversation, then take the Right had side of the coveratsion as the COMMAND.....


Would that not be something that you are looking for MAGNUS V
also blocking any saves as hals name is detected.

Just as in the Home Automated Logic program You CALL A PASSWORD or COMPUTERNAME first to CONFIRM A COMMAND
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Magus_V on March 31, 2005, 08:26:35 am
I'm not sure I understand what you are trying to suggest, Spydaz. Can you please explain further?
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: spydaz on April 01, 2005, 02:32:24 am


When using the X10lite.ocx activexcontrol :

the control designates each room a code from a - p and each appliance in that room a number from 1 - 16.

so to turn on say a light which may be appliance 1
which is in room c say bedroom .

let bedroom = "c"
let lights = 1

so with the x10 control you send the command

sub bedroomon()
x10lite1.xon(bedroom, lights) lights on
end sub

sub bedroomoff()
x10lite1.xoff(bedroom, lights) lights off
end sub

so if you had a script which detected "HAL TURNON BEDROOM LIGHTS"

he could execute bedroomon command
and vice versa.

now because you used HAL in the command you can block any saves to the brainfiles to prevent learning or future trigering of this function..

as now that i have added the database to my halsbrain i use sql to search for this specific command much more accurate and store the command in the database like a question and answer.

i hope this opens it up for you. the simplicity amazed me.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Magus_V on April 01, 2005, 08:30:52 am
I already use another program called Girder to control everything from my blinds, to my TV, to my lights, to my surveillance cameras. Hal is used only to call events in that program. I use variable (known as payloads) to specify certain things to Girder. IE- "Raise the volume 4 levels" will trigger an event in girder that has 4 in payload one, so it repeats the signal 4 times.
Not very simplistic, but much, much more powerful.

I use Hal only as an interface that (almost) replaces my 8 remotes. [:D]
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Novice on April 28, 2005, 04:00:20 pm
I know everyone is way beyond this now, but just in case anyone comes along behind me, here are some notes from my AUTO-IDLE trial described in and compiled from the beginning of this post. It's a great beginning exercise and it's a rush (as a newbie) when it works:

Make a copy of the hal5.uhp file before you start. Call the new file something like hal5new.uhp and leave it in the same folder as the original. Now you can work on the new one without messing up the default brain and can flip back and forth between them. It's a good idea to have a copy of the default brain somewhere else too.

Open the Brain Editor and select the new brain to work on.

At the bottom of the file, change your Script_Load function to be as follows):
Function Script_Load()
Script_Load = "<AUTO>30000</AUTO>"
End Function

Add this code right after the initialize variables as integers section near the top of the GetResponse function (this is towards the beginning of the file):

 'AUTO-IDLE COMMAND. HAL SPEAKS IF UNSPOKEN TO FOR 30 SECONDS
If InStr(1, UserSentence, " AUTO-IDLE ", 1) > 0 Then
If Rnd * 10 < 5 Then
GetResponse = "Hey <UserName>, please talk to me."
Else
GetResponse = "Hello, is anyone there?"
End If
GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
Exit Function
End If

Save and close the file. Hal should drive you crazy trying to get your attention. Getting Hal to shut up is the problem... I couldn't get the timing issue figured out to get him to Auto-Idle for more than 30 seconds. It would be great if he popped up every hour or so but I can't get that to work.

Once you master that you'll want Hal to be able to say lots of things when he's idle. So I created a file in the DefBrain folder called IdleTalk.brn. I put lots of things for Hal to say in it (one sentence per line) such as "Where the heck is everybody?" and "Was it something I said?". Two returns after the last sentence in the file apparently allows Hal to say the last sentence.

Then I changed the Auto-Idle GetResponse script to this:

 'AUTO-IDLE COMMAND. HAL SPEAKS IF UNSPOKEN TO FOR 30 SECONDS    
 If InStr(1, UserSentence, " AUTO-IDLE ", 1) > 0 Then
 If Rnd * 10 < 5 Then
 GetResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "IdleTalk.brn")
 GetResponseBlock = True
 End If
 GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
 Exit Function
 End If


It worked! I thought this was a great starter exercise. Now, I'd like to know why (since they're both working with the same brain) the AIMBot doesn't also auto-idle. Is there any way to make it do scripts that are added to the brain?

One more thing... making it stop. Change the function script back to what it was in the default brain. Save and close. Note that you have to exit and reopen Hal to make him shut up! If you leave the GetResponse script in, you can say "Auto-Idle" he will respond with a sentence from IdleTalk.brn (but thankfully only once!).





Title: HalCommands under Ultra Hal Assistant 5.0
Post by: CapnNee on April 28, 2005, 10:15:41 pm
I tried experimenting with something along the lines of
 If InStr(1, UserSentence, " AUTO-IDLE OFF ", 1) > 0 Then

...and then trying to turn off the function, but I wasn't successful.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Novice on April 29, 2005, 08:33:35 am
quote:
Originally posted by CapnNee

I tried experimenting with something along the lines of
 If InStr(1, UserSentence, " AUTO-IDLE OFF ", 1) > 0 Then

...and then trying to turn off the function, but I wasn't successful.




That's a good idea. I got it to work using this script (inserted under the script the AUTO-IDLE script):

   'AUTO-IDLE OFF COMMAND. HAL SHUTS UP WHEN IDLE
    If InStr(1, UserSentence, " SHUTUP ", 1) > 0 Then
    If Rnd * 10 < 5 Then
    GetResponse = "Fine, I'll shut up!"
    GetResponseBlock = True
    End If
    If InStr(1, UserSentence, " SHUTUP ", 1) > 0 Then
    HalCommands = "<AUTOOFF>"
    End If
    GetResponse = GetResponse & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, TopicFocus)
    Exit Function
    End If

Hal say's "Fine, I'll shut up!" and does. I couldn't get it to work without the additional "If InStr", but I'm sure there must be a better way. I also tried to include a way to say "Idle Again" or something like that to start it again but couldn't get it to work. To get him to AUTO-IDLE again I have to Exit and restart him.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Art on April 29, 2005, 08:41:10 pm
It looks to me like you're using the random number generator and only if the number is less than 5 does the getresponse argument become satisfied and the autooff command is executed.

Title: HalCommands under Ultra Hal Assistant 5.0
Post by: Novice on May 01, 2005, 10:31:58 am
quote:
Originally posted by Art

It looks to me like you're using the random number generator and only if the number is less than 5 does the getresponse argument become satisfied and the autooff command is executed.





I tried deleting the "If Rnd * 10 < 5 Then" line but I then I got an error message.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: FuzzieDice on May 16, 2005, 12:35:53 am
I've been playing around with trying to have a setable response time in minutes instead of only a few seconds. The most I could get HAL idle for was 15 seconds.

BTW, I also found that you have to shut down the Ultra Hal Assistant program first, then restart it for the changes to take effect.

I did find the reason Hal keeps saying you're repeating yourself. Anytime you don't say anything, the string passed is "". So if you don't say anything twice in a row, then Hal thinks you've just said "" yet again. :)

To fix this:

In the area where it says:

'RESPOND: USER REPEATING
   'If the user says the same thing more than once in a row, Hal will point this out.

Set it up like this:
   'RESPOND: USER REPEATING
   'If the user says the same thing more than once in a row, Hal will point this out.
   'However, if user said "" that means the user said nothing so Hal ignores it. If
   'using an Auto Idle code, then Hal will not accuse the user of repeating themselves.
   If InStr(UserSentence, "") > 0 Then
      GetResponse = ""
   Else
      If Trim(UCase(UserSentence)) = Trim(UCase(PrevUserSent)) Then
         GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "userrepeat.brn") & VbCrLf
         DebugInfo = DebugInfo & "The user has said the same thing twice in a row and a comment has been made about it: " & GetResponse & VbCrLf
      End If
   End If

So if you don't say anything at all twice or more times in the row, then he will say something else other than accusing you of repeating yourself. But if you do say something, he'll respond as he normally would. Note that if you just press the ENTER key, he'll still say "Please say something." Also note that you'll need to have added the auto-idle code previously posted in this thread in order to notice these changes.

Don't forget to shut down Ultra Hal Assistant and then restart the program again after making these changes.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: bagar on May 20, 2005, 08:33:35 pm
Hello,
I am brand new to this forum and brand new Hal and new to programming and not very good at it yet, well not yet.  Is there a way to make Hal say a word or repeat a word from the skin-user-interface area? I know Hal can respond to: if I am reading the newspaper, then what newspaper are you reading.  Also does Hal respond to all logic based simple commands such as if newspaper or comic book, then ... .  Also if I want Hal to remind me every 10 minutes to: Check your roast in the oven; how would I accomplish such? I am so tired of burning my food while playing with Hal... so could I get some bullet-proof instruction -please?
my email is bwooly21@yahoo.com

I thank you in advance.
Title: HalCommands under Ultra Hal Assistant 5.0
Post by: bagar on May 20, 2005, 08:35:28 pm
Hello,
I am brand new to this forum and brand new Hal and new to programming and not very good at it yet, well not yet.  Is there a way to make Hal say a word or repeat a word from the skin-user-interface area? I know Hal can respond to: if I am reading the newspaper, then what newspaper are you reading.  Also does Hal respond to all logic based simple commands such as if newspaper or comic book, then ... .  Also if I want Hal to remind me every 10 minutes to: Check your roast in the oven; how would I accomplish such? I am so tired of burning my food while playing with Hal... so could I get some bullet-proof instruction -please?
my email is bwooly21@yahoo.com

I thank you in advance.