UltraHal Script: Changing clothes.

  • 9 Replies
  • 7907 Views
*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
UltraHal Script: Changing clothes.
« on: October 07, 2005, 05:16:41 pm »
 :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 :

Code
'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:

Code
'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. 
« Last Edit: March 26, 2007, 05:37:34 pm by Freddy »

*

Carl2

  • Trusty Member
  • ********
  • Replicant
  • *
  • 560
Re: UltraHal Script: Changing clothes.
« Reply #1 on: October 12, 2005, 01:50:24 am »
Freddy,
  Just downloaded the file and copied the text,  I used the link and went to the home page earlier, Posted in Haptek fullbody, Logged in earlier and the link brought me here this time.  What you posted looks good so far, I've alredy set a trigger word in the emotions brain to load skins, this should work much better keeping the items seperate. 
  Anyways I have to load skins differently, I'm using XP (details in Haptek fullbody) also Hals not on Drive C.  I'll probably have to make changes in the paths.  I do appreciate your work, next is triggering the anim_.Haps and getting Hals input to trigger.
  Again thanks for all the work you've put in this.
Carl2
 

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: UltraHal Script: Changing clothes.
« Reply #2 on: October 12, 2005, 07:32:00 pm »
No problem, glad you found it useful. You could use the same kind of method to get hal doing a lot of other things too, eg, instead of changing skins you could set up a similar routine to call hap files instead :)
« Last Edit: December 29, 2005, 05:51:25 pm by Freddy »

*

Carl2

  • Trusty Member
  • ********
  • Replicant
  • *
  • 560
Re: UltraHal Script: Changing clothes.
« Reply #3 on: October 13, 2005, 02:37:25 pm »
Freddy,
  I'm also trying to trigger from Hal, I tried using a Halsent which after talking to hal for a while caused an error message, too many files.  Also If I move the scripting to the bottom after the code and decode the brain stops working,  I really liked your throughness in explaining things, never knew you could change the menu, but I have thought about it.
Carl2

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: UltraHal Script: Changing clothes.
« Reply #4 on: October 13, 2005, 04:59:45 pm »
Well, if it's any consolation the problems you are finding are the same kind of ones I had when I first started making changes.  It's a learning curve, once you know yourself what works and what doesn't it helps you in the long run.  The menu thing is useful, but another way of editing everything is to use some thing like Crimson editor - with this code editor you can have .brn files, hal brains and and haps all open at once.  You can swap between files using tabs, sometimes i find it easier than using the brain editor because it means you can also see hapfiles and edit them too at the same time.

Try it out: http://www.crimsoneditor.com/

If you want anything big compiled then you would still need to use the brain editor though.

 :)


*

n2wxb

  • Guest
Re: UltraHal Script: Changing clothes.
« Reply #5 on: October 14, 2005, 06:45:52 am »
Hey freddy,Thanks,  thats really Cool!  sandy looks great all the time now.  Now all I need is to increase her sentence output length. I have created an Adult brain, but she never finishes her stories. I'd like to post it, but I don't think a forum, where minors could reach it, is the right place to post it. Anyways , thanks! and Salute!

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: UltraHal Script: Changing clothes.
« Reply #6 on: October 15, 2005, 06:15:32 pm »
No problem  :)

*

Carl2

  • Trusty Member
  • ********
  • Replicant
  • *
  • 560
Re: UltraHal Script: Changing clothes.
« Reply #7 on: October 16, 2005, 07:42:48 pm »
Freddy,
  I just found the time to change the brn file, CLZwadrobe, I put in skimpyshirtLN   WEAR THE LOW NEDKLINE  ,  my frist try also included just changing the path in the script to my D folder, since it didn't work I changed back to your path and put the skin there, still no luck.  I did look in the Haptek folder, the Htr Uncompresses there and drops the uncompressed files there I copied there original skimpyshirt.jpg.   I also noticed her replys were not from the CLZ brn's.
 Carl2

*

Carl2

  • Trusty Member
  • ********
  • Replicant
  • *
  • 560
Re: UltraHal Script: Changing clothes.
« Reply #8 on: October 17, 2005, 08:48:22 pm »
Freddy,
  Well for a quick fix I went to the Test Emotions in the uhp brain and call a LoadSkin.hap, It works but I feel it is an unnecessary step.  I downloaded the editor on your recomendation, I have MS VB editor and some other stuff from Microsoft for VB, I should look at it.  Like to have Hal's brain put the low neckline  by itself.  Also on a similar note loading mood files seems a little unsure. Fullbodgirl was in the HapPlayer and I dragged in happy.hap, opened adjusted the smile to what I liked and opened Hal, I don't see the same responses, the sad.hap is very dependable and I can always tell when it is triggered, the smile for happy seems to get lost.
Carl2

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: UltraHal Script: Changing clothes.
« Reply #9 on: October 22, 2005, 07:40:29 pm »
Hmm Doc knows a lot about the uhp/hap workings, if your're about Doc any ideas ?

 


Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Will LLMs ever learn what is ... is?
by frankinstien (Future of AI)
November 03, 2024, 08:11:00 pm
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
Attempting Hydraulics
by MagnusWootton (Home Made Robots)
August 19, 2024, 04:03:23 am
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

179 Guests, 0 Users

Most Online Today: 336. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles