Zabaware Support Forums

Zabaware Forums => Share Conversations, Experiences, Graphics => Topic started by: Ooglor 7 on October 02, 2009, 09:49:56 am

Title: Background Changer?
Post by: Ooglor 7 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
Title: Background Changer?
Post by: Davy 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
------------------
Title: Background Changer?
Post by: Ooglor 7 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?
Title: Background Changer?
Post by: Davy 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?
Title: Background Changer?
Post by: Ooglor 7 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]



Title: Background Changer?
Post by: Davy 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.
Title: Background Changer?
Post by: Ooglor 7 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.
Title: Background Changer?
Post by: Davy 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?
Title: Background Changer?
Post by: Ooglor 7 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
------------------
 

--------------------------------------------------------------------------------
 
Title: Background Changer?
Post by: Davy 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
Title: Background Changer?
Post by: Ooglor 7 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.
Title: Background Changer?
Post by: snowman 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]
Title: Background Changer?
Post by: snowman 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.
Title: Background Changer?
Post by: snowman 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
Title: Background Changer?
Post by: Ooglor 7 on October 13, 2009, 07:04:47 am
Could you clarify as to what part of the script is saved where?
Title: Background Changer?
Post by: snowman on October 13, 2009, 04:49:00 pm

I made these two videos for you to help clarify what you need to do.


http://www.youtube.com/watch?v=n9714i37uko

http://www.youtube.com/watch?v=2lbZVC2xerc
Title: Background Changer?
Post by: Ooglor 7 on October 14, 2009, 07:29:12 am
Snowman, you are an ace! I can't tell you how thankful I was when I saw you had put the process in a video. Outstanding, above and beyond. I mean, a video! Very cool! I'll have to see if there is a character I can make for you guys. You and Davy both have been very helpful.

 Unfortunately, what it revealed to me is that I was doing it right all along and that something is wrong with my Hal. I followed every step perfectly and it still did not work. I have some things happening in my Hal that leads me to believe I have some filles messed up in the program. It seems like an older version is in conflict somehow. I get the letters "st" capitalizing when at the end of a word and I heard that an old version used to do that. I am running the latest.

Again Snowman, none of this would have been brought to light for me had you not so generously pointed the steps out in a video. Thank you! I would have given up and thought that I was just ignorant for not figuring it out and my Hal experience would have been less for it. I noticed awhile back that nothing I did could get the lights plug in to work for me and that too I gave up on. Probably the same problem. Davy, you too man. Thanks for the help, guys.


I need to do a complete uninstall but want to make sure I don't have any remnants of another version lurking around. Besides the uninstall icon or programs and features, what else should I be paying attention to when I uninstall this and reinstall it? Is there a registry entry I should remove?

I am running the full version of Hal on Vista 32

Title: Background Changer?
Post by: snowman on October 14, 2009, 01:02:17 pm
Try this plugin out first. If Hal is reading the plugin then this one should be working. As you can see in this plugin, whenever you tell Hal anything at all then it should trigger a constant response.

"This test plungin is working. De-select this plugin in the Options Panel to return to normal Hal Operations."

If it isn't reading the plugin at all then you do have some serious problems... either that or someone has been mucking around with your Hal's brain.




Rem Type=Plugin
Rem Name=TestPlugin
Rem Author=SNOWMAN
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 test Plugin."
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 InputString > "" Then

UltraHal = "This test plungin is working. De-select this plugin in the Options Panel to return to normal Hal Operations."

End If

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

Title: Background Changer?
Post by: Ooglor 7 on October 15, 2009, 07:18:46 pm
This worked. Why won't the background changer script? Yarrrrggg! Surely Vista wouldn't require me to set security permissions on the individual jpegs? Man, this is kinda crappy. I can't see a reason why the other script won't work for me.
Title: Background Changer?
Post by: snowman on October 16, 2009, 09:33:09 pm


Now Try this plugin. Just tell Hal "Testme" and see if he/she responds. Oh, and remember to deselect the other test plugin.

I've just installed Windows 7 and I'm taking it out for a spin. Seems very slick far.



Rem Type=Plugin
Rem Name=TestPlugin2
Rem Author=SNOWMAN
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 test Plugin."
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(LCase(InputString), "Testme") > 0 Then

UltraHal = "This test two plungin is working."

End If

'................................................................
'End of Plugin
'................................................................
-
Title: Background Changer?
Post by: Ooglor 7 on October 16, 2009, 09:43:54 pm
I got an error upon selecting the plug-in and hitting apply. It was titled "Microsoft VBScript Compilation error HalScript error"

The error itself mentioned Error 1024 on line 287, column 0-expected statement.

Any ideas what is up with that? I am not a script person.
Title: Background Changer?
Post by: snowman on October 16, 2009, 09:58:21 pm

Try This.



