dupa

Author Topic: ActiveX (oxc control for Hal)  (Read 20185 times)

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
ActiveX (oxc control for Hal)
« Reply #15 on: December 28, 2005, 03:02:33 am »
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:
Code: [Select]
   '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:
Code: [Select]
   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:
Code: [Select]
   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
Robert Medeksza

wgb14

  • Full Member
  • ***
  • Posts: 108
    • View Profile
ActiveX (oxc control for Hal)
« Reply #16 on: December 28, 2005, 03:44:05 am »
Hi Mr M

Thanks for your reply! Your code seems understandable but unfortunately I can not implement it in director. You see the problem is that director can access functions provided by external programs only through an imported ocx module. There is no other way to do that. Hence, I will have to wait untill the release of the updated product. However, as my timeframe is limited may i ask if it is possible to give me a provisional date for the release and also let me know if you are planning to pack the functions of HAL into such ocx?

Thanks
 

moreis62

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • http://www.myway.com/
ActiveX (oxc control for Hal)
« Reply #17 on: December 29, 2005, 02:08:14 am »
quote:
Originally posted by wgb14

Hi Mr M

Thanks for your reply! Your code seems understandable but unfortunately I can not implement it in director. You see the problem is that director can access functions provided by external programs only through an imported ocx module. There is no other way to do that. Hence, I will have to wait untill the release of the updated product. However, as my timeframe is limited may i ask if it is possible to give me a provisional date for the release and also let me know if you are planning to pack the functions of HAL into such ocx?

Thanks


Short for OLE Control Extension, an independent program module that can be accessed by other programs in a Windows environment. OCX controls end with a .ocx extension. OCX controls represent Microsoft's second generation of control architecture, the first being VBX controls written in Visual Basic.
Both VBX and OCX controls have now been superseded by ActiveX controls. However, ActiveX is backward compatible with OCX controls, which means that ActiveX containers, such as Microsoft's Internet Explorer, can execute OCX components.

Sorry it only works with in the Ultra Hal Assistant 5.0 for now.

« Last Edit: December 29, 2005, 02:14:49 am by moreis62 »
ISMAEL LEDESMA.

wgb14

  • Full Member
  • ***
  • Posts: 108
    • View Profile
ActiveX (oxc control for Hal)
« Reply #18 on: December 29, 2005, 10:41:04 am »
Hi moreis62

<<Sorry it only works with in the Ultra Hal Assistant 5.0 for now.>>

What is working only with Ultra Hal Assistant? Do you have an ocx module for Hal (regardless the version)? Please let me know

Thanks
 

wgb14

  • Full Member
  • ***
  • Posts: 108
    • View Profile
ActiveX (oxc control for Hal)
« Reply #19 on: January 01, 2006, 11:50:16 pm »
I wonder if moreis62 can send me any related software to my request. I would love to do some testing.  

Thanks

 

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
ActiveX (oxc control for Hal)
« Reply #20 on: January 10, 2006, 06:03:02 am »
Art, And ZabaFriends.

HI, I am always meditating on hal and AI. Just when you thought you were getting so close, you learn more.

So of my main aims with hal is Inteligence the gloss is the fun side. I am currently impressesed with hal6 as far as i have seen and read, i beleive finally we have a good AI here.

with the scripts and programming contributed by all of the members we have enough for all to design and build an ai from scratch for personal and buzinss use.

i would like to see all of the scripts displayed and saved in one place now as there are so many (no quibbles RE: working or non working).

As i had to learn all from the begining many new commers dont know where to start.

i have been confronted with so many DIFFERENT PROJECTS just sorting them out is hard. just to know which is superficial and which is logical.

Concluding that THE WAY HAL SAVES INFORMATION / RETREIVES THAT INFORMATION is the key. ASSOCIATING that information to have relevence is THE INTELIGENCE.

to have scienticfic knowledge /lists /dictionarys /recipies / conversion formules etc. this is hals functionality.


lately i have been watching robotic topics, some of these projects use the alice / hal interface as their AI engines.

hals true function will soon come in to play - as data mining is the key.... If hals INFORMATION STORAGE/RETREIVAL SYSTEM IS FULLY IN PLACE, is it not posible for you to send hal on FACTFINDING MISSIONS on the internet ie GO READ SOME WEB PAGES > based upon "SEARCH TOPIC" store in DB for later USE.... ie CHAT... or INFORMATIOn REQUEST.

Currently my IDEAS outweigh my talents so i must KEEP HUMBLE Learn more advanced coding techniques. as you say Script and code is for use by all, this is how i learnt to write code by reading somebody elses code, SO to HAVE IT ALL Centrally located WOULD BE like A MASSIVE HELP FILE.....


i have just come back online & built the MONSTER X2 64BIT SuPERpc, briancruncher now so i will be posting scripts soon....
(before all this script is taking too long to execute) probable quirk of program not machine!!!!

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
ActiveX (oxc control for Hal)
« Reply #21 on: January 10, 2006, 06:17:21 am »
AS mr M mention how to REFFERENCE the *.Dlls in your project...

this is the way that i add hal to my VB projects When required.
Then to acess the commands

HALBRAIN.<List of commands>

