Making simple skin changes in Ultra Hal, for the complete Beginner.
This question is raised more regularly than a pint of beer in Mr happy's happy pub during happy hour, so here goes!
To do this you need to edit Hal's brain file, so if you haven't already, I suggest reading the help on Hal's brain editor, available at Zabaware in the 'Plugins' section, but to proceed this isn't necessary.
Again this tutorial uses the demo fullbodyGirl as an example and assumes you have the fullBodygirl in place as one of your characters in UltraHal.

First a bit of Background...
Hal recognises words to trigger actions and responses. You type in your sentence,
Hal has a look at it and then a response is triggered. We can get Hal to respond to our own trigger words too by editing the brain file. This isn't particularly hard, just
don't alter anything you are unsure of, unless you know what you're doing of course!
There is a certain order that Hal operates in to be able to do the things Hal does, but
for the purpose of this change we can add lines at the very beginning of the main function called 'GetResponse', which is essentially Hal's brain.

So firstly, go to the Hal menu and select the 'brain editor'. I'll use the Default brain as
an example, so choose 'Load Existing Project' and then load the
'hal5.uhp<UltraHal 5.0 Default Brain>'
Scroll down to around Line 121, you will see the beginning of 'Function GetResponse' like so:

This is where we will put our code. What you see is the VBasic script, to which we
will add the following lines, AFTER the Function GetResponse.
If InStr(UserSentence, "wear the red catsuit") > 0 Then
GetResponse = "I have changed into my red catsuit <username>, how'd I look?"
HalCommands = "<HAPFILE>" & "redcatsuit.hap" & "</HAPFILE>" BlockSave=True
GetResponseBlock = True End If It should now look like this:

This short piece of code is triggered when the user enters 'wear the red catsuit' into
Hal within a sentence. Note that it has to be precisely this, but can be within a fuller sentence as long as it matches.
When Hal sees this, Hal then gives you a response and runs the HAP file, so that the
skin is changed. You can edit the trigger words and response as you wish...eg "wear something red", and you can also add further triggers for the same skin.
Okay, save your new brain and exit the Brain editor.

The next step is to get your HAP file into a place where Hal can use it. In the previous tutorial we made the 'redcatsuit.hap'. We'll use that again here, and I will
assume you have placed the 'redcatsuit.jpg' in the new skins folder of the Haptek directory. First find the folder in Ultra Hal 5's directory named 'Characters':
Your folder may differ to the above, but we're only interested in the 'Characters' folder. Open this folder and you will see a lot of other HAP files that Hal uses.
Copy your HAP file into this folder where Hal will be able to use it...
Next, to be sure we're using the right brain, ie the one you changed, so use the
general options menu and get Hal to use the 'hal5.uhp<UltraHal 5.0 Default Brain>'.
That's the end of the coding, now we just need to test it all works. So run Hal with
the fullBodygirl and tell her 'can you wear the red catsuit please', she should now change her clothes and tell you all about it.

Similarly to editing the HAP file, you can edit this script to recognise a 'blue catsuit'
and place the extra lines after or before this addition in the program. Add the new lines of script for each item of clothing.
eg
If InStr(UserSentence, "wear the blue catsuit") > 0 Then GetResponse = "I have changed into my blue catsuit <username>, how'd I look?"
HalCommands = "<HAPFILE>" & "bluecatsuit.hap" & "</HAPFILE>" BlockSave=True
GetResponseBlock = True End If
note; by placing <username> in the quotes, Hal automatically inserts whatever
username you are using into the response. This can be removed if you wish.
Ultra Hal is the great ChatBot made by Zabaware software. |
|