Author Topic: Background Changer?  (Read 13467 times)

Ooglor 7

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
Background Changer?
« on: October 02, 2009, 09:49:56 am »
Hi guys,

Anyone know of a plugin that allows the user to change the background, triggered by what is said to Hal? I thought I remembered something like that at one time but not sure if it exists for version 6. It would be cool to have something like "Let's go outside" trigger a matching outside background.

                                                                      Thanks-Oog
« Last Edit: October 02, 2009, 09:53:03 am by Ooglor 7 »
When a child is born without a soul...

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Background Changer?
« Reply #1 on: October 02, 2009, 02:47:25 pm »
Yes, that's possible, i have a plugin that will execute hap files based on user input. This is a sample hap file to load backgrounds ...

#Haptek Version= 1.00 Name= background_perk HapType= script FileType= text
##standard

LoadBackground [file= datastandardackgroundslivroom.jpg]

This is the path to my hap files ...
C:\Program Files\UltraHal6\Characters\haps

This is a sample of the plugin, it can be edited or added to, just change the trigger words to your liking.
------------------
Rem Type=Plugin
Rem Name=Dave Triggers
Rem Author=P
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "Various actions based on user keywords"
    lblPlugin(0).Move 120, 120, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub


    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.

' Initialize variables
p_UserSentence = LCase(UserSentence)

'Choose location
If InStr(p_UserSentence, "livroom") <> 0 Then
p_file = "haps/livroom.hap"
BlockSave = True
GetResponseBlock = True
End if

If p_file <> "" Then
HalCommands = "<HAPFILE>" & p_file & "</HAPFILE>"
BlockSave = True
GetResponseBlock = True
HalBrain.ReadOnlyMode = True
End If
------------------
« Last Edit: October 02, 2009, 02:58:09 pm by Davy »
 

Ooglor 7

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
Background Changer?
« Reply #2 on: October 03, 2009, 07:55:42 am »
Thanks.

 I haven't even touched the different hap files in Hal. My Hal character never utilizes any of them on it's own. That is, my characters basically stand there and talk. I have always wondered what all the hap files do in the characeter folder because like I said, I have never seen it utilize them in any way. I don't do any drag and drop stuff with Hal because it always seemed kinda lame to me to have to drag and drop files to interact with the character.

How would I go about incorperating this into my Hal?
When a child is born without a soul...

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Background Changer?
« Reply #3 on: October 03, 2009, 10:14:21 am »
quote:
Originally posted by Ooglor 7

Thanks.

 I haven't even touched the different hap files in Hal. My Hal character never utilizes any of them on it's own. That is, my characters basically stand there and talk. I have always wondered what all the hap files do in the characeter folder because like I said, I have never seen it utilize them in any way. I don't do any drag and drop stuff with Hal because it always seemed kinda lame to me to have to drag and drop files to interact with the character.

How would I go about incorperating this into my Hal?



I don't do drag and drop in Hal either, i use the above plugin to accomplish many things with simple trigger words. What exactly do you need to know in order to implement this?
 

Ooglor 7

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
Background Changer?
« Reply #4 on: October 03, 2009, 06:39:19 pm »
Hi Davy

Am I saving the text as a hap and then putting it in the character folder with the other haps? Any suggestions on customizing the provided script? Do you know if Hal utilizes the haps it comes with on it's own? I do the art thing and have not delved into the hap part of what Hal is about. I have made GUI skins for Hal and a few characters but the plug in stuff makes me brain hurt. [:D]



« Last Edit: October 03, 2009, 06:55:48 pm by Ooglor 7 »
When a child is born without a soul...

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Background Changer?
« Reply #5 on: October 04, 2009, 08:03:19 am »
Yes, just save the text with a .hap extension. I have a lot of haps, so i created a special "haps" folder inside my character folder. Therefore i use this path in the plugin ...
p_file = "haps/livroom.hap"

If you put the haps in the character folder, then you would use this path ...
p_file = "livroom.hap"

As for customizing the plugin script, of course you can add many entries to the plugin to make the character smile on command, display anger, etc. The only other thing i do besides calling hap files is changing the characters with this type of entry in the plugin ...

