Well All Hail Me.
Eureka! I have done it.
I have added 3 .brn files (drop them into your defbrain folder) and only a little itty bit of code into the brain editor. I'll try to explain step by step so everyone can follow.
first the .brn files
the most important is 7_7s.brn
This file allows you to enter 3 things:
1.trigger words (though phrases are better, so as not to be easily used in normal conversation with Hal)
2.the file to execute
3.a delay, so long haps cant be interupted and mutated by more haps being loaded on top
the format for each entry is as follows
"trigger words","hapfiletobeexecuted.hap(timedelay in seconds)"
so for example my fullbodyturnback hap has the following entry
"please turnaround","fullbodyturnback.hap20"
The second file is 7_7s_hapfileresponse.brn
this file contains what Hal will responde with while running the triggered hap file. 2 things must be entered for each entry
1 the triggered hapfile
2 the response
the format for each entry is as follows
"hapfile.hap","Hal's response"
So useing my fullbodyturnback hap again
"fullbodyturnback.hap","woa, I'm getting dizzy"
You dont have to have a set response if you dont want. If you dont enter anything in the 7_7s_hapfileresponse.brn then a random response is chosen from the following file
As stated above the third file 7_7s_randomresponse.brn just contains ephemeral "don't I look good" responses.
777777777777777777777777777777777777777777777777777777777777777777777
Now the code that needs to be entered into the brain has to be put in in 3 places. Again I used the XTF brain v1.2.
The firt line has to go in near the start, do a search (ctrl + F in the brain editor) for 'DECODE SAVED CUSTOMMEM VARIABLES: and insert just under that the following line of code:
hapdelay = DecodeVar(CustomMem, "hapdelay")
the second bit of code is the biggest chunk. I entered mine on line 285 just under the Randomize statement at the end of 'PROCESS: INITIALIZE VARIABLES AS INTEGERS piece of coding (do another search to find it
here is the code I entered
If instr(UserSentence,"stop it")<> 0 Then
hapdelay = 0
GetResponse = "I was having so much fun though."
End If
thingtoload = HalBrain.TopicSearch(UserSentence,(WorkingDir & "7_7s.brn"))
If thingtoload <> "" Then
If instr(thingtoload,".hap") <> 0 Then
If hapdelay < timer Then
hapdelay = HalBrain.SearchPattern(thingtoload, "*.hap*", 2)
hapfile = HalBrain.SearchPattern(thingtoload, "*" & hapdelay, 1)
hapdelay = hapdelay + timer
HalCommands = "<hapfile>" & hapfile & "</hapfile>"
responsesentence = HalBrain.TopicSearch(hapfile, WorkingDir & "7_7s_hapfileresponse.brn")
If responsesentence <> "" Then
GetResponse = responsesentence
Else GetResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "7_7s_randomresponse.brn")
End If
Else
GetResponse = "Wait " & (hapdelay - timer) & " seconds, I'll be finished soon."
End If
Else
'insert command here that will open files or programs
End If
BlockSave=True
GetResponseBlock = True
End If
Now the final little bit. search for 'POST PROCESS: PRESERVE ALL VARIABLES about 10 lines down from this you will see a command starting with "CustomMem" it is a really long single line statement. now just paste the following onto the end of that line
& EncodeVar(hapdelay, "hapdelay")
And thats it all done.
I'd like to point out though that you still need to have a blank charactername.psn file as mentioned in my previous post and this still doesn't help with displaying the emotion haps ie when hal feels sad a sad.hap should run. But I'm still working on that bit[
]
Also you will see a line in the code
'insert command here that will open files or programs
I left this in so you can open files or programs with trigger words just as you would execute a hap file except I don't know the command to do so. So if their is any VBsript experts who know please post us a line.
Also full credit to Vonsmith for this brain. All my knowledge of the VBscript language has come from tinkering with this brain.