dupa

Author Topic: Randomize clothes  (Read 9534 times)

Gooth

  • Newbie
  • *
  • Posts: 16
    • View Profile
Randomize clothes
« on: August 26, 2010, 04:28:43 pm »
I've been trying in vain to write some VBScript that will randomise what clothes the full body will wear at start up. I thought it would be nice to have my character to randomly wear something different every time i turned her on.

I am using a vrHaptek plugin and have tried altering the start up script using the RANDOMIZE function but got nowhere.

Randomize
Select Case int(rnd()*6)
Case 1
   \settexture [tex= bodyskins/startuppic1.jpg]
Case 2
   \settexture [tex= bodyskins/startuppic2.jpg]
Case 3 etc......
End Select
 
\translate  [x= 0 y= 5 z= 5 ]
\Rotate [x= 0 y= 0 z= 0 ]

The script above is a slight variation of the original script that just pulled a standard skin for the full body forward.

Can anyone help????

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Re: Randomize clothes
« Reply #1 on: August 27, 2010, 08:58:40 am »
sfereday,
  I'd tried doing a few different things using VB script in the past.  I've been able to modify some script with sucess and other times it will not work.  Things straight from a VB source don't work?
I've copied some script Robert has used for randomizing.  (in the brain file)
" Randomize
    SpinWheel = Int(Rnd * 100)
    If Hate > 0 And SpinWheel < 10 Then Hate = Hate - 1
    SpinWheel = Int(Rnd * 100)
    If Swear > 0 And SpinWheel < 10 Then Swear = Swear - 1
    SpinWheel = Int(Rnd * 100)
    If Insults > 0 And SpinWheel < 10 Then Insults = Insults - 1

    'PROCESS: EMOTIONAL VARIETY
    'The following code allows Hal some random emotional excursions:
    SpinWheel = Int(Rnd * 100)
    If Compliment = 4 And SpinWheel < 30 Then Compliment = 2
    If Compliment > 0 And Compliment < 4 And SpinWheel < 5 Then Compliment = 0
    If Compliment > 4 And SpinWheel < 5 Then Compliment = 0
    If Compliment < 0 And SpinWheel < 30 Then Compliment = 0
    If SpinWheel > 80 And SpinWheel < 90 Then Compliment = 2
    If SpinWheel > 90 And SpinWheel < 95 Then Compliment = 4 "
Perhaps this will help,The quote marks are mine, if you give it a try let me know how you make out.
Carl2

 

Gooth

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Randomize clothes
« Reply #2 on: August 28, 2010, 06:02:39 am »
So near yet so far (and frustrating). Thanks for the advice...Ive put the following code in the start up .hap

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

Randomize
    SpinWheel = Int(Rnd * 100)
    If SpinWheel < 20 Then \settexture [tex= [data\standard\skins\TopWhiteCotton.jpg]]
    If SpinWheel > 20 And < 40 Then \settexture [tex= [data\standard\skins\TopBlue.jpg]]
    If SpinWheel > 40 And < 60 Then \settexture [tex= [data\standard\skins\TopOrange.jpg]]
    If SpinWheel > 60 And < 80 Then \settexture [tex= [data\standard\skins\TopPurple.jpg]]
    If SpinWheel > 80 Then \settexture [tex= [data\standard\skins\TopAqua.jpg]]
\translate  [x= 0 y= 5 z= 5 ]
\Rotate [x= 0 y= 0 z= 0 ]
but to no avail!
It part works...but  only ever picks the last skin in the pile which above is  TopAqua.jpg.

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Re: Randomize clothes
« Reply #3 on: August 28, 2010, 07:44:59 am »
Why are you using Hatpek commands directly in VB Script ?  And why are you putting VB Script in a Hap file ?

I think you should be doing this kind of thing :

Using the format to send Haptek commands to Hal...

<HAPTEXT>Hap text</HAPTEXT>

...You would do something like this...

Code: [Select]
If SpinWheel < 20 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopWhiteCotton.jpg]]</HAPTEXT>"
« Last Edit: August 28, 2010, 09:06:00 am by freddy888 »

