dupa

Author Topic: Scripting need help  (Read 3966 times)

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Scripting need help
« on: October 03, 2005, 03:02:04 pm »
All,
  I'm using the following script to trigger emotions, this is used in the XTF v1.2 uhp;

 EmotionalReaction = HalBrain.TopicSearch(PrevSent, WorkingDir & "Emotion.brn")
 EmotionalReaction = HalBrain.TopicSearch(GetResponse, WorkingDir & "Emotion.brn")
 EmotionalReaction = Halbrain.TopicSearch(UserSentence, WorkingDir & "Emotion.brn")

This is before the Select Case EmotionalReaction, it seems to work and my input will trigger a hap mood.
  I've just changed to the fullbody girl and I was hoping to trigger hap actions using the same method used to trigger moods. Frist problem is I had thought the GetResponse would use a trigger from Hals output, this dosen't seem to be the case.  From what I can see if I say mistake she is sad, if she says mistake there is no change in emotion. Can I get a trigger word from her output?  It would be nice to have her say I'm happy and have her smile or I'm going to take a walk and start walking.  Probably easy for some of you, I'm still trying to load a skin.
Carl2
 

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Scripting need help
« Reply #1 on: October 04, 2005, 08:53:20 am »
Off the top of my head, XTF used a variable to store the previous response from Hal so you could go about it that way. ie locate the variable and process it at the start of GetResponse.

If not then try using the CUSTOM MEMORY function which encodes user variables for use the next time GetResponse is called.

You could extract the keywords from that with INSTR statements as you would the user input and then trigger the HAP file calls.

The code for the custom memory is towards the end of the script.
« Last Edit: October 04, 2005, 08:54:22 am by freddy888 »

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Scripting need help
« Reply #2 on: October 04, 2005, 05:36:46 pm »
Freddy888,
 I found the custommem encode and decode, and Instr.  About all I can say is the script for trigger words would have to be moved.  I'll try to try.
Carl2
 

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Scripting need help
« Reply #3 on: October 05, 2005, 10:00:46 am »
I went and had a look to refresh my memory (sorry I see now you already found PrevSent[:I]) but couldn't get a straightforward Hapfile to process.  I tried the code below on an otherwise unedited XTF brain and with no other changes bar putting fullbody in as the character.

Anyway this is what I tried.  This doesn't work on pushing the hapfiles through, but the Instr function picks out the trigger word fine...

If InStr (1,PrevSent,"happy",1) > 0 Then
    HalCommands = "<HAPFILE>" & "Happy.hap" & "</HAPFILE>"
End If

If InStr (1,PrevSent,"sad",1) > 0 Then
    HalCommands = "<HAPFILE>" & "Sad.hap" & "</HAPFILE>"
End If

If InStr (1,PrevSent,"tired",1) > 0 Then
    HalCommands = "<HAPFILE>" & "Sleepy.hap" & "</HAPFILE>"
End If

  In the Haptek SDK it tells you that commands are processed immediately unless scripted over a period of time.  I'm pretty sure that the above code will conflict with other Haptek calls, which probably cause a bottleneck, so some get ignored or overided.  So my guess is that why anything similar will run into the same problem.

I had something like what you describe working once before but had to strip out all of the emotion handling and also the uhp that Hal uses for a few emotions.  If I can find that brain I'll post the changes I made, but it probably won't be till the weekend as I blew up my Harddrive and am having to restore my system!
« Last Edit: October 05, 2005, 10:10:37 am by freddy888 »

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Scripting need help
« Reply #4 on: October 05, 2005, 10:14:10 am »
Also looking at your code there, it looks like it should work if it is processing emotions from:
 
EmotionalReaction = HalBrain.TopicSearch(GetResponse, WorkingDir & "Emotion.brn")

Then why not:

EmotionalReaction = HalBrain.TopicSearch(PrevSent, WorkingDir & "Emotion.brn")

???

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Scripting need help
« Reply #5 on: October 05, 2005, 06:30:48 pm »
Freddy888,
 Well I got a skin to load, not sure why but I went to the original skimpyshirt.jpg and modified it. None of the downloaded skins will load.  Back to triggers, I've posted all of the changes I made at zabaware. It's under Displaying Haptek emotions. I just coppied all her files to a cd just in case. I also have a back up hal I use to try changes with.
  Anyways, I added this script so I could see some emotions, I really didn't notice much of anything before which is why I put in the script, also the happy.hap dosen't make much of a change In Hal but it will when dragged and dropped in the hapregestry, unknown possibly different versions of the player.  Thanks for the input, you make it seem possible.
  Good luck with the Hard drive.
Carl2
 

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Scripting need help
« Reply #6 on: October 10, 2005, 03:18:19 pm »
Freddy888,
  I just picked up and moved the script to detect and trigger emotions to after the costmem decode, it causes an error code so I moved it back, seems to work again. Just put in a EmotionalReaction = Halbrain.TopicSearch(Halsent, WorkingDir & Emotion.brn) the brain still works (Very strange response from her) I believe it was about something she tried to read ages ago.  This is in a copy of Hal, I'm going to speak with her awhile and try to see what happens.
Carl2