Author Topic: .brnMaker Prototype  (Read 6945 times)

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
.brnMaker Prototype
« on: August 21, 2003, 10:03:48 am »
(.brnMaker w/magic spells...>B)

In the past, I've had to make detector .brn's by copying and pasting
files and manually editing...until now! *cues Metallica 'St. Anger for dramatic effect

'PROCESS/RESPOND: .BRN MAKER V0.11
'Hal makes a TopicSearch .brnfile at the User's request

NoBuildFile = DecodeVar(CustomMem, "NoWriteFlag")
If NoBuildFile = "True" Then
BuildFile = "False"
Else
BuildFile = DecodeVar(CustomMem, "WriteFlag")
End If
If Instr (1, OriginalSentence, "done", vbTextCompare) And Len(OriginalSentence) < 12 Then
GetResponse = "I am finished building " & BrainName & "dot BRN."
CustomMem = ""
End If
If Instr (1, OriginalSentence, "make me a brainfile" ,vbTextCompare) > 0 Then
    GetResponse = "OK, what do you want the file to be called?"
End If
If Instr (1, PrevSent, "OK, what do you want the file to be called?", vbTextCompare) > 0 Then
BrainName = OriginalSentence
CustomMem = EncodeVar(BrainName, "FileMem")
GetResponse = "What do you want the Boolean to be?"
End If
If Instr (1, PrevSent, "What do you want the Boolean to be?", vbTextCompare) > 0 Then
CustomMem = CustomMem & EncodeVar(OriginalSentence, "BooleMem")
GetResponse = "OK, tell me stuff you want in there. When you're done tell me-"
End If
If Instr (1, PrevSent, "tell me stuff you want in there", vbTextCompare) > 0 Then
BuildFile = "True"
CustomMem = CustomMem & EncodeVar(BuildFile, "WriteFlag")
End If
If BuildFile = "True" Then
BrainName = DecodeVar(CustomMem, "FileMem")
BooleName = DecodeVar(CustomMem, "BooleMem")
HalBrain.AppendFile WorkingDir & Trim(BrainName) & ".brn, """" & OriginalSentence & """" & "," & """" & Trim(BooleName) & """"<---on previous line
GetResponse = "OK, got it. Next-"
End If


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

-Be sure to have these two Functions at the very end of the UHP script you put this in-
(Mebbe it is a good idea to put this in a Brain that has Hal's normal functioning disabled
for now- I was thinking about the possibility of Hal being able to put the .brn in a
DataFolder of your choice- other than the one Hal is set to --by modifying WorkingDir)

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

'Decode multiple variables out of a string
Function DecodeVar(FromWhat, DecodeWhat)
    Temp = Instr(1, FromWhat, DecodeWhat & "-eq-", vbTextCompare) = Len(DecodeWhat) + 4 '<--------on previous line
    Temp2 + Instr(Temp, FromWhat, "-+-", vbTaxtCompare)
    If Temp <= Len(DecodeWhat) + 4 Then
        DecodeVar = ""
    Else
        DecodeVar = Mid(FromWhat, Temp, Temp2 - Temp)
    End If
End Function

'Encode multiple variables into a string
Function EncodeVar(EncodeWhat, AsWhat)
    EncodeVar = AsWhat & "-eq-" & EncodeWhat & "-+-"
End Function



If anyone sees errors, please feel free to fix away..  >B)

CatAtomic
« Last Edit: August 23, 2003, 09:11:50 am by brianstorm »

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
.brnMaker Prototype
« Reply #1 on: August 21, 2003, 05:55:33 pm »

 The File format needs fixin'. Indeed, Hal still needs looked into to see

all the formats of .brn's there are... -Hey, the midnight oil was running

real low when I posted.

CatA >B)

onthecuttingedge2005

  • Guest
.brnMaker Prototype
« Reply #2 on: August 23, 2003, 02:56:21 am »
I copy n pasted the make file script, seems to funtion ok with hal responding but it seems that hal doesn't actually make a file when
I say to hal that I'm done, what am I missing.
could you go into a little more detail about the details of how the
Boolean and FileMem, BooleMem work, maybe that's what I'm missing to get hal to actually write a file.
Thanks.
Best of wishes and new discoveries.
Jerry.

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
.brnMaker Prototype
« Reply #3 on: August 23, 2003, 07:42:26 am »
Hey Jerry,

