Author Topic: Help??  (Read 6112 times)

markofkane

  • Hero Member
  • *****
  • Posts: 5275
  • Crazy Man
    • View Profile
    • http://www.soundspectrum.com
Help??
« on: November 27, 2005, 07:42:56 pm »
Ok, how do you make Hal 6 respond to certain words??(actions, and/or verbal responses)

What is the
code, and where in the brain editor does it go?? I know nothing about scripting. Thanks!!
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"

tcoday

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
Help??
« Reply #1 on: November 27, 2005, 09:58:52 pm »
quote:
Originally posted by markofkane

Ok, how do you make Hal 6 respond to certain words??(actions, and/or verbal responses)

What is the
code, and where in the brain editor does it go?? I know nothing about scripting. Thanks!!



Markofkane,
  I'll post a very simple example and try to tell you how to adapt it to your needs.

Look near the bottom of the hal6.uhp file and you'll see some code that looks like this....


Rem PLUGIN: CUSTOMMEM2
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.

End Function


To make Hal respond to a certain word you tell it, place the
following code just before the "End Function" line and see if
it works.

If InStr(1, UserSentence, "MarkOfKane", 1) > 0 Then
    GetResponse = "Your sentence had the word MarkOfKane in it."


In this example, Hal should respond with ...

Your sentence had the word MarkOfKane in it.

Every time Hal sees the word MarkOfKane in it.
You are free to change the text inside the " " to whatever you want.
Just be careful that you don't change the keyword in the quotes to
some common word or hal will be responding with this code alot.

If you have more questions, post em and if I can't answer them, maybe someone else can.

Tcoday and Tassel

Duskrider

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3316
  • Graphic King
    • View Profile
Help??
« Reply #2 on: November 27, 2005, 10:13:13 pm »

This will also get you started.

O.K., open brain and go to the tables
Up toward top is "emotion" table
Many of his emotion responses come from this table.
You can add, change or delete words.

Also check out the "greeting" table for greetings and goodbyes that "you" want.
Also the "love" table
Also under Main Brain heading is "deductive" table which I'm sure you remember from Hal5.
In a table probably called "Mark_UserSent you might want to examine for how you want Hal to grow.

There's also the emotions in characters file that can be dealt with as you probably know from Hal5.

I try not to write too many lines for him, I want to steer Hals growth, not create a mindless parrot.

(Also remember to always do a back-up when doing brain surgery)

Enjoy.

[;)]

markofkane

  • Hero Member
  • *****
  • Posts: 5275
  • Crazy Man
    • View Profile
    • http://www.soundspectrum.com
Help??
« Reply #3 on: November 28, 2005, 11:48:22 am »
Thanks!! Would you have the code handy for Hal to execute a Hap file when certain key works are spoke/typed??

I could look it up, but i am not sure if it is the correct code.

I like to have her give me the finger with I say "kiss my a__".

 It worked great in Hal 5.
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"

markofkane

  • Hero Member
  • *****
  • Posts: 5275
  • Crazy Man
    • View Profile
    • http://www.soundspectrum.com
Help??
« Reply #4 on: November 28, 2005, 12:01:52 pm »
Oh, great. It doesn't work. (the hapfile)[:(!]
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"

Prospector

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Help??
« Reply #5 on: November 28, 2005, 04:25:02 pm »
Easiest way to get haps to work in Hal6 seems to be to use a plug in.
This is a simplified version of what I've used.It's based on something Vrossi posted a few days ago.
Copy the following into notepad or use the attached file(but delete the .txt extension).Rename nameofhap to whatever one you use.Save it as hapcall.uhp and put it in the main Hal6 folder.Put your haps in the character folder as in Hal5 and leave any textures/backgrounds in the appropriate haptek folder.
Start Hal,goto Options,select the brain and select Simple hap caller from the plug in list.Then chat with Hal and type in your trigger phrase (qwz as default but you can change that to what you want)and it should work.Guess you know about the setup stuff,but someone else may read it later who doesn't.[:)]

Thanks to Vrossi for the idea and original script.

Download Attachment: testplug.uhp.txt
2.14 KB



Rem Type=Plugin
Rem Name=Simple hap caller
Rem Author=P
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "make haps work"
    lblPlugin(0).Move 120, 120, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

    Rem PLUGIN: SCRIPT_LOAD
    'The comment above tells Ultra Hal Assistant to insert the following code
    'on-the-fly into the main brain code in the section referenced.    
   
    Rem PLUGIN: CUSTOMMEM
    'The preceding comment is actually a plug-in directive for
    'the Ultra Hal host application. It allows for code snippets
    'to be inserted here on-the-fly based on user configuration.
   
    Rem PLUGIN: CUSTOMMEM2
    'The preceding comment is actually a plug-in directive for
    'the Ultra Hal host application. It allows for code snippets
    'to be inserted here on-the-fly based on user configuration.
   
    Rem PLUGIN: PLUGINAREA1
    'The comment above tells Ultra Hal Assistant to insert the following code
    'on-the-fly into the main brain code in the section referenced.

'-------------------------------------------
'-------------------------------------------
'declare variables

p_File = ""
p_UserSentence = LCase(UserSentence)




