Author Topic: HalCommands under Ultra Hal Assistant 5.0  (Read 46064 times)

Ponnfar

  • Full Member
  • ***
  • Posts: 149
    • View Profile
    • http://zabaware.com
HalCommands under Ultra Hal Assistant 5.0
« Reply #15 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!
« Last Edit: December 05, 2003, 09:26:10 pm by Ponnfar »
One Person can summon the future...

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
HalCommands under Ultra Hal Assistant 5.0
« Reply #16 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
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

dihelson

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #17 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
 

onthecuttingedge2005

  • Guest
HalCommands under Ultra Hal Assistant 5.0
« Reply #18 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.

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
HalCommands under Ultra Hal Assistant 5.0
« Reply #19 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.
Robert Medeksza

onthecuttingedge2005

  • Guest
HalCommands under Ultra Hal Assistant 5.0
« Reply #20 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.

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #21 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.
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #22 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=
« Last Edit: December 06, 2004, 01:17:18 am by vonsmith »
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #23 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
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #24 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.
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #25 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=
« Last Edit: December 06, 2004, 07:52:13 pm by vonsmith »
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #26 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.
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #27 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?
 

HALImprover

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • BrianTaylor.me
HalCommands under Ultra Hal Assistant 5.0
« Reply #28 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 [:)]
Living life with a loving heart, peaceful mind, and bold spirit.

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #29 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=
« Last Edit: December 08, 2004, 03:10:54 am by vonsmith »