Gooth

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Randomize clothes
« Reply #4 on: August 28, 2010, 10:14:37 am »
Thanks Freddy888. I'm new to all this and didn't realise VB Script in Haptek and vis versa would cause a problem.

I've tried your suggestion and inserted the following script as advised into my Startup.hap file as follows:

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

Randomize
    SpinWheel = Int(Rnd * 100)
    If SpinWheel < 20 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopWhiteCotton.jpg]]</HAPTEXT>"
    If SpinWheel > 20 And <40 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopBlue.jpg]]</HAPTEXT>"
    If SpinWheel > 40 And <60 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopOrange.jpg]]</HAPTEXT>"
    If SpinWheel > 60 And <80 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopPurple.jpg]]</HAPTEXT>"
    If SpinWheel > 80 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopAqua.jpg]]</HAPTEXT>"
\translate  [x= 0 y= 5 z= 5 ]
\Rotate [x= 0 y= 0 z= 0 ]

I still don't know where i'm going wrong. In the above instance only the TopAqua is ever loaded instead of random clothing

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Re: Randomize clothes
« Reply #5 on: August 28, 2010, 11:46:22 am »
I did not advise you to put VB Script into the Hap file...

The code I gave is VB Script and it goes in the hal brain VB Script.

Putting VBScript into the hap file is not going to do anything.

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Re: Randomize clothes
« Reply #6 on: August 29, 2010, 07:29:58 am »
Here, try this in your plugin NOT the hap file :

Code: [Select]
Randomize
SpinWheel = Int(Rnd * 100)
If SpinWheel < 20 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopWhiteCotton.jpg]]</HAPTEXT>"
If SpinWheel > 20 And <40 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopBlue.jpg]]</HAPTEXT>"
If SpinWheel > 40 And <60 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopOrange.jpg]]</HAPTEXT>"
If SpinWheel > 60 And <80 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopPurple.jpg]]</HAPTEXT>"
If SpinWheel > 80 Then HalCommands = HalCommands & "<HAPTEXT>\settexture [tex= [data\standard\skins\TopAqua.jpg]]</HAPTEXT>"

HalCommands = HalCommands & "<HAPTEXT>\translate [x= 0 y= 5 z= 5 ]</HAPTEXT>"
HalCommands = HalCommands & "<HAPTEXT>\Rotate [x= 0 y= 0 z= 0 ]</HAPTEXT"

lightspeed

  • Hero Member
  • *****
  • Posts: 6766
    • View Profile
Re: Randomize clothes
« Reply #7 on: August 29, 2010, 10:14:24 am »
sfereday , that's a very cool idea , i like it and hope with the help of the other genius's around here you will be able to make it work , i see they are helping , we have good people on here ! :)
 