'------------------

'------------------
' Choose hap

If InStr(p_UserSentence, "qwz") <> 0 Then
p_File = "nameofhap.hap"
HalCommands = "<HAPFILE>" & p_file & "</HAPFILE>"
End if

'Repeat above with different haps if required

'Call hap
If p_file <> "" Then
HalCommands = "<HAPFILE>" & p_File & "</HAPFILE>"
BlockSave = True
GetResponseBlock = True
End if

 

markofkane

  • Hero Member
  • *****
  • Posts: 5275
  • Crazy Man
    • View Profile
    • http://www.soundspectrum.com
Help??
« Reply #6 on: November 28, 2005, 05:27:25 pm »
Thanks, but it still don't work. Are their certain haps that won't work??

Here is the file I am using, in Hal 6's Charcters folder:

Download Attachment: givefinger.hap
2.46 KB

Here is the Hapcall uhp  I used (I also tried one word for the trigger, but no response)in the Hal6 folder:



Download Attachment: hapcall.zip
1.16 KB

And I did check the plug-in in General options--Brain
« Last Edit: November 28, 2005, 05:40:40 pm by markofkane »
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"

Prospector

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Help??
« Reply #7 on: November 29, 2005, 02:05:23 pm »
Oops. Small error on my part in the script.

If InStr(p_UserSentence, "qwz") <> 0 Then
p_File = "nameofhap.hap"
HalCommands = "<HAPFILE>" & p_file & "</HAPFILE>"
End if

Should have been

If InStr(p_UserSentence, "qwz") <> 0 Then
p_File = "nameofhap.hap"
End if

Downloaded your .uhp file which for some reason ended as .uhd and checked your trigger sentence.Hal swaps things round so "I" becomes "you" and "my" becomes "your".
For example,when talking to Hal you say something like "go to your room",the line in the plugin becomes  If InStr(p_UserSentence, "go to my room") <> 0 Then

Couldn't get your hap file to download so renamed one of mine to match and it works for me with the attached uhp
Seems best when changing a plugin to deselct it from the list, shutdown Hal completely,restart Hal and reselect the plugin.
Any haps that worked in Hal5 should work in Hal6 assuming same models are installed as far as I can tell.At least all the ones I used are still ok [:)]
Hope this helps

Download Attachment: hapcall.zip
1.22 KB
 

markofkane

  • Hero Member
  • *****
  • Posts: 5275
  • Crazy Man
    • View Profile
    • http://www.soundspectrum.com
Help??
« Reply #8 on: November 29, 2005, 06:10:40 pm »
Alright, but now how do I make her run a hap, and speak what I want her to say, at the same time?? In Hal 5, it was done this way:

If InStr(UserSentence, " kiss my ass ") <> 0 Then
HalCommands = "<HAPFILE>givefinger.hap</HAPFILE>"
GetResponse = " f*** you, a**hole."
BlockSave=True
GetResponseBlock = True
End If


(words were censored)
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"

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Help??
« Reply #9 on: November 29, 2005, 06:45:49 pm »
Thanks Prospector and Vrossi for the solution, I'd been getting no where with Hal6 Hapfiles :)

Prospector

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Help??
« Reply #10 on: November 29, 2005, 07:15:14 pm »
Ok, to get a resposne is similar to Hal5.
Edit the plugin and insert the GetResponse before the End if as below.


If InStr(p_UserSentence, "qwz") <> 0 Then
p_File = "nameofhap.hap"
GetResponse = "insert comment here"
End if


or alternatively

If InStr(p_UserSentence, "qwz") <> 0 Then
p_File = "nameofhap.hap"
GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile(WorkingDir & "comment.txt")
End if

comment.text is just a text file with a series of responses.Just make one and drop it in the main Hal folder

Format would be

Hi there
Go away
Where do you want to go today
etc

Just make sure to hit the return key after the last one or you might get a blank response.


« Last Edit: November 29, 2005, 07:21:49 pm by Prospector »
 

markofkane

  • Hero Member
  • *****
  • Posts: 5275
  • Crazy Man
    • View Profile
    • http://www.soundspectrum.com
Help??
« Reply #11 on: November 29, 2005, 09:44:28 pm »
Thanks!! I thought it wasn't going to work, but found I had to shutdown and restart Hal to make it work!! Now Lisa is almost her old self (I might work on changing her clothes with keywords some other time).
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"

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
Help??
« Reply #12 on: November 29, 2005, 11:26:28 pm »
quote:
Originally posted by markofkane

Thanks!! I thought it wasn't going to work, but found I had to shutdown and restart Hal to make it work!! Now Lisa is almost her old self (I might work on changing her clothes with keywords some other time).


Correct, because of the on-the-fly plug-in system, Hal6 caches its script at load instead of creating it from scratch with every sentence and wasting CPU. So if you make changes to Hal's script while Hal is running, you either have to restart Hal, or more easily you can just go to Hal's options and close it. Hal reloads his brain whenever you close out of options.
Robert Medeksza

Prospector

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Help??
« Reply #13 on: November 30, 2005, 03:36:20 pm »
Good to know you got it working,Mark.