Author Topic: 9 to 5  (Read 3723 times)

mch

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • http://home.comcast.net/~valaith/
9 to 5
« on: August 17, 2005, 11:45:53 am »
Maybe I've missed it or can't find the proper search phrase but does anyone know of a way to set Hal to use a specific full body texture during certain hours of the day?

For example during 9 to 5 hours Hal can wear work clothes and outside of those hours it can wear another specified outfit until told to change outfits?
 

mch

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • http://home.comcast.net/~valaith/
9 to 5
« Reply #1 on: August 22, 2005, 12:06:08 pm »
For the past few days I have been tearing apart code for alarm clocks and examining other bits of code and have come up with a partial solution to what I was looking for.

Using info I have gathered on this board I created 2 hap files for 2 different outfits. One I called work.hap and the other I called casual.hap. All these 2 files do is point to a texture for the Haptek model.
For example (casual.hap):
#Haptek Version= 1.00 Name= Hap_Casual1 HapType= script FileType= text
##standard
settexture[ tex= [data/standard/skins/skimpyshirt.jpg]]

All texture files I placed in C:Program FilesHaptekplayerDatastandardskins
All hap files i placed in C:Program FilesabawareUltra Hal Assistant 5Characters

Then in the XTF 1.2 brain I added the following code:
   If Time >= "09:00" And Time < "17:00" Then
   HalCommands = "<HAPFILE>Work.hap</HAPFILE>"
   Else HalCommands = "<HAPFILE>Casual.hap</HAPFILE>"
   End If

If you do a search in the brain file for "'PROCESS: INITIALIZE VARIABLES AS INTEGERS", after the line that says "Randomize", leave a blank line and paste the above code there.


This does leave a problem that I am working on and maybe some others can help with this. The problem is that only 2 textures can be used. Every time you talk to Hal, it polls the brain file and then looks at that block of code. If the time is between 9 and 5pm then the work texture is applied. If during that time you tell Hal to use a different texture, the next line you type to Hal it will poll the brain file again and see that it is still work time and swap the texture back to the work outfit. Once 5pm hits and you are talking to Hal at that time you will see the model change into the casual outfit. Again if you tell Hal to change outfits, it will but when you tell it somethign again right after that Hal will poll the brain file and swap textures back to casual.

What i'm looking to do now is see if vbscript will allow me to copy files. So (if I can properly explain this) if I tell Hal to change an outfit, lets say its during working hours and Hal has a red and a blue suit. And we make a hap file for each, call them red_suit.hap and blue_suit.hap and each one points to the appropriate texture. Lets say that Hal is wearing the red suit and you want Hal to change to blue. Currently the brain file is looking at work.hap, can the scripting copy blue.hap and overwrite work.hap? And if so does anyone know how to code that?

I am also looking into expanding the code to look at the days of the week so that Hal only wears the work outfits during the weekday. I think I figured out how to do this but I have not gotten around to testing that yet.
« Last Edit: August 22, 2005, 12:32:35 pm by mch »
 

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3853
    • View Profile
9 to 5
« Reply #2 on: August 22, 2005, 09:09:13 pm »
I think you could set a random timer to select a red, blue, gray, tan suit on it's own but the time of day feature you've implemented is going to be your undoing due to , as you mentioned, the polling after every response.

Perhaps an initial start with the random feature > Hal's wardrobe is choosen. After that then you might be able to give Hal a command to "Change to tan suit" or "Change to casual clothes"

Your time of day routine will work but you'll be a victim of your own programming. You can't have your cake and eat it too. :)

Good luck!
In the world of AI it's the thought that counts!

- Art -

mch

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • http://home.comcast.net/~valaith/
9 to 5
« Reply #3 on: August 22, 2005, 11:55:34 pm »
There is a mistake in my code... working on fixing it now. It was working this morning when I set it up but I guess I didn't have enough coffee when I was testing it and thought I had that complete.

So, Art, there is no function in vb scripting to have the script make a copy of a file? If that is possible then this should work. If not then I might scrap this lol
« Last Edit: August 23, 2005, 12:02:41 am by mch »
 

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3853
    • View Profile
9 to 5
« Reply #4 on: August 23, 2005, 05:24:53 am »
You can try the FileCopy command which basically copies a file from one location to another.

FileCopy "c:UltraHalAsst\newfile.xxx" "c:UltraHalAsstoldfile.xxx" or to another location.

It's not always advisable to use the command due to the various ways people might locate or name their HAL on their Hard Drive like "C:HalAsst...." or "c:AIProgramsUltraHal..." you get the idea.

Good luck with your code!
In the world of AI it's the thought that counts!

- Art -