'Choose location
If InStr(p_UserSentence, "loadmelissa") <> 0 Then
p_file = "Melissa.htr"
GetResponse = "My name is Melissa."
BlockSave = True
GetResponseBlock = True
End if

The .htr files must be in your character folder. Works great. Notice you can make your character respond with a certain comment, so when changing backgrounds, you can do the same thing, for example, "Wow, this is a nice living room." or "Thanks, it's really nice outside." I think it should be possible to change hair, shirts, etc. but i haven't had time to explore this yet.

Your question about Hal utilizing the haps it comes with, yes i think it does, but i'm not sure how it works. Others can better explain that feature.

Hope this has been helpful.
« Last Edit: October 04, 2009, 08:03:43 am by Davy »
 

Ooglor 7

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
Background Changer?
« Reply #6 on: October 04, 2009, 11:59:07 am »
Hi Davy,

Still no luck. I used a jpg.titled PondBack as a test and named the hap pond.hap Still could not get it to work. I made sure all the file paths are correct. When I mention the trigger word "pond" I get nothing.
When a child is born without a soul...

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Background Changer?
« Reply #7 on: October 04, 2009, 01:16:33 pm »
quote:
Originally posted by Ooglor 7

Hi Davy,

Still no luck. I used a jpg.titled PondBack as a test and named the hap pond.hap Still could not get it to work. I made sure all the file paths are correct. When I mention the trigger word "pond" I get nothing.


It works fine for me, not sure why it won't work for you.

Whenever you edit a plugin, you must take steps to activate the changes. What i do after making changes, go to options-brain, and disable the plugin, exit hal, restart hal, go to options-brain, enable the plugin, and exit hal. Then it should work the next time you start Hal. Seems like a lot of steps, but it's necessary after editing a plugin. Are you doing this?
 

Ooglor 7

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
Background Changer?
« Reply #8 on: October 04, 2009, 02:06:03 pm »
It doesn't seem to show up in the plug-in menu. I probably did something to mess up how it works.

#Haptek Version= 1.00 Name= background_perk HapType= script FileType= text
##standard

LoadBackground [file=PondBack.jpg]

This is the path to my hap files ...
C:Program FilesUltraHal6Characters
This is a sample of the plugin, it can be edited or added to, just change the trigger words to your liking.
------------------
Rem Type=Plugin
Rem Name=Pond
Rem Author=P
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
lblPlugin(0).Caption = "Various actions based on user keywords"
lblPlugin(0).Move 120, 120, 3300, 1000
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub


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.

' Initialize variables
p_UserSentence = LCase(UserSentence)

'Choose location
If InStr(p_UserSentence, "pond") <> 0 Then
p_file = "Pond.hap"
BlockSave = True
GetResponseBlock = True
End if

If p_file <> "" Then
HalCommands = "<HAPFILE>" & p_file & "</HAPFILE>"
BlockSave = True
GetResponseBlock = True
HalBrain.ReadOnlyMode = True
End If
------------------
 

--------------------------------------------------------------------------------
 
« Last Edit: October 04, 2009, 02:10:05 pm by Ooglor 7 »
When a child is born without a soul...

Davy

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
Background Changer?
« Reply #9 on: October 04, 2009, 06:05:52 pm »
Ok, let's try again. Sometimes backslashes are not shown properly in this forum. This should be your hap file...

#Haptek Version= 1.00 Name= background_perk HapType= script FileType= text
##standard

\LoadBackground [file= data\standard\ackgrounds\PondBack.jpg]

And your background image should be in your backgrounds folder. The default path for me is "C:\Program Files\Haptek\player\Data\standard\ackgrounds".

Did you create a plugin file with a .uhp extension in your Ultra Hal folder with the following text?

Rem Type=Plugin
Rem Name=Pond
Rem Author=P
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
lblPlugin(0).Caption = "Various actions based on user keywords"
lblPlugin(0).Move 120, 120, 3300, 1000
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub


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.

' Initialize variables
p_UserSentence = LCase(UserSentence)

