:zdg_sermon You don't need to understand it all to be able to make this work, but if you don't want to risk losing anything you have done already then MAKE BACKUPS.
Here's some cut and paste script that will make Hal change into different clothes.
This was written for HAL v5 with the XTF brain running one of the fullbody figures, but can be used on other set ups in Hal 5. You'll probably need to view this page at 1024 x 768 to see it properly as there are some long lines that might get split.
Steps:
1) Get some skins for the fullbody - I used the ones here in the skin section : matrixs1, matrix4,killbill80,redracer80 and greyracer80.
2) Download custom brain files - CLZwardrobe.brn, CLZcomment.brn, CLZchange.brn (attached below).
3) Copy the brain files into the Zabaware DefBrain folder or whatever brain folder you are using.
4) Run the Brain editor program and open the brain you are using [squelch]. At the top of the brain script find the menu lists. Paste the following code at the bottom of the menu lists and before the 'MenuEnd' line so you will be able to add any finer details later in the brain editor :
'Menu=SubMenu;HAL's Clothes;SubMenu;SubMenu
'Menu=CLZwardrobe.brn;Wardrobe;Keywords and files. Put skins in The Haptek Skins folder.;QABrain
'Menu=CLZcomment.brn;Comments on particular things about clothes. ;QABrain
'Menu=CLZchange.brn;short responses on a clothes change;SentenceList
note: If later, you find the wardrobe brain won't open in the editor then use a text editor to alter it instead - I use Crimson Editor, perfect for doing a lot of things at once.
5) In the XFT brain, find these lines of script at around line 280...
'Start DebugInfo with header.
DebugInfo = "Debug Information:" & VbCrLf
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x...paste in the script below after it. If you're using another brain it should be fine just after the Function GetResponse line as well.
Heres ze Script:
'888 ~~~~~~~~~~~~~~~~~~~~Haptek Stuff.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~888
'888 Haptek skin changing aka Hal's Wardrobe!
'888 This will change a Haptek figure's skin and was meant for
'888 use with fullbodygirl.htr and the skins people have made for her.
'888 Though you can change the skins on any of the haptek models
'888 so it doesn't stop you using it to change another's appearance.
'variables;
If ScriptBlock <> False Then ScriptBlock = False
If CLZfile <> "" Then CLZfile = ""
If CLZtrap <> False Then CLZtrap = False
If CLZcomment <> "" Then CLZcomment = ""
If CLZcomment2 <> "" Then CLZcomment2 = ""
'find keywords;
If InStr(UserSentence, " dress ") <> 0 Then CLZtrap = True
If InStr(UserSentence, " wear ") <> 0 Then CLZtrap = True
'if match then search the brain for relevant items;
If CLZtrap = True Then
CLZfile = HalBrain.QABrain(UserSentence, WorkingDir & "CLZwardrobe.brn", CLZBrainRel)
'check relevance scores of skin and comments;
If CLZBrainRel >= 18 Then
CLZcomment = HalBrain.ChooseSentenceFromFile(WorkingDir & "CLZchange.brn")
CLZcomment2 = HalBrain.QABrain(UserSentence,WorkingDir & "CLZcomment.brn", CLZBrainRelB)
If CLZBrainRelB > 18 Then
CLZcomment = CLZcomment & CLZcomment2
End If
GetResponse = CLZcomment
BlockSave = True
GetResponseBlock = True
'send the skin file to the Player;
HalCommands = HalCommands & "<HAPTEXT>" & "\settexture[tex= [data/standard/skins/" & CLZfile & ".jpg]]" & "</HAPTEXT>"
ScriptBlock = True
End If
End If
'888
'888
'888~~~~~~~~~~~~~~~~~~~~~ End of 888's stuff~~~~~~~~~~~~~~~~~~~~~~~~~~~~888
:zdg_huh Some workings and technical mumbo jumbo:
ScriptBlock : is a flag introduced to control the running of hap files, as often I only had luck with one being processed on each call of GetResponse. As I was also interacting with the Player (via HalCommands) elsewhere in my brain script, using this flag means I can prevent multiple hap file calls. So where I would prefer others to get the one chance I allow, I check or set it as needed. 'True' Signifies a 'HalCommands' has been set (ie. in this case it is sending a hap command to the Player) .
NOTE: if Hal is talking it also prevents hap files working properly sometimes. These clothes changing routines should not interfere with the usual running of Hal in an unmodifed XTF brain but
if you modify the brain with further HalCommands then be aware of this flag and how it is working. You may find the need to remove or alter the way it works, but at the time of writing it is my method for overcoming the problem of hap file overflows*
CLZwardrobe.brn : is a brain file holding all the skin filenames (minus the .jpg extension) , along with relevent words you want Hal to recognise for that skin.
I have set the default path for where the skins are as: C:\Program Files\Haptek\player\data\standard\Skins folder.
So the skins themselves need to be in there. If no "Skins" folder exists just create one in the 'standard' folder. This is where most people store character skins.
CLZcomment.brn : is a brain file holding a few comments Hal can make randomly on changing skins.
CLZcomment2.brn : is a brain file holding comments that relate to certain clothes or details that you would like Hal to comment about.? So you can fill up CLZcomment.brn with whatever kind of response you want expressed to give Hal some likes and dislikes. eg, say you ask Hal to "Wear something Green", you could set some replys like "I hate green.", "Hmmm, green's my favourite colour."
On Relevance & matches : I left making any comment on no matches as the user will probably know what skins there are, so on odd occassions where it picks out 'wear' it will probably be unrelated and score less than 18 on a relevance match. Being poor that will be passed on, without any changes. I set a good relevance score as 18 or more which works quite well, for more skins you'll probably need a higher level.
Play around with the trigger words in the wardrobe brain till you get it working how you want. The way it is, Hal will accept things like "wear something for outdoors", "wear the matrix catsuit with sleeves" and you can use shorter trigger sentences to accept simpler things like "wear matrix", but that might well get accepted anyway.
*Note: you might be able to run multiple haptext commands by stringing them together as one whole HalCommand - I have found the player can handle (at least some) a string of commands seperated by '%' :
eg, /translate[blah blah]%/rotate[blah blah]
can in its entirity be processed by the player.
Update: You can infact string HalCommands together in brain script by using it like this:
HalCommands = HalCommands & <HAPTEXT> & some haptek script & </HAPTEXT>
That will add a further line of code to the list of commands be sent to the Haptek Player. Same thing works for <HAPFILE>. I've ammended the code so this mod will not affect other routines calling HalCommands, but will instead add to the list to be processed.