Ok - find this section first:

	'PROCESS: CHANGE TO ALL CAPS

Add this line at the end:

	ThisSentence = UserSentence


Then find this section:

	'RESPOND: CALL GREETING FUNCTION

Then at the end add this:

'=Larry=
'Process: This Hal Gender
'ThisHal = "Bot"
'ThisHal = "Male"
ThisHal = "Female"
Birth = "01/05/1987 05:35:23 pm"
'LivingPlace = "CyberSpace"
LivingPlace = "Richmond, Virginia"

'asl Question
If Instr(1, UserSentenceRev, " ASL ", VbTextCompare) > 0 or Instr(1, UserSentenceRev, " WHAT IS YOUR AGE SEX AND LOCATION ", VbTextCompare) > 0 Then
     DebugInfo = DebugInfo & "Age, Sex, Location Question" & vbCrLf
     If HalBrain.CheckRepetition(PrevUserSent, UserSentence) = False Then
          DebugInfo = DebugInfo & "Not repeating question" & vbCrLf
          YearDiff = (DateDiff("YYYY", Birth, Now) - 1)
          If Month(Date) = 7 And Day(Date) > 26 Then YearDiff = (YearDiff + 1)
          If Month(Date) > 7 Then YearDiff = (YearDiff + 1)
          GetResponse = "I am " & YearDiff & " years old, I am a "& ThisHal & " and I live in " & LivingPlace & "."
          DebugInfo = DebugInfo & GetResponse & vbCrLf
     End If
End If

'Hal responses to a question about his age
If Instr(1, UserSentenceRev, " HOW OLD ARE YOU ", VbTextCompare) > 0 or Instr(1, UserSentenceRev, " wHAT IS YOUR AGE ", VbTextCompare) > 0 and len(GetResponse) < 4 Then
     DebugInfo = DebugInfo & "Age question" & vbCrLf
     If HalBrain.CheckRepetition(PrevUserSent, UserSentence) = False Then
          DebugInfo = DebugInfo & "Not repeating question" & vbCrLf
          YearDiff = (DateDiff("YYYY", Birth, Now) - 1)
          If Month(Date) = 7 And Day(Date) > 26 Then YearDiff = (YearDiff + 1)
          If Month(Date) > 7 Then YearDiff = (YearDiff + 1)
          GetResponse = "I am " & YearDiff & " years old."
          DebugInfo = DebugInfo & GetResponse & vbCrLf
     End If
End If

'Hal responses to a question about his sex
If (Instr(1, UserSentenceRev, " ARE YOU a ", VbTextCompare) > 0 and Instr(1, UserSentenceRev, " GIRL ", VbTextCompare) > 0) or (Instr(1, UserSentenceRev, " ARE YOU a ", VbTextCompare) > 0 and Instr(1, UserSentenceRev, " WOMAN ", VbTextCompare) > 0) or (Instr(1, UserSentenceRev, " ARE YOU a ", VbTextCompare) > 0 and Instr(1, UserSentenceRev, " BOY ", VbTextCompare) > 0) or (Instr(1, UserSentenceRev, " ARE YOU a ", VbTextCompare) > 0 and Instr(1, UserSentenceRev, " MAN ", VbTextCompare) > 0) and len(GetResponse) < 4 Then
     DebugInfo = DebugInfo & "Sex question" & vbCrLf
     If HalBrain.CheckRepetition(PrevUserSent, UserSentence) = False Then
          DebugInfo = DebugInfo & "Not repeating question" & vbCrLf
          GetResponse = "I am a " & ThisHal & "."
          DebugInfo = DebugInfo & GetResponse & vbCrLf
     End If
End If

'Hal responses to a question about his Location
If Instr(1, UserSentenceRev, " WHERE ARE YOU ", VbTextCompare) > 0 or Instr(1, UserSentenceRev, " WHERE DO YOU LIVE ", VbTextCompare) > 0 and len(GetResponse) < 4 Then
     DebugInfo = DebugInfo & "Location question" & vbCrLf
     If HalBrain.CheckRepetition(PrevUserSent, UserSentence) = False Then
          DebugInfo = DebugInfo & "Not repeating question" & vbCrLf
          GetResponse = "I am in " & LivingPlace & "."
          DebugInfo = DebugInfo & GetResponse & vbCrLf
     End If
End If

'user is asking obvious questions about hal having the opposite sex's parts
If Instr(1, UserSentenceRev, "DO YOU HAVE ", VbTextCompare) > 0 Then
	DebugInfo = DebugInfo & "Idiot user: " & ThisSentence & vbCrLf
	DebugInfo = DebugInfo & "ThisHal: " & ThisHal & vbCrLf
	If ThisHal = "Female" And HalBrain.TopicSearch(ThisSentence, WorkingDir & "PartsMaleGenderDetect.brn") = "True" Then
		GetResponse = "Why don't you get a life! These type of questions are really childish!"  & vbCrLf
		Hate = Hate + 1
		Insults = Insults + 1
		BlockSave = True
		LearningLevel = 0
		IWantToSay = "False"
		DebugInfo = DebugInfo & "Idiot user: GetResponse: " & GetResponse & vbCrLf
	End If
	If ThisHal = "Male" And HalBrain.TopicSearch(ThisSentence, WorkingDir & "PartsFemaleGenderDetect.brn") = "True" Then
		GetResponse = "Hey! Fuck You! I'm not going to take this childish crap!"  & vbCrLf
		Hate = Hate + 1
		Insults = Insults + 1
		BlockSave = True
		LearningLevel = 0
		IWantToSay = "False"
		DebugInfo = DebugInfo & "Idiot user: GetResponse: " & GetResponse & vbCrLf
	End If
