Zabaware Support Forums

getting hal to respond to predetermined question

Started by etellier, June 04, 2008, 10:04:56 PM

Previous topic - Next topic

etellier

Hello, how would i go about getting being able to program hal to respond a predetermined answer to a predetermined question example

Q: Hal introduce yourself
A: I am hal, i am the voice of the computer...

i am actually building a kitt replica and i am training hal to be kitt....

thanks for you time..

Eric
 

ramccoid

Hi etellier,
The easiest way to do that is:

If InStr(1,UserSentence,"<HALSNAME> introduce yourself",1) > 0 Then Getresponse = "I am hal, i am the voice of the computer"

Hope this helps,
Roy.
 

etellier

Hello, thank you for the answer, how do i input this? is it a new table in the brain, is it something i input into the dialog window?

can you tell me how to input it please?

thank you

Eric
 

ramccoid

It would be written into a plugin. I'll write you one tomorrow, as I haven't the time today but it shouldn't take too long to do.

Roy.
 

ramccoid

Hi etellier,
I found that I had a bit of time spare, so I quickly put together this for you. You can use it as a plugin or copy the coding from it and adapt it into you own plugin

Roy.



Download Attachment: Greetings.uhp
1.73 KB


 

etellier

hey there, geesh, if i have a few dozens of those predetermined phrase, its gonna be a lot of plugin to deal with, would it be possible to edit the brain for these?

Eric
 

etellier

Hey there, no luck, get sintax error, or if error...

Eric
 

etellier

hey found a way to do it all in 1 plugin.. have to tweak it now...

thanks for the help guys!

-----------
Rem Type=Plugin
Rem Name= speed
Rem Author= R.A.McCoid 2008
Rem Host=Assistant

'---------------------------------------------------------------------------------
'This sub sets up the plug-ins option panel in Hal's options dialog
'---------------------------------------------------------------------------------

Sub OptionsPanel()
lblPlugin(0).Caption = "Ask HAL about speed."
lblPlugin(0).Move 120, 120, 3300, 1200
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub

'-------------------------------------------------------------------------------------------
Rem PLUGIN: PLUGINAREA7
'The comment above tells Ultra Hal Assistant to insert the following code
'on-the-fly into the main brain code in the section referenced.
'-------------------------------------------------------------------------------------------

'sets original user sentence to lower case
OriginalSentence = Lcase(OriginalSentence)
'removes all punctuation
OriginalSentence = HalBrain.AlphaNumericalOnly(OriginalSentence)
'checks to see if user asked tell me about 350  <HALSNAME>
If InStr(1, OriginalSentence, "tell me about 350",1) > 0 Then
'if user did ask give this response
Getresponse = "350 are fast engines. "





End If

'sets original user sentence to lower case
OriginalSentence = Lcase(OriginalSentence)
'removes all punctuation
OriginalSentence = HalBrain.AlphaNumericalOnly(OriginalSentence)
'checks to see if user asked about speed  <HALSNAME>
If InStr(1, OriginalSentence, "how fast did we go",1) > 0 Then
'if user did ask give this response
Getresponse = "just below the limit. "


End If
 

markofkane

I am glad you got it to work. I was getting the error too, that's why I removed my post.

Mark: I'll think about it
Laura: Don't think about it too long or I'll throw you out on your ***king a**.
"Political correctness is censorship"

ramccoid

#9
Hi etellier,
You don't need to keep rewriting this part

'sets original user sentence to lower case
OriginalSentence = Lcase(OriginalSentence)
'removes all punctuation
OriginalSentence = HalBrain.AlphaNumericalOnly(OriginalSentence)

So your plugin should look like:

-----------
Rem Type=Plugin
Rem Name= speed
Rem Author= etellier
Rem Host=Assistant

'---------------------------------------------------------------------------------
'This sub sets up the plug-ins option panel in Hal's options dialog
'---------------------------------------------------------------------------------

Sub OptionsPanel()
lblPlugin(0).Caption = "Ask HAL about speed."
lblPlugin(0).Move 120, 120, 3300, 1200
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub

'-------------------------------------------------------------------------------------------
Rem PLUGIN: PLUGINAREA7
'The comment above tells Ultra Hal Assistant to insert the following code
'on-the-fly into the main brain code in the section referenced.
'-------------------------------------------------------------------------------------------

OriginalSentence = Lcase(OriginalSentence)
OriginalSentence = HalBrain.AlphaNumericalOnly(OriginalSentence)

If InStr(1, OriginalSentence, "tell me about 350",1) > 0 Then
Getresponse = "350 are fast engines. "
End If

If InStr(1, OriginalSentence, "how fast did we go",1) > 0 Then
Getresponse = "just below the limit. "
End If


Now just keep adding your responses.

Roy.
 

simlea

I'm new to Hal especially programming. Here's what I would like to do.  I want to take Hal to schools to talk about a subject.  When a student asks Hal I question I would like him to answer.

"That's a very good question, <name of student>. The answer is_____.

How do I program Hal so I can control his response?

I know how to get the information into him. Thanks to the wiki program that was built, but I'm lost on how to control his response.

thanks for any help you can provide.