Ultra Hal Assistant 5.0 had an easy to use ActiveX method in the HalBrain.DLL to do this, but this was not updated to support Hal 6.0 type brains. I am currently working on an updated version of Zabaware's "Ultra Hal Representative" product that would provide all the programming functionality that you want. I have no estimated release date as of yet, but it will be sometime in 2006.
However if you want to do this today, it is not too hard to do this functionality yourself. Hal's brain is basically a VBScript. You can interface with Hal's VBScript the same way that the main Hal Assistant executable interfaces with it: Using the Windows Script Control, which is an ActiveX control. In addition to the windows script control, you also need to acess the activex objects UltraHalAsst.Brain and UltraHalAsst.WN
I'm not too familiar with Macromedia director, but here is some simple VB6 code that will run the Hal6 default brain, maybe you can do something similar in macromedia director. The following code is initialization code required to setup all the activex controls needed to run Hal's brain:
'Declarations of objects and variables
Dim HalBrain As Object
Dim WN As Object
Dim HalScript As Object
Dim ScriptCode As String
'Create instances of activex controls
Set HalBrain = CreateObject("UltraHalAsst6.Brain")
Set WN = CreateObject("UltraHalAsst6.WordNet")
Set HalScript = CreateObject("MSScriptControl.ScriptControl")
'Read script source code into variable
Open "Hal6.uhp" For Input As #1 'May need to provide full path to UHP file
ScriptCode = Input(LOF(1), 1)
Close #1
'Setup script control and database
HalScript.Language = "VBScript"
HalScript.UseSafeSubset = False
HalScript.AllowUI = False
HalScript.AddCode ScriptCode
HalScript.AddObject "HalBrain", HalBrain, True
HalScript.AddObject "WN", WN, True
HalBrain.OpenDatabase "HalBrain.db" 'May need to provide full path to Hal's database
If you are able to, I recommend doing this initialization code just once, not for every sentence the user inputs to Hal. It will work just fine if you do it for every sentence, but it just adds overhead. Once the objects are setup, you can make a call to Hal's brain like this:
ScriptOutput = HalScript.Run("UltraHal", UserSentence, UserName, ComputerName, LearningLevel, ScriptCurDB, Hate, _
Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, Custommem2, Relevance, Topicfocus)
VariableList = Right(ScriptOut, Len(ScriptOut) - InStr(1, ScriptOut, "<storevars>", vbTextCompare) + 1)
HalsResponse = Left(ScriptOut, InStr(1, ScriptOut, "<storevars>", vbTextCompare) - 1)
Custommem1 = DecodeVar2(VarList, "Emotion")
Hate = DecodeVar2(VarList, "Hate")
Swear = DecodeVar2(VarList, "Swear")
Insults = DecodeVar2(VarList, "Insults")
Compliment = DecodeVar2(VarList, "Compliment")
PrevSent = DecodeVar2(VarList, "PrevSent")
LastResponseTime = DecodeVar2(VarList, "LastResponseTime")
PrevUserSent = DecodeVar2(VarList, "ScriptMem2")
Custommem2 = DecodeVar2(VarList, "ScriptMem3")
Relevance = DecodeVar2(VarList, "ScriptMem4")
Topicfocus = DecodeVar2(VarList, "ScriptMem5")
The variable names should be pretty self-explanatory. Most variables will be initialized by the script if passed empty on the first query. The user's input sentence is UserSentence and Hal's output sentence is HalsResponse. It is your responsibility to keep track of the other variables between queries in some way as this is Hal's short term memory.
And cleanup code would be (which may only be run during shut down of your program, or for every query, depending on your implemenation:
HalBrain.CloseDatabase
Set HalScript = Nothing
Set WN = Nothing
Set HalBrain = Nothing
This implementation does not support Hal's on the fly plugins. It also has no queueing or collision detection needed for good multi-user support. You will have to wait for Ultra Hal Represtative to come out to get these features in an easy to use ActiveX control. Since there is no collision detection, if you want to use Hal in a multi-user environment such as a web server than you must disable Hal's learning, as if Hal is talking to 2 people at once and tries to write new information to its database simultaneously, a crash and possible data corruption will occur. If learning is off then Hal only reads from the database and there is no problem