this is the only current way, I was going to install the macro media and experiment but since i have got in to my VB All that you may want to do could be accoumplished with vb EXCEPT placing hal onto YOUR WEB PAGE, as the dlls would also need to be up loaded and REGISTRD on the WEBSERVER REGISTRY.... With the activeX as long as th ocx is stored locally with the web page it is enough, this is the difference...

If you want to use hal o the website you can BUY WEBHAL or Get the FREE WEBHAL and Link him to your own site in a FRAME, and .....

this is why the macromedia did not detect the hal ACTIVEX.....

as Ishmal Says it may be possible to write a plugin in Vb6 containing the DLL files Refference by MR M. then REPACKAGING into an OCX... maybe, Hmm...Maybe not... at least that way you maybe able to reference your new activeX plugin in to you project...

BUT ALL ELSE FAILING you could try writing an ELIZA TYPE BRAIN for your project (this is nearly the same, LOWTEC) containing only the TOPICS WHICH you are dealing with..., this script is contained within the web page where she resides.(i used her in  one of my sites before, RAW, )

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3848
    • View Profile
ActiveX (oxc control for Hal)
« Reply #22 on: January 10, 2006, 05:16:57 pm »
Leroy,

Glad to see you're back in true form. You have contributed a lot to the progression of Hal through your scripts, ideas and interactions.

Hal can only go forward from here and I agree that this databased version is the key to continued development.

For the most part, any limits of expansion are only due to us. Collective thinking, a place for script files, plug-in requests or ideas to enhance Hal's intellect would be most appreciated.

Tell me, do the lights in your flat dim when you power up your MONSTER X2 64BIT SuPERpc, braincruncher??
[^]
In the world of AI it's the thought that counts!

- Art -

Another Jim

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
ActiveX (oxc control for Hal)
« Reply #23 on: January 10, 2006, 08:46:52 pm »
Art,
Little doubt about that..........I can envision someone at the power station walking to a control panel and easing the lever upward to compensate for Leroy's monster computer coming online........(big smile)

Jim B
 

wgb14

  • Full Member
  • ***
  • Posts: 108
    • View Profile
ActiveX (oxc control for Hal)
« Reply #24 on: January 11, 2006, 05:22:23 am »
Hi All,

Thanks for your ideas and contributions to this topic.

<<Ishmal Says it may be possible to write a plugin in Vb6 containing the DLL files Refference by MR M. then REPACKAGING into an OCX... >>

This OCX is what I am looking for many many months now. I hope that Mr.Medeksza will consider seriusly this request and we will see that in the near future. Meanwhile if another member manages to develop such OCX please contact me.

Thanks
 

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
ActiveX (oxc control for Hal)
« Reply #25 on: January 11, 2006, 01:18:05 pm »
i have intergrated the three dlls
HALBRAIN.dll / HALsmind.dll / halwn.dll.
but when you create the activeX control (no prob). remember that you still need to design an interface to go with...

also you still need to declare the objects and when you use the dlls they need to be kept local to the OCX file...

now you see while your doing that why not build the whole project as an activex & just stick it on the webpage i was suprised but it worked well... i used wthe webpage as a skin.... ms agent as char... the control was just an input output window... the activeX control contained all my brainDETECTIONS & most of the responses I used ACCESS as the DB....

one thing about the new HAL is it takes up less files... allcontained within 1 file(BETTER)the same with the activeX except the dbfile / although you dont have to use a dbfile. the elizaBrain principle is the same..... thats why i said to go back to the older versions of hal as you will see most of the brainwork is self contained in the script.

TRY IT AND SEE...

wgb14

  • Full Member
  • ***
  • Posts: 108
    • View Profile
ActiveX (oxc control for Hal)
« Reply #26 on: January 12, 2006, 06:51:32 am »
Helloo Spydaz,

<<i was suprised but it worked well>>

So, did you manage to create this ocx? If yes please send it to me asap. I woulr really like to try it out. My email is idoumanis@yahoo.gr. Also please send me the example that you created as well (the web page). I will try them out and let you know back my feedback.

Looking forward for your reply

Thanks
 

wgb14

  • Full Member
  • ***
  • Posts: 108
    • View Profile
ActiveX (oxc control for Hal)
« Reply #27 on: January 12, 2006, 06:52:53 am »
Sorry I posted twice the same thing.


Thanks [:)]
« Last Edit: January 12, 2006, 06:53:34 am by wgb14 »
 

wgb14

  • Full Member
  • ***
  • Posts: 108
    • View Profile
ActiveX (oxc control for Hal)
« Reply #28 on: January 13, 2006, 03:19:05 pm »
No news so far from spydaz. I hope that he is still out there......
 

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
ActiveX (oxc control for Hal)
« Reply #29 on: January 15, 2006, 07:38:03 am »
i have Just created the axtiveX ocx, BUT.....

You will still need the 3 MAIN DLLS. HALmind.dll halWN.dll HALBRAIN.dll.

also the brian programming will need to be done INSIDE the OCX.

as im still new to activex programming as the activeX ocx contains the SKIN to be used on the site and the link to the MSAGENT.

So when building the activeX plugin for your project you will need to edit the ActiveX (in visual basic)

im not sure this is what you want but here it goes I have mess around with various styles (this is the most basic)


Download Attachment: SpyAIControl.zip
24.87 KB