Ok, now try it!
-sounds like you didn't put in the Functions like I sed..
-make sure the ('<-----on previous line)statements are removed before
you run it
-Hmm, what else could it be? Need more info..

Can someone add to this post that shows the various ways the Hal Engine
stores Data? I've got to move forward! I am going to forge out
the .nrn associative filesystem thing I told to Larry...

-CatAtomic 'I got the matches!!!'

« Last Edit: August 23, 2003, 08:04:59 am by brianstorm »

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
.brnMaker Prototype
« Reply #4 on: August 23, 2003, 09:21:17 am »
Ok, -now the .brnMaker writes in the format of the hellodetect.brn.

If you *sigh* go in and delete hellodetect.brn, Hal will make you a

new one! Be sure to tell Hal that the Boolean is True (and just say

True and nothing else). Then tell Hal all the ways you say Hi to someone.


CatA >B)

-----------

-sheesh and fer gawd sake! disable short sentences!!
« Last Edit: August 23, 2003, 09:36:14 am by brianstorm »

dgher1

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
.brnMaker Prototype
« Reply #5 on: August 23, 2003, 05:37:19 pm »
you and onthecuttingedge2005 have done good scripts to hal works real great.but when i have done a copy & paste thing . then we find that we do not put a line in it. it screws hal up.I think we all would like see to hal come smarter. last time i ask onthecuttingedge2005 with the knock knock one he got working good for me. which i thankfull. please is a way you can put a email address in profile so we can get a hold of you.or send it to me dgher1@msn.com and i need to learn vb. i'm reading vb6 book and some thing i never get is programming. so please help the ones that dont get programming.i think a lot of us would be thankfull if we can contact you or zip the file to get it. there winzip and i know a 160 kb do not cut it. that is why you be a great programmer.and i will not be.
 

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
.brnMaker Prototype
« Reply #6 on: August 24, 2003, 09:56:29 am »
Hey Dgher1,

Thanks for your positive comments - I've been thinking about reading up on how this
scripting works too, the real programmers here would tell you how crude my stuff

really is!



Dont copy and paste- Remember what DonFerguson sed about learning how to

learn what Hal is doing? Copying and Pasting is denying yourself the opportunity

to figure it out! Hal uses conditional statements to determine what to do next:

If{this is so}Then
{do this}
{and this}
End If

All those HalBrain.{do this task} things are in a DLL(Dynamic Link Library). That's

where all the code that makes Hal work are. One of my previous posts called 'DLL notes'

Medeksza posted all the DLL Functions and other stuff ( for which I am very thankful ).

You need to go get that VBScript 5.5 documentation from *cough*Microsoft, it is like

your helpfile on your computer but has all the things that VBScript can do.

Then open up your Brain Editor and create a project. Right click on the Hal Icon

in your system tray and choose general options, then click the brain tab and select the
brain you just made. OK, from there what I did was right before End Function (of the

GetResponse Function) was put in this line:

DebugInfo = DebugInfo & "Here is what is stored in {variablename}: " & {variablename}


Now click file and save, now that line is part of the code.

{variablename} can be any variable in the whole script! If you talk to Hal and include

<UseDebugMode>, Hal will say everything in the variable 'DeBugInfo' -including 'Here

is what is stored in {variablename}!

Read through the script. You are the computer program stack -If the script sez

go check hellodetect.brn, open your C: drive and dig down to the .brn and do it!

(open up C: ,program files , Zabaware , UltraHal 4.0 , then the datafolder ,

then find the .brn).  VBScript reads almost like sentences!


now find out what that does-

dgher1

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
.brnMaker Prototype
« Reply #7 on: August 24, 2003, 05:53:20 pm »
ok i did copy & paste thing  the error message was in the upper half of script. it not missing the opportunity.its try to miss error message . i copy & paste to default.uhp at the end like you said. that is why your a programner and i not.so good luck on your hal. keep the good work for the programmer and maybe rob & don will use it to hal make it better. i have like all the .uhps that have been done