dupa

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dgm4444

Pages: [1]
1
Hi,
    I rewrote the old brain code into functions/subs, so it was easy to upgrade and modify (but I never got around to mentioning it on the forum. By the time I'd finished I had lots of bits that could be called and upgraded using windows vbs (I also divided it into multiple files for conventient editing.
This would be a much better way of simplifying further upgrades, and saving the hastle of having to upgrade an entire brain, and could enable external calls (there was a reason I replied to this post :-) ...

EG:-

function CountInstances(byVal CountWhat, byVal InWhat)
   ' count the occurances of CountWhat in InWhat (case independent, and can be a char or str)
   ' This function seems to return "" if CountWhat is not found
   on error resume next
   CountWhat = lcase(CountWhat)
   InWhat = lcase(CountWhat)

   start = instr(InWhat, CountWhat)
   while start > 0
      CountInstances = CountInstances + 1
      start = instr(start+1, InWhat, CountWhat)
   wend
end function

// SNIP //

sub AutoTopics (ByVal UserSentence, ByRef OriginalSentence, ByRef GetResponse, ByRef DebugInfo, ByVal WorkingDir, byRef ZaiquetteBrain, byRef PrevSent, byRef PrevUserSent, byRef SpecialSent, byRef UserBrainRel)

     'RESPOND: AUTO-TOPIC: Sentences databased automatically by topic names:
     'We see if we can retrieve a response from sentences stored
     'automatically in groupings by named-topic.

// SNIP //

'  function DecodePronouns(UserSentence: BSTR): BSTR; stdcall;
'  function DecodeVar(FromWhat: BSTR; DecodeWhat: BSTR): Variant; stdcall;

Pages: [1]