'Choose location
If InStr(p_UserSentence, "pond") <> 0 Then
p_file = "Pond.hap"
BlockSave = True
GetResponseBlock = True
End if

If p_file <> "" Then
HalCommands = "<HAPFILE>" & p_file & "</HAPFILE>"
BlockSave = True
GetResponseBlock = True
HalBrain.ReadOnlyMode = True
End If
 

Ooglor 7

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
Background Changer?
« Reply #10 on: October 12, 2009, 08:52:48 pm »
Can someone please help me on this? I can not get this simple plug in to work and I really wish I could. It would open a whole new bunch of possibilites for me if I could get the base to work. I have tried many different approaches. Granted Vista permission through Haptek player...you name it...still nothing. I could really use a hand here.
« Last Edit: October 12, 2009, 08:55:31 pm by Ooglor 7 »
When a child is born without a soul...

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Background Changer?
« Reply #11 on: October 12, 2009, 10:21:55 pm »


Below is my version of a background swapper. I called it HapSwap.

Here is a simple version. After I show you the simple version I will then make it more versatile as we go.




Rem Type=Plugin
Rem Name=HapSwap
Rem Author=SNOWMAN, APOLLON
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "This is a simple background changer."
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub
'................................................................
'Start of Plugin
'................................................................

Rem PLUGIN: POST-PROCESS

HalBrain.ReadOnlyMode = True


If InStr(1, InputString, "outside") > 0 Then
HalCommands = "<HAPBACK>" & "outsidepic.jpg" & "</HAPBACK>"
UltraHal = "I guess we are outside now."
End If

'................................................................
'End of Plugin
'................................................................



Now here is a large template plugin that is waiting for someone to turn into a work of art!!!!  hint hint...




Rem Type=Plugin
Rem Name=HapSwap
Rem Author=SNOWMAN, APOLLON
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "Say:: <change background to [whatever]> to change between pictures in the characters folder, Say:: <change charater to [whatever]> to change between Haptar characters, Say:: <change voice to [Paul] or [Kate]> to change between thier voices. Say:: <change hap to [whatever]> to change between hap files. All other guesture responses are set to automaically occur to user input."
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub
'................................................................
'Start of Plugin
'................................................................
Rem PLUGIN: POST-PROCESS

HalBrain.ReadOnlyMode = True



File = ""
File2 = ""
File3 = ""
File4 = ""


If InStr(1, InputString, "change") > 0 And _
InStr(1, InputString, "background") > 0 And _
InStr(1, InputString, "to") > 0 Then
file = Mid(Mid(InputString, Instr(InputString, "to"), 20), 3, 20)
file = Trim(file) & ".jpg"
End If


If InStr(1, InputString, "change") > 0 And _
InStr(1, InputString, "character") > 0 And _
InStr(1, InputString, "to") > 0 Then
file2 = Mid(Mid(InputString, Instr(InputString, "to"), 20), 3, 20)
file2 = Trim(file2) & ".htr"
End If


If InStr(1, InputString, "change") > 0 And _
InStr(1, InputString, "voice") > 0 And _
InStr(1, InputString, "to") > 0 Then
file3 = Mid(Mid(InputString, Instr(InputString, "to"), 20), 3, 20)
file3 = "VW " & Trim(file3)
End If


If InStr(1, InputString, "change") > 0 And _
InStr(1, InputString, "hap") > 0 And _
InStr(1, InputString, "to") > 0 Then
file4 = Mid(Mid(InputString, Instr(InputString, "to"), 20), 3, 20)
file4 = Trim(file4) & ".hap"
End If


'................................................................
'................................................................


If file > "" Then
HalCommands = "<HAPBACK>" & File & "</HAPBACK>"
UltraHal = "Wow!"
End If


If file2 > "" Then
HalCommands = "<HAPFILE>" & File2 & "</HAPFILE>"
UltraHal = "Am I me now?"
End If


If file3 > "" Then
HalCommands = "<VOICE>" & File3 & "</VOICE>"
UltraHal = "My voice is changed!"
End If