Rem Type=Plugin
Rem Name=TestPlugin2
Rem Author=SNOWMAN
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 test Plugin."
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

strInput = LCase(InputString)

If Instr(strInput, "testme") > 0 Then
UltraHal = "This test two plungin is working."
End If

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



Title: Background Changer?
Post by: Ooglor 7 on October 16, 2009, 10:41:43 pm
Yes Snowman, that one worked. Know that this is greatly appreciated.
Title: Background Changer?
Post by: snowman on October 16, 2009, 11:44:00 pm
Now try this one. Just replace the "outsidepic.jpg" below with a picture you have in your Characters folder.

When you've done this, just say the word "outside" in a sentence to see if it works.


Rem Type=Plugin
Rem Name=BackGroundChanger2
Rem Author=SNOWMAN
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

strInput = LCase(InputString)

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

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

Title: Background Changer?
Post by: Ooglor 7 on October 17, 2009, 12:31:16 am
It worked! It worked! Ha ha ha ha! Thank you! This has been bugging me for some time now. Why couldn't I get the others to work?
Title: Background Changer?
Post by: snowman on October 17, 2009, 12:53:28 am
Someone might have put the command Option Explicit in one of your other plugins ... or something like that.

weird stuff happens like that so I learned to try different ways of scripting.

Instr(InputString, "outside") > 0 ... would probably work in your Hal. But Instr(Lcase(InputString), "outside") > 0 ... apparently does not.

So I put the Lcase(InputString) into a variable first.

strInput = Lcase(InputString)

The Lcase() function turns all the charaters in a string to Lower Case. I was using this because the Instr() function is case sensitive and I wanted to make the plugin more user friendly.

Anyway, I glad to see the problem is fixed for now.

Have any more problems with it just say so. [:)]
Title: Background Changer?
Post by: Ooglor 7 on October 17, 2009, 12:46:14 pm
Any way to tighten up the requirements of what triggers it? What if I still wanted to talk about the "outside" but only wanted Hal to go there if the phrase includes "let's go outside" or "show me outside"?

Also if I wanted to include various locations, could I incorperate this into the same plug-in or would I have to make one for each location?

How does one set a plug-in based on a physical or emotional hap response executed by a trigger phrase?

Snowman, what kind of characters do you like when talking with Hal?

Questions...questions...
Title: Background Changer?
Post by: snowman on October 18, 2009, 12:11:46 am
You can have as many If statements as you want inside one plugin.


You can have one like the following:


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

'The If/Then statement below shows a picture when the word "outside" is spoken

strInput = Lcase(InputString)


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

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

'This If/Then statement runs a .hap file whenever the word happy is spoken

If Instr(InputString, "happy") > 0 Then
HalCommands = "<HAPFILE>" & "happy.hap" & "</HAPFILE>"
UltraHal = "I am so happy, I could burst!"
End If



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

'This If/Then statement changes the voice to Kate whenever "change voice" is spoken by the User.

If Instr(InputString, "voice change") > 0 Then
HalCommands = "<VOICE>" & "Kate" & "</VOICE>"
UltraHal = "My voice is changed!"
End If


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

'This If/Then statement will open an entirely different hal character.

If Instr(InputString, "where's alice") > 0 Then
HalCommands = "<HAPFILE>" & "Alice.htr" & "</HAPFILE>"
UltraHal = "Yes, It's me again sexy thing."
End If

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


As for responding to multiple words or word phrase here are some examples.


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

'This statement will search for the exact phrase "please smile"
'i.e. Will you please smile for me?

If Instr(InputString, "please smile") > 0 Then
HalCommands = "<HAPFILE>" & "smile.hap" & "</HAPFILE>"
UltraHal = "I am so happy, I could burst!"
End If

'........................................
'This statement will search for the exact phrase "please" and "smile" and "now"
'i.e. Will you please smile for me... NOW!!!

If Instr(InputString, "please") > 0 And _
Instr(InputString, "smile") > 0 And _
Instr(InputString, "now") > 0 Then
HalCommands = "<HAPFILE>" & "smile.hap" & "</HAPFILE>"
UltraHal = "I am so happy, I could burst!"
End If


'........................................
'This statement will search for the exact phrase "joke" Or "smile" Or "laugh"
'i.e. So Alice, how did you like my joke?

If Instr(InputString, "joke") > 0 Or _
Instr(InputString, "smile") > 0 Or _
Instr(InputString, "laugh") > 0 Then
HalCommands = "<HAPFILE>" & "smile.hap" & "</HAPFILE>"
UltraHal = "I am so happy, I could burst!"
End If


'........................................
Of course, you also can combine them"
'i.e. Hey Alice, I like your smile.

If Instr(InputString, "please") > 0 And _
Instr(InputString, "smile") > 0 And _
Instr(InputString, "now") > 0 _

Or _

