dupa

Author Topic: Medeksza's CustomMem script  (Read 4781 times)

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Medeksza's CustomMem script
« on: August 19, 2003, 11:01:31 pm »
Hey everybody,

I am currently writing the '.brn Maker' script! I am posting this because

the script needs to use CustomMem in order to operate. I suggest we are all

on the same page with this. In a previous post, I revealed my desire to

have multiple variables flowing from exchange to exchange. Medekza responded

and wrote these functions to Encode and Decode multiple variables

into and out of the CustomMem string:

'*********************
'Example of using CustomMem to store several custom variables
'Decode many custom variables out of the CustomMem Variable
TestVar1 = DecodeVar(CustomMem, "TestVar1")
TestVar2 = DecodeVar(CustomMem, "TestVar2")
TestVar3 = DecodeVar(CustomMem, "TestVar3")
TestVar4 = DecodeVar(CustomMem, "TestVar4")
'we output the variables to the Debug string
DebugInfo = DebugInfo & "TestVar1:" & TestVar1 & vbCrLf
DebugInfo = DebugInfo & "TestVar2:" & TestVar2 & vbCrLf
DebugInfo = DebugInfo & "TestVar3:" & TestVar3 & vbCrLf
DebugInfo = DebugInfo & "TestVar4:" & TestVar4 & vbCrLf
'We assign various random values to the variables if they are empty
'These values chosen during the first run should be kept in memory
'for the entire conversation
If TestVar1 = "" Then TestVar1 = Int(RND * 100)
If TestVar2 = "" Then TestVar2 = Int(RND * 100)
If TestVar3 = "" Then TestVar3 = Int(RND * 100)
If TestVar4 = "" Then TestVar4 = Int(RND * 100)
'We encode all the custom variables back into the CustomMem variable
CustomMem = EncodeVar(TestVar1, "TestVar1") & EncodeVar(TestVar2, "TestVar2") & EncodeVar(TestVar3, "TestVar3") & EncodeVar(TestVar4, "TestVar4")
'*************************


Then after the script unload portion of the UHP there are these two functions:


Function DecodeVar(FromWhat, DecodeWhat)
Temp = Instr(1, FromWhat, DecodeWhat & "-eq-", vbTextCompare) + Len(DecodeWhat) + 4
Temp2 = Instr(Temp, FromWhat, "-+-", vbTextCompare)
If Temp <= Len(DecodeWhat) + 4 Then
DecodeVar = ""
Else
DecodeVar = Mid(FromWhat, Temp, Temp2 - Temp)
End If
End Function

Function EncodeVar(EncodeWhat, AsWhat)
EncodeVar = AsWhat & "-eq-" & EncodeWhat & "-+-"
End Function

If one intends to keep up with what I'll be posting from this point on, you need to

have a UHP that has these two functions in the script. I have attached the script

Medekza posted- Create a project in the Brain Editor(all the test stuff is

 gonna be changed) and paste the code into a brainfile and check it out...).


CatAtomic:  >B)



« Last Edit: August 19, 2003, 11:05:22 pm by brianstorm »

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Medeksza's CustomMem script
« Reply #1 on: August 19, 2003, 11:11:38 pm »
don't think the attachment werked- o well , if not please just type

the code in and sorry for the inconvenience....!

CatA

------------

Yah, Yah, just zip 'em
« Last Edit: August 20, 2003, 04:23:21 am by brianstorm »

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Medeksza's CustomMem script
« Reply #2 on: August 20, 2003, 08:55:00 pm »
I'm lost, what's the purpose of this??? What will all this do in the end???

Tell you what I'm trying to figure out. My bot skips right past questions put to him/her... I've looked through the brain, I've found very little and what I did find was a generic assembly of answers... I know some questions are hard coded in a dll, How old are you gets a reply of 7 or 8 or 9 or whatever... Seems like there should be a question and answer brain file where these questions can be filed with the answers we wish our bot to reply with... like age, sex, hobbies, school, work, and the list goes on and on...

Can anyone figure out a routine to do this, kinda like you all did with the knock knock jokes???
 

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Medeksza's CustomMem script
« Reply #3 on: August 21, 2003, 08:55:51 am »

Hey Larry,

The purpose of all this- As far as the .brnMaker is concerned, instead of

digging down into your hard disc and manually build a .brn now Hal does it!

Hasn't anyone learned? The most important thing I learned from

the knock knock thing is that if HalBrain.AppendFile doesn't have

a .brn to Append to, IT MAKES ONE. Now, there is another DLL function

called HalBrain.Learn that splits the sentence between the linking verb.

I want to have Hal make a .brn that is the name of the subject and contains

the object. I want to see if files work using .nrn (neuron) and use that to

tell the two apart.I haven't even started trying that yet....eeee

For instance:

CatAtomic:a ball is round.
'Hal makes a .nrn named round.nrn and contains "a ball"
Dee Dee:If you say so!

CatAtomic:The earth is round.
'Hal Appends round.nrn -contains "a ball","the earth"
Dee Dee:Round like a ball?


Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Medeksza's CustomMem script
« Reply #4 on: August 21, 2003, 07:11:30 pm »
Hey now THAT is cool !!!

How about having Hal remember stuff??? lol, there's a post earilier about this, where the aim bot could tell the user every thing it learned about the user... ie , sex, age, etc... Now that would be a project...