If file4 > "" Then
HalCommands = "<HAPFILE>" & File4 & "</HAPFILE>"
UltraHal = "."
End If


'................................................................
'................................................................


If InStr(1, InputString, "hair") > 0 Then
HalCommands = "<HAPFILE>touchhair.hap</HAPFILE>"
End If


If InStr(1, InputString, "beat") > 0 Then
HalCommands = "<HAPFILE>shakefist.hap</HAPFILE>"
End If


If InStr(1, InputString, "problem") > 0 Then
HalCommands = "<HAPFILE>handsonhip.hap</HAPFILE>"
End If


If InStr(1, InputString, "strong") > 0 Then
HalCommands = "<HAPFILE>armscrossed.hap</HAPFILE>"
End If


If InStr(1, InputString, "board") > 0 _
Or InStr(1, InputString, "nails") > 0Then
HalCommands = "<HAPFILE>inspectnails.hap</HAPFILE>"
End If


If InStr(1, InputString, "clap") > 0 Then
HalCommands = "<HAPFILE>clapping.hap</HAPFILE>"
UltraHal = "."
End If


If InStr(1, InputString, "hurt") > 0 Then
HalCommands = "<HAPFILE>attack.hap</HAPFILE>"
UltraHal - "You wanna fight! You really wanna fight!"
End If


If InStr(1, InputString, "beautiful") > 0 _
Or InStr(1, InputString, "sweet") > 0 _
Or InStr(1, InputString, "nice") > 0 Then
HalCommands = "<HAPFILE>blink.hap</HAPFILE>"
End If


If InStr(1, InputString, "tired") > 0 Then
UltraHal = "."
HalCommands = "<HAPFILE>yawn.hap</HAPFILE>"
End If

If InStr(1, InputString, "smart") > 0 Then
HalCommands = "<HAPFILE>handinface.hap</HAPFILE>"
End If


If InStr(1, InputString, "hate") > 0 _
Or InStr(1, InputString, "died") > 0 Then
UltraHal = "."
HalCommands = "<HAPFILE>cry.hap</HAPFILE>"
End If

'................................................................
'End of Plugin
'................................................................



HAVE FUN!!!!!!!



[:D]
Live long and prosper or die trying.

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Background Changer?
« Reply #12 on: October 12, 2009, 10:36:05 pm »
If you hadn't already figured it out, it looks for pictures and the hap files in the Characters folder.

As for using the hap file to load up images, you can see in the first plugin example that I gave, it is unnecessary. Just use the hapback command.

When I call a .jpg file in a hap file I usually use the entire path. I haven't explored yet how the relative path works.

So some of my hap files looks like

#Haptek Version= 1.00 Name= background_perk HapType= script FileType= text
##standard