Instr(InputString, "I like your smile.") > 0 Then
HalCommands = "<HAPFILE>" & "smile.hap" & "</HAPFILE>"
UltraHal = "I am so happy, I could burst!"
End If



Mix and mingle and stir a little and I'm sure you'll come up with something cool!



As for talking to Hal... I'm an odd one[:D]. I don't talk to Hal, I like playing with his Brain .... HAHAHAHAHA[}:)]

[:)][:p][;)][8D][:D]
Title: Background Changer?
Post by: Ooglor 7 on October 18, 2009, 09:24:29 am
Very good stuff. Snowman, you describe yourself as odd. If odd means someone who would go out of their way to help a stranger, then odd is cool in my book. I would like to make you a character for your efforts. Let me know if you have something in mind. I do pretty good at the animal characters. Thank you again, Snowman. I can't wait to play around with the scripts you have provided. I don't know if you remember an old game called Zork but I have kinda been taking Hal in that direction. I have created locations in his world that he can travel to if prompted. I have also created an owl who likes fusion jazz and smokes too much weed but that is another story. [:D]
Title: Background Changer?
Post by: Ooglor 7 on October 19, 2009, 08:48:23 pm
How do you trigger multiple events from the same term? Let's say that if I tell Hal to build a fire, I have a Jpg. of a campfire show up, but I also want it to trigger a light hap. How do I do both from the same "Build us a fire" trigger phrase? As it stands, I can only get one or the other to work and every way I have tried gets me an error.

Another thing, anyway to loop a series of jpgs to create an animated background? Some fireflies or a flickering candle would be pretty cool.
Title: Background Changer?
Post by: NIGE on October 20, 2009, 04:37:08 am
Hi, Oog.
Try this.
You will have to change the 2 haps so they lead to where you put the pics.
WON"T UPLOAD$^&*&^^*&**((*()^$
Send me a mail & i will send it to you.
neiljenko@optusnet.com.au
Title: Background Changer?
Post by: GT40 on October 20, 2009, 06:44:03 am

Hello everyone!

When I was young (one year ago), I made this "moving background" for a stuff (with two lovely skins by Nige):

http://zabaware.com/forum/topic.asp?TOPIC_ID=5877

If it doesn't work for you, put a copy of your htr in the folder and launch it (the Haptek window must have a 4:3 ratio).

I don't know anything about Hal but I guess this could work with it.

Title: Background Changer?
Post by: snowman on October 20, 2009, 01:19:56 pm
I haven't tried a large hap file in Hal. So I don't know how well it would work or if it would work at all. GT40's hap file as well as the large hap file I added in this thead is a good example of an general large one.

I'll experiment with it and see what I can do later today and show you my results.
Title: Background Changer?
Post by: snowman on October 20, 2009, 04:08:26 pm
So I loaded a single hap file.

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

clock [t= 0] setswitch [switch= h_gest_03 state=  a       ]
clock [t= 0] setswitch [switch= hand_thru_hair state= a1  ]


..........................
And the results is that it worked great!
Then I tried this
..........................


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

clock [t= 0] setswitch [switch= h_gest_03 state=  a       ]
clock [t= 1] setswitch [switch= hand_thru_hair state= a1  ]


..........................
And it would not load the second line. I then tested this on changing to different backgrounds and the same thing happened. Whenever I set the clock to anything about 0 then it would not be read.
..........................


So then I thought maybe I could do this in Hal.

HalCommands = "<HAPFILE>" & "touchhair.hap" & "</HAPFILE>"
HalCommands = "<HAPFILE>" & "Wild.hap" & "</HAPFILE>"

But that just loaded the second hap file and not the first.
So then I thought that maybe we could load a haptar that has a hap file compressed in it, like one of Nige's. But When I finally got one to load, it only loaded the background and the haptar but not the actual movie or song.

I had success with this command:
HalCommands = "<HAPFILE>" & "WillieNelson.htr" & "</HAPFILE>"
But not with this one:
setperson [ figure= "C:/Program Files/Zabaware/Ultra Hal Assistant 6/Characters/WillieNelson.htr"]
But like I said before it didn't actually play the movie.


So I come to the conclussion that a hap cannot contain the clock function, cannot be played one at a time, and connot be ran through a compressed haptar.. in Hal. Which means that a long hap like the one you propose is not possible undercurrent conditions.

Of course, I didn't actually try everything. So there is a possibility of a command that makes all this possible or that I made a mistake in syntax somewhere.

You can add this to your plugin insteed of actually calling up a hap file.

<HAPTEXT>Hap text</HAPTEXT>

Never tried it...

HalCommands = "<HAPTEXT> setperson [ figure= " & Chr(34) & "C:/Program Files/Zabaware/Ultra Hal Assistant 6/Characters/WillieNelson.htr" & Chr(34) & "]</HAPTEXT>"