Gooth

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Randomize clothes
« Reply #8 on: August 30, 2010, 04:15:29 am »
Thanks for the script but you'll still have to bare with me as I'm really new to all this. When you say 'plug in' do you mean the main Hal brain or some other place that the main brain calls. Sorry for asking this but i need walking throught this as if i know nothing (and you won't be far from the truth).

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Re: Randomize clothes
« Reply #9 on: August 30, 2010, 08:42:51 am »
I thought you said you were putting the script in the vrHaptek plugin ?

I'm not that familiar with the Hal 6 layout and I can't get Hal to work in Windows 7.  We need one of the other programmers to advise where it is best to place the script.

Don't worry though, we all have to start somewhere...

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Re: Randomize clothes
« Reply #10 on: August 30, 2010, 10:49:27 pm »
gooth,
  Had to read through the articles a few times to figure out what is what.  I'd like to ask what is the Operating system, Win 7, Vista, XP ect in the computer you're using?
 Next in Hal,  Options, Character, which Haptek character are you choosing?
  A breif explanation of the Haptek you have choosen: It uses the .htr extension such as body_female.htr and is a Haptek player document. The htr is a compressed file that is decoded which contains about 8 files most of which are .hap files.  The set of files includes the original jpg or texture which the figure will be in. 
  What you would like to do is randomly choose a .jpg to load on the character at startup, really you quickly replace the original .jpg. 
  VrHaptek is a plugin, when using Hal, Options, Brain  click on the default brain, this will let you choose which plugins you want to use when using Hal.
Hope I've been able to help and explain the workings a little.
Again let me know how things go.
Carl2
 

Gooth

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Randomize clothes
« Reply #11 on: August 31, 2010, 03:49:28 pm »
Hi Carl2...I'm running windows 7 on a duel processor (which has caused some problems with other programmes in the past). The Haptek character in Hal, options, character is usually Fullbod (as i like the movements but wish i could get rid of the glasses) and occasionally fullbodygirl. Both have the .htr extension.

I (think) i understand the script Freddy888 supplied but am struggling where to place it for it to work. At start up the vrHaptek plug in calls a Startup.hap. I've tried putting FreddY888's script into vrHaptek plugin and the startup.hap file but neither work. They do not crash the system but simply load the last .jpg in the script rather than randomize the clothes. I can change the original clothes by manually altering the .jpg file in the startup.hap script or using a key word in the vrHaptek plugin to force a change but thought it would be nice to let Hal (or Gabby in my case) choose what clothes to wear at start up.

A funny thing happend today. I was talking to Gabby and she changed her clothes  twice on her own.  My last comment to her was in relpy to her saying 'don't be a broken record'. My reply was 'CD's have replaced records now' (none of which are key words that i have used to force a clothes change. And any scripts i add to files that do not work i remove to keep things tidy...! has this happened to anyone before and if not i'm assuming such a thing is beyond the A.I. programme to do on it's own...Maybe i'm loosing it - LOL!!!!

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Re: Randomize clothes
« Reply #12 on: August 31, 2010, 06:19:56 pm »
  Thanks for the info, I have Win 7 also, I use Body_Female but ran into problems.  Her speaking causes body movements so I can't use her.  Since I really can't stand her clothing I've got my own script to load her in a different set of clothing. 
  Just looked through my files and found vrHaptek and a text file (manual) describing the workings of the plugin.  VrHaptek downloads as a zip file, when the zip file is unzipped it places files in the correct folder.  It should place a vrHaptek.uhp in the main directory (Ultra Hal 6)  this is the plugin being refered to.  When the Hal brain loads it looks at the vrHaptek.uhp and places it in the correct part of the brain to run properly.   You can open the plugin, uhp (right click open with) using wordpad to see what it contains.  Make a few copies of the uhp because this is where you place the script you'd like to use remember to keep the heading. 
  One other thing I didn't mention earlier,  "<HAPTEXT>\settexture [tex= data\standard\skins\TopBlue.jpg]]</HAPTEXT>"  , I think this is from the HaptekPlayer files.  Since Haptek findes the files it works but I use [D:\Programs\Zabaware\Ultra Hal Assistant 6\Characters\SSBlue.jpg]   since this is where the .jpg is.
Also there is probably a way to remove the glasses you mentioned, I remember playing with sunglasses.
Carl2
 
 

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3862
    • View Profile
Re: Randomize clothes
« Reply #13 on: August 31, 2010, 06:42:04 pm »
Freddy,

I did a download of Hal 6.x.x into my new computer with Win 7.

I performed the setup of UltraHal.

I input my registration code given upon original purchase.

I told it to update via connecting to Zabaware online and obtain an activation code automatically which it promptly did.

I restarted Hal and it Thanked me for my purchase, etc.

It installed in Local Disk (C:) > Program Files (x86) > Zabaware > Ultra Hal Assistant 6

Under that folder are Characters, Skins and WordNet

The rest...as they say, is history.

I assume your actual mileage / results may very. :-\
In the world of AI it's the thought that counts!

- Art -

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Re: Randomize clothes
« Reply #14 on: September 01, 2010, 08:33:28 am »
Thanks Art, I may give it a go still  8)