Author Topic: getting hal to respond to predetermined question  (Read 5419 times)

etellier

  • Newbie
  • *
  • Posts: 20
    • View Profile
getting hal to respond to predetermined question
« on: June 04, 2008, 10:04:56 pm »
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

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
getting hal to respond to predetermined question
« Reply #1 on: June 05, 2008, 02:49:52 am »
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

  • Newbie
  • *
  • Posts: 20
    • View Profile
getting hal to respond to predetermined question
« Reply #2 on: June 05, 2008, 06:27:31 am »
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

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
getting hal to respond to predetermined question
« Reply #3 on: June 05, 2008, 07:56:33 am »
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

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
getting hal to respond to predetermined question
« Reply #4 on: June 05, 2008, 10:51:22 am »
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

  • Newbie
  • *
  • Posts: 20
    • View Profile
getting hal to respond to predetermined question
« Reply #5 on: June 05, 2008, 05:19:59 pm »
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

  • Newbie
  • *
  • Posts: 20
    • View Profile
getting hal to respond to predetermined question
« Reply #6 on: June 05, 2008, 07:29:25 pm »
Hey there, no luck, get sintax error, or if error...

Eric
 

etellier

  • Newbie
  • *
  • Posts: 20
    • View Profile
getting hal to respond to predetermined question
« Reply #7 on: June 05, 2008, 07:56:42 pm »
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

  • Hero Member
  • *****
  • Posts: 5275
  • Crazy Man
    • View Profile
    • http://www.soundspectrum.com
getting hal to respond to predetermined question
« Reply #8 on: June 05, 2008, 08:56:06 pm »
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

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • http://www.visualillustrations.co.uk
getting hal to respond to predetermined question
« Reply #9 on: June 06, 2008, 01:37:21 am »
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.
« Last Edit: June 06, 2008, 03:54:33 am by ramccoid »
 

simlea

  • Newbie
  • *
  • Posts: 2
    • View Profile
getting hal to respond to predetermined question
« Reply #10 on: August 25, 2008, 01:57:39 am »
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.