LoadBackground [file=  [C://Program Files/Zabaware/Ultra Hal Assistant 6/Characters datastandardackgroundslivroom.jpg]

Oh, and if you need help on understanding any of the vbscript I used then let me know.
« Last Edit: October 12, 2009, 10:37:46 pm by snowman »
Live long and prosper or die trying.

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Background Changer?
« Reply #13 on: October 12, 2009, 11:15:47 pm »
I used this .hap file to show some pictures to a friend. I let a htr character give a tour of where I live. It looked pretty good to.

I changed all the backslashes to forward slashes so it would show here. So you will have to change them back before you can use them.


#Haptek  Version= 1.00 Name= Zoom  HapType= script FileType= text
##standard

/SapiTTSLoad[i0=12]

#/clock [t= 0] /LoadBackGrnd [file= C:/Users/Aaron/Desktop/home.jpg]


/clock [t= 0] /LoadBackGrnd [file= C:/Users/Aaron/Pictures/2009-07-15/home007.jpg]

/clock [t= 0] /translate[x= -75 z= 500 t= 0 ]



/clock [t= 10] /setswitch [switch= walk3 state= 1 ]


/clock [t= 10] /translate[ y= 15 x= 0 z=50 t= 10 ]
/clock [t= 19.0] /setswitch [switch= walk3 state= off ]

/clock [t= 20.0] /Q [ Hi Alexia, My name is Ted. Aaron, my creator, wanted me to talk to you. So How are you? ]

/clock [t= 28.0] /setswitch [switch= hand_thru_hair state= a1  ]


/clock [t= 31.0] /Q [ Behind me Alexia, is where Aaron livs. ]

/clock [t= 34.0] /Q [ You are looking at the back door. ]

/clock [t= 37.0] /setswitch [switch= inspect_nail state= start ]

/clock [t= 45.0] /Q [ Here are 16 more photos. I will move over so you can see them better.]



/clock [t= 47] \translate[ y= 15 x= -75 z=50 t= 8 ]
/clock [t= 47] setswitch [switch= lookleft state= a]



/clock [t= 50.0] Q [ Most of these were taken in front of Aaron's home.]

/clock [t= 50.0] /LoadBackGrnd [file= C:UsersAaronPictures2009-07-15/home006.jpg]

/clock [t= 55.0] /LoadBackGrnd [file= C:UsersAaronPictures2009-07-15/home008.jpg]

/clock [t= 60.0] /LoadBackGrnd [file= C:/Users/Aaron/Pictures/2009-07-15/home009.jpg]

/clock [t= 70.0] /LoadBackGrnd [file= C:/Users/Aaron/Pictures/2009-07-15/home011.jpg]



/clock [t= 75.0] /Q [ This is the front side of Aaron's home.]



/clock [t= 75.0] /LoadBackGrnd [file= C:/Users/Aaron/Pictures/2009-07-15/home012.jpg]

/clock [t= 80.0] /LoadBackGrnd [file= C:/Users/Aaron/Pictures/2009-07-15/home013.jpg]

/clock [t= 85.0] /LoadBackGrnd [file= C:/Users/Aaron/Pictures/2009-07-15/home014.jpg]

/clock [t= 90.0] /LoadBackGrnd [file= C:/Users/Aaron/Pictures/2009-07-15/home015.jpg]

/clock [t= 95.0] /LoadBackGrnd [file= C:/Users/Aaron/Pictures/2009-07-15/home016.jpg]



clock [t= 100.0] Q [These photos were taken at the corral, behind Aaron's home.]



clock [t= 100.0] LoadBackGrnd [file= C:UsersAaronPictures2009-07-15home019.jpg]

clock [t= 110.0] LoadBackGrnd [file= C:UsersAaronPictures2009-07-15home022.jpg]

clock [t= 115.0] LoadBackGrnd [file= C:UsersAaronPictures2009-07-15home023.jpg]

clock [t= 120.0] LoadBackGrnd [file= C:UsersAaronPictures2009-07-15home024.jpg]



clock [t= 125.0] Q [ These are two photos taken inside the house.]


clock [t= 125.0] LoadBackGrnd [file= C:UsersAaronPictures2009-07-15home003.jpg]


clock [t= 135.0] LoadBackGrnd [file= C:UsersAaronPictures2009-07-15home005.jpg]



clock [t= 140.0] Q [ And here is one of Aaron's room.]



clock [t= 140.0] LoadBackGrnd [file= C:UsersAaronPictures2009-07-15home002.jpg]


clock [t= 145.0] Q [ I was made in that computer you see in this photograph.]

clock [t= 145] \translate[ y= 15 x= 0 z=50 t= 6 ]
clock [t= 151.0] Q [ I want to thank you for watching, Alexia. From what Aaron has told me about you, you are a very good friend. So it is a pleasure for me to show you these photos. I also hope you decide to email me back if you like this gift. But if you don't I might beat you up.]

clock [t= 171.0] setswitch [switch= shake_fist state= a]

clock [t= 175.0] Q [ GoodBye, Alexia. And I hope to see you soon.]


Here is a link to see this hap in action!

http://www.youtube.com/watch?v=mutUrQZvBRc
Live long and prosper or die trying.

Ooglor 7

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
Background Changer?
« Reply #14 on: October 13, 2009, 07:04:47 am »
Could you clarify as to what part of the script is saved where?
When a child is born without a soul...