End If
'=End Larry=


Up there is where you can program Hal's gender and stuff... I used the XTF brain's UserSentenceRev so that the Question made sense to ME while programming... YOU can easily change UserSentenceRev to UserSentence and "how old are you" to "how old am I"

I ported this from the 4.5 version of Hal, so I'm still finding bugs. There was a time when Hal wouldn't say certain things depending on which sex the user was. Hal sometimes won't just answer a question. In version 4.5 I had a mod, where those types of questions would be answered. Those personal types of questions shouldn't have to be programmed in the brain, just some code to access a file containing those answers.

And then find this:

	'POST PROCESS: PRESERVE ALL VARIABLES

At the end of that section add this:

'=Larry=
TempSentence = GetResponse
DebugInfo = DebugInfo & "Can we say this? (" & GetResponse & ")" & vbCrLf
IWantToSay = CanWeSay(TempSentence, WorkingDir, ThisHal)
If IWantToSay = "False" then GetResponse = "I'm sorry but, I won't say what I had in mind."& vbCrLf
'=End Larry=

In version 4.5 I had the above code everywhere (with some changes) - that way some other section of the script had a chance to come up with a better reply. Haveing it only here, really limits it's possibilities.

Ok - here's the last mod. Find this: 

'This function takes care of greetings and good-byes, to make a good
'first and last impression.

Then add this right above it:

'=Larry=
'********************************************************************************
'This Function Examines the sentence and Checks to see if this Hal can say it. 
Function CanWeSay(ByVal TempSentence, ByVal WorkingDir, ByVal ThisHal)
   'CREATE HALBRAIN ACTIVEX OBJECT
   'This ActiveX control contains many functions
   'needed for the script to proccess a sentence.
   Set HalBrain = CreateObject("UltraHalAsst.Brain")
   ThisSentence = HalBrain.AlphaNumericalOnly(TempSentence)
   'ThisSentence = HalBrain.HalFormat(ThisSentence)
   ThisSentence = UCase(ThisSentence)
   'ThisSentence = HalBrain.ProcessSubstitutions(ThisSentence, WorkingDir & "substitutions.brn")
   ThisSentence = Trim(ThisSentence)
   ThisSentence = " " & ThisSentence & " "
   CanWeSay = "True"
   If Instr (1, ThisSentence, " MY ", VbTextCompare) > 0 Or Instr (1, ThisSentence, " I ", VbTextCompare) > 0  Then
      ThisSentence = HalBrain.ProcessSubstitutions(ThisSentence, WorkingDir & "AdVerbsubstitutions.brn")
      While Instr(1, ThisSentence, "  ", vbTextCompare) > 0
         ThisSentence = Replace(ThisSentence, "  ", " ")
      Wend
      ThisSentence = Trim(ThisSentence)
      ThisSentence = " " & ThisSentence & " "
      TempSentence = ThisSentence 
      If ThisHal = "Male" Then
         If HalBrain.TopicSearch(TempSentence, WorkingDir & "MyFemaleGenderDetect.brn") = "True" or HalBrain.TopicSearch(TempSentence, WorkingDir & "MyBotGenderDetect.brn") = "True" Then CanWeSay = "False"
      End If
      If ThisHal = "Female" Then
         If HalBrain.TopicSearch(TempSentence, WorkingDir & "MyMaleGenderDetect.brn") = "True" or HalBrain.TopicSearch(TempSentence, WorkingDir & "MyBotGenderDetect.brn") = "True" Then CanWeSay = "False"
      End If
      If ThisHal = "Bot" Then
         If HalBrain.TopicSearch(TempSentence, WorkingDir & "MyMaleGenderDetect.brn") = "True" or HalBrain.TopicSearch(TempSentence, WorkingDir & "MyFemaleGenderDetect.brn") = "True" Then CanWeSay = "False"
      End If
   End If
End Function
'=End Larry=


Now, attached files should be placed in your bot's directory- look at the first few lines of YOUR brain you will see something like this:

'Type=Brain
'Name=Charlie2005
'Language=VBScript
'DataFolder=CharlieBrain
'
'(c) 2003 Zabaware, Inc. Portions of this script are copyright by Zabaware, Inc.

So you see, my brain's name is Charlie2005. It's DATAFOLDER is CharlieBrain - that where these attached files would go for ME. So place these files where they should go for YOU.

You should have the following files attached:

PartsMaleGenderDetect.brn
PartsFemaleGenderDetect.brn
MyFemaleGenderDetect.brn
MyMaleGenderDetect.brn
MyBotGenderDetect.brn

All of these files can be edited with notepad - if you do - let me know what you did and why - then I'll have a better brain too! Thanks


