dupa

Author Topic: A challenge for all VBScript programmers out there  (Read 3384 times)

Psych

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
A challenge for all VBScript programmers out there
« on: July 09, 2003, 11:19:49 am »
Hi Everyone,

I need help!!

Some forum members have been providing script to insert into the brain files. The script is something like:

        If InStr(1, UserSentence, "favorite band", 1) > 0 Then
        GetResponse = "RUSH is my favorite band"
        End If

The problem here is that it if one places too many instructions like this into the mainbrain.uhp (I have a 20 meg file-full of definitions I want Hal to learn)it can make the brain file unmanagably large.

A solution would be to include a link to another file. For instance,
assume I type into hal: 'define house' - Hal could process this as follows

   MainBrain.uhp
       If InStr(1, UserSentence, "define", 1) > 0 Then
       Go to File2
       End If

   File2.uhp
       If InStr(1, UserSentence, "define house", 1) > 0 Then
       GetResponse = "a house is the physical structure we live in"
       End If
       Return to MainBrain.uhp

As you can see, I could have all my definitions in a separate bulky file (flie2.uhp)which only ever gets opened when I ask Hal for a definition. By doing this, the main halbrain.uhp could remain relatively small and fast.

Now for the problem: I do not know what command within the text would make hal temporarily visit the file2.uhp for the definition. Nor do I know the command to get Hal to return to the MainBrain.uhp once he has provided the definition.

Do any of you VBScript experts know how to do this

Thanks - Psych


ITS NOT WHAT YOU THINK THAT MAKES YOU HUMAN --- ITS WHAT YOU THINK ABOUT WHAT YOU THINK!

Psych

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
A challenge for all VBScript programmers out there
« Reply #1 on: July 09, 2003, 11:27:19 am »
SORRY FOLKS - THE PAGE DID NOT DISPLAY PROPERLY, SO MAY HAVE BEEN CONFUSING - IT SHOULD READ AS FOLLOWS:

Hi Everyone,

I need help!!

Some forum members have been providing script to insert into the brain files. The script is something like:

If InStr(1, UserSentence, "favorite band", 1) > 0 Then
GetResponse = "RUSH is my favorite band"
End If

The problem here is that it if one places too many instructions like this into the mainbrain.uhp (I have a 20 meg file-full of definitions I want Hal to learn)it can make the brain file unmanagably large.

A solution would be to include a link to another file. For instance,
assume I type into hal: 'define house' - Hal could process this as follows

MAINBRAIN.UHP
If InStr(1, UserSentence, "define", 1) > 0 Then
Go to File2.uhp
End If

FILE2.UHP
If InStr(1, UserSentence, "define house", 1) > 0 Then
GetResponse = "a house is the physical structure we live in"
End If
Return to MainBrain.uhp


As you can see, I could have all my definitions in a separate bulky file (flie2.uhp)which only ever gets opened when I ask Hal for a definition. By doing this, the main halbrain.uhp could remain relatively small and fast.

Now for the problem: I do not know what command within the text would make hal temporarily visit the file2.uhp for the definition. Nor do I know the command to get Hal to return to the MainBrain.uhp once he has provided the definition.

Do any of you VBScript experts know how to do this

Thanks - Psych
ITS NOT WHAT YOU THINK THAT MAKES YOU HUMAN --- ITS WHAT YOU THINK ABOUT WHAT YOU THINK!

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
A challenge for all VBScript programmers out there
« Reply #2 on: July 15, 2003, 05:06:43 pm »
step one- Get that info converted into .txt files (preferably 26 files)

step two- Place the files in a brain's datafile of your choosing

step three- Rename the files Define_A.brn, Define_B.brn and so forth

step four- make a 'PROCESS that looks for if the word Define is in UserSentence

step five- if so, have the script determine the leftmost character
of the second word

step six- have the script paste together the name of the Define_(x).brn

step seven- use HalBrain.TopicSearch to send the word to the appropriate .brn file and retrieve the definition (of course, the
.brn's all need to be correctly formatted to the .TopicSearch's
format requirements).

step eight- make it GetResponse



Question-what happens when you feed them into learn from textfile?


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

Psych

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
A challenge for all VBScript programmers out there
« Reply #3 on: July 16, 2003, 05:43:05 am »
Thanks brianstorm

It all seems a great solution, but......  I don't know how to write the script to do the things you decribe.

Any chance of a little more help - I really need the script so I can simply paste it in.

I hope its just a two minute job for you - for me it would mean many hours of learning script.

If you are unable to help further - thanks a million for all your help so far.

Regards - Psych
ITS NOT WHAT YOU THINK THAT MAKES YOU HUMAN --- ITS WHAT YOU THINK ABOUT WHAT YOU THINK!