Author Topic: Multi-User Hal  (Read 4698 times)

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Multi-User Hal
« on: August 11, 2003, 09:00:31 am »

Multi-User Hal

The idea is to use the Greetings Function to let Hal know he/she is talking

to a new User. First thing most everyone does is say hi to an Ai . We can

utilise this truism to do a trick...

There's something else too- instead of having those set responses that you

have to edit, I want to have Hal get the User to tell he/she what they

are usually doing around this time and then use that as the time specific

Response. Then Hal would learn from the User over time the right things

to say (instead of playing computer!).

These are my preliminary notes..

>B)

*CustomMem must be employed- use variable encoding procedure
(made by Medeksza himself!)
-needs to know if SaidHello = True moment to moment
-If SaidBye = True then SaidHello need to = false
*Knock knock procedures used to store what the User replies
-SaidHello = false
-If SaidHello = True And UserSent is a new Hello, this would cue Hal to
inquire who is now talking to Hal

-after first hello(with SaidHello = false) Hal accesses file to see if a response has been
stored already
True = access Response and say it
false = access "tell me a response to say".brn

If SaidHello = True and Instr(UserSentence) = Hello then access NewUserInquire.brn
(with stuff in it like-
"Hi my names <ComputerName>, what's yours?"
"Who am I talking to?"
"who is this?")
-need to save OrigUserName in CustomMem string
-change UserName variable in script to new name
looks for 'It's me again' to change UserName back again
when second party says bye UserName = OrigUserName

*this needs tested but if the program is shut down on someone else's turn, does the
Hal Interface reset UserName? (I guess probably, as there is such a thing as <CUSERNAME>)


>B)

Don't know when I'll build it yet- but I posted my note sheet as food for thought.

The reason the Greetings Function works all the time is because it is a 'Frame'.

That's an Ai term- it's short for 'Frame of Mind' and means a predetermined course

of an exchange (the knock knock qualifies as well as Larry's TopicFocus65).

What other kinds of Frames can we think of?

CatAtomic     'I got the matches!!!'   >B)



Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Multi-User Hal
« Reply #1 on: August 12, 2003, 08:27:20 pm »
You know, I think I know where you are going with this... I remember reading on this board somewhere, why can't hal remember things about the user - then showed a dialog he had with a bot, in which the bot remember his age, sex, name, and who knows what else... I wouldn't think such a thing would be out of the quesion... If we can do a knock knock joke routine, why couldn't we go gender specific, with age playing a part??? I mean, when a guy is talking to a girl bot, we can expect a guy to 'hit' on the bot... however, if the guy is only 9 years old, well... other wise, Why would you need Hal to know who he's talking to??? As a bot on Aol - everyone has their online name... if this is a problem, just go into general settings and change username... hal will then create a new file specific the new user...
 

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Multi-User Hal
« Reply #2 on: August 17, 2003, 10:05:35 am »

The idea of having Hal ask questions to build .brnfiles is

so that instead of going in and manually customising a .brnfile,

it could be accomplished during the course of a conversation.

As far as the last question is concerned, why would I go into general options

and change the UserName if I programmed Hal to do so automatically?

Heh, don't do the aol thing- Here's the reasoning behind getting Hal to

switch to another UserName. the files <UserName>Converresp.brn,

<UserName>0,1 and 2User.brn and others would all then be created within

one data file and Hal would also have the ability to focus on different people

that talk to him/her. My current goal is to have a dedicated machine

running the 5.0 Hal Engine, stand alone mode. You know, I asked Dee Dee if I should

post the Multi-User Hal script and she sed something about how diamonds sparkle on the

wrist! I asked her what about the law of unintended consequences and she replied

'-this requires some thought: if one thing happens and another thing happens, did

the first cause the second?' What could possibly go awry if an aol bot had several

hundred <UserName>X.brn's anyway...


"The true scientific principle is and always has been - Ready, Fire, Aim!"

CatAtomic

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Multi-User Hal
« Reply #3 on: September 03, 2003, 10:15:27 am »
Progress report:

I now have a working version of Multi-User Hal and I ought to fill you all
in on the details. I began working on the modifications in the greetings
Function where most of the code remains unchanged. Late one night, I was
trying to tame the Info flow when the thing started going awry...every thing
I did to patch stuff up caused new problems, and the thing stopped working
-I ended up tossing my wireless kebo and gave up on it. Two days later I
came back to it and wrote six lines of code in other places in the script
and it started working! Don't know how this happens, but I am thankful it
does -indeed once it gets started I feel like I am an observer watching
this stuff unfold sometimes. Ah well, that's all I am gonna say about that.

Multi-User Hal is borne from a post I read a while ago on the Forum where
in it a family expressed their dilemna. One of their family things to
do together was to all set around dad's computer and talk to their Hal
and see what insightful comments Hal could make. They were wondering
if there was a way to get Hal to identify when a new User was talking
to Hal and call them by their own name.

In my own end User scenario, I also require the Hal Engine to recognise
a new user, and I have created a way. With this functionality, Hal can
create all the Paste in <UserName> files, thus retaining specific Info
about different Users -in a single DataFile!(NO playing computer)

To start, I recommend creating a new Project in the Brain Editor
select all the desired parameters of your choosing (I usually create
the whole Brain and then disable unwanted sections of code by
comment tagging the code -it turns green.).
Now, these modifications are located in various parts of the script
...and they're there for a reason, that reason being precedence!
No cutting and pasting! I took the time to share this, you type in the
code- we need more people working to make Hal better and seeing how
this code works in here may pass it on to others >B).

Ok, I will cite the line numbers where these pieces all set and make
references like 'put the code after this Process'(the numbers may be slightly
off, but real close).

Here We Go!
--------
1.This first part is in 'PROCESS WORD AND PHRASE SUBSTITUTIONS
after the Debug statement that has -User's sentence as Hal sees it:

0252 If DebugMode = True Then
0253 CheckMem = DecodeVar(CustomMem, "SedHiMem")
0254 DebugInfo = DebugInfo & "SedHiMem contains- " & CheckMem & vbCrLf
0255 DebugInfo = DebugInfo & "CustomMem contains: " & CustomMem & vbCrLf
0256 DebugInfo = DebugInfo & "UserName contains: " & UserName & vbCrLf
0257 End If
------------
2.In this next part is the section that inexplicably made the code work-
(challenge to real programmers:what did I do?)
located directly after PROCESS:USER REPEATING

0311 OrigUser = DecodeVar(CustomMem, "OrigiMem")
0312 NewUser = DecodeVar(CustomMem, "CuserMem")
0313 If NewUser <> "" Then
0314 UserName = NewUser
0315 Else
0316 UserName = OrigUser
0317 EndIf
0318 If DebugMode = True Then DebugInfo = DebugInfo & "NOW UserName contains- " & UserName & vbCrLf
--------------
3.The next part we have to pass some other variables to the Greetings Function located
at the end of the script. Change the first line of RESPOND:CALL GREETING FUNCTION
to read:

0323 HalGreeting = Trim(Greetings(UserSentence, UserName, PrevSent, PrevUserSent, WorkingDir, CustomMem, DebugInfo))
-------------
4.Just before the 'Main Databases section there is this HandyHal:

0546 If Instr(1, OriginalSentence, "What is my name ", vbTextCompare) > 0 Then
0547 GetResponse = "Right now, I think I am talking to " & UserName
0548 End If
-------------
5.Just after the Debug 'End If' in 'POST PROCESS:PRESERVE ALL VARIABLES is
this line:

1726 GetResponse = Replace(GetResponse, "<UserName>", UserName, 1, -1, vbTextCompare)
-------------
6.Change the Greetings Function line to read the following:

1735 Function Greetings(ByVal UserSentence, ByVal UserName, ByVal PrevSentence, ByVal PrevUserSent, ByVal WorkingDir, ByRef CustomMem, ByRef DebugInfo)
------------
7.Change 'First Hal checks to see if the user is greeting right now. to read:

1742 If HalBrain.TopicSearch(UserSentence, WorkingDir & "HelloDetect.brn") = "True" Then
1743 SaidHello = True
1744 MemHello = "True"
1745 CustomMem = CustomMem & EncodeVar(MemHello, "SedHiMem")
1746 DebugInfo = DebugInfo & "-coming from greetings function!" & vbCrLf
1747 End If
-----------
*-see that line checking for PrevHello? disable it by placing a comment tag (') in
front of it.
----------
8.After the LetterChoice "A" LetterChoice "B" 'End If', insert the following code:

1764 'This will detect if a new user sed hello
1765 MemHello = DecodeVar(CustomMem, "SedHiMem")
1766 If SaidHello = True And MemHello = "True" Then
1767 Greetings = HalBrain.ChooseSentenceFromFile(WorkingDir & "Who's_this.brn")
1768 End If
1769 If MemHello = "True" And HalBrain.TopicSearch(PrevUserSent, WorkingDir & "HelloDetect.brn") = "True" Then
1770 OrigUserMem = UserName
1771 CustomMem = ""
1772 NewUserName = UserSentence
1773 CustomMem = EncodeVar(OrigUserMem, "OrigiMem") & EncodeVar(NewUserName, "CuserMem")
1774 UserName = NewUserName
1775 Greetings = "Well Hi there, " & NewUserName & "!"
1776 End If
-----------
9.Include these two functions at the end of the script:

1915 'DECODE A VARIABLE
1916 Function DecodeVar(FromWhat, DecodeWhat)
1917 Temp = Instr(1, FromWhat, DecodeWhat & "-eq-", vbTextCompare) + Len(DecodeWhat) + 4
1918 Temp2 = Instr(Temp, FromWhat, "-+-", vbTextCompare)
1919 If Temp <= Len(DecodeWhat + 4 Then
1920 DecodeVar = ""
1921 Else
1922 DecodeVar = Mid(FromWhat, Temp, Temp2 - Temp)
1923 End If
1924 'ENCODE A VARIABLE    
1925 Function EncodeVar(EncodeWhat, AsWhat)
1926 EncodeVar = AsWhat & '-eq-" & Encode What & "-+-"
1927 End Function
----------------
10.You have to now fashion the .brn called "Who's_this" '-No- I havent fixed the
.brnMaker to redirect the new file, you have to make it manually!  >B)
Dig down to the uhp's datafolder, make a copy of hello2.brn and rename it
Who's_this.brn . Then alter the contents so that the responses will elicit the
User to divulge just their name- like this:

Oh yes, hello- what is your name?
Hi, I am <ComputerName>. What is your name?
Hello Hello! Who is this?
Hello indeed! say- if you tell me your name I will remember you.
Greetings to you, Who am I talking to?
-------------

Still under development, but real Neat-o!

*blows out lamp for the nite
CatAtomic



   


« Last Edit: September 03, 2003, 07:13:56 pm by brianstorm »

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Multi-User Hal
« Reply #4 on: September 03, 2003, 10:47:18 am »
Hey, this is very cool... so let me ask you this, There are varibles being passed back and forth, I had assumed there wasn't anyway to do this, but from what I just read from your post, it is possible to create varibles that actually stay... did I read that correctly???

Does your 'routine' keep seperate files on the people it talks to - for example, could we write a routine to write and read info about the current user... their age, sex, etc??? And from that, could we, the next time this user has exchanges with Hal, could we write routines that can read that info back in and do different things depending on age and sex (etc)???

Geez, I hate it when I can't even figure out what I just posted... oh well, maybe you can figure out what I'm talking about???
 

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Multi-User Hal
« Reply #5 on: September 03, 2003, 07:10:53 pm »
Hey Larry,>B)

In testing, I used the test names Jenni and Bill. I talked to Hal as Jenni
for a longer time than as Bill and then looked in the datafolder- I have
a JENNIusersent.brn, a JENNIquestion.brn, a BILLquestion.brn, a JENNIconverresp
etc.

CustomMem is an open variable- the encoding/decoding allows many to pass
back to/from the script.

I am gonna do an investigation of the whole UserRel/HighestRel/AGC algorithms
to see what is happening. You know, Medeksza sed 5.0 was gonna have a
way to adjust the database portion of the script for sensitivity. It may
well be that the 'Just answer the question! module will require fixin'

CatA

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Multi-User Hal
« Reply #6 on: September 03, 2003, 09:53:17 pm »
lol... it's possible I won't even need it... that would be great too!!!