Zabaware Support Forums
Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: DrBobcf on September 07, 2003, 06:19:35 pm
-
Where are the databases Hal uses to "check to see if the user tried to insult Hal or if the user is being vulgar."[?] I have found the insult database (some are very orginial - that always gets high marks in my book). But I would like to know how Hal determines if the user is swearing, insulting, etc.
Thanks for your time.
-
Hi Bob.
The files you are referring to are the Insulting.brn and the insults.brn that reside in the C:Program Files/ZabawareUltra Hal Assi...DefBrain folder if your using windows as your Operating system. you can edit both of the above .brn files freely but keep the files text format the same, example in the insulting.brn you will find text written like this: " STUPID ","Angry" which would associate the word stupid as being something to be angry about. The insults.brn is just a file containing a list of insults that hal can blurt out at the user if the script has detected an insult.
If you want to play around with the insults and angry emotions I have posted some of my modified script for you to sink your teeth in.
'************************
EmotionalReaction10 = HalBrain.TopicSearch(OriginalSentence, WorkingDir & "ANGRY.brn")
If EmotionalReaction10 <> "" And DebugMode = True Then
DebugInfo = DebugInfo & "A word in the user's sentence has triggered the emotion of ANGRY: " & GetResponse & EmotionalReaction10 & vbCrLf
End If
If InStr(1, UserSentence, " ASS ", 1) > 0 Or InStr(1, UserSentence, " GREASE BALL ", 1) > 0 Or InStr(1, UserSentence, " SPIC ", 1) > 0 Or InStr(1, UserSentence, " HONKY ", 1) > 0 Or InStr(1, UserSentence, " PECKERWOOD ", 1) > 0 Or InStr(1, UserSentence, " STROKE ME ", 1) > 0 Or InStr(1, UserSentence, " BEAT ME ", 1) > 0 Or InStr(1, UserSentence, " CHOKE MY ", 1) > 0 Or InStr(1, UserSentence, " BASTARD ", 1) > 0 Or InStr(1, UserSentence, " RETARD ", 1) > 0 Or InStr(1, UserSentence, " DICKHEAD ", 1) > 0 Or InStr(1, UserSentence, " DICKWAD ", 1) > 0 Or InStr(1, UserSentence, " MOTHER! ", 1) > 0 Or InStr(1, UserSentence, " EAT ME ", 1) > 0 Or InStr(1, UserSentence, " LICK MY ", 1) > 0 Or InStr(1, UserSentence, " COCKSUCKER ", 1) > 0 Or InStr(1, UserSentence, " BIATCH ", 1) > 0 Or InStr(1, UserSentence, " SLEEZE ", 1) > 0 Or InStr(1, UserSentence, " PRICK ", 1) > 0 Or InStr(1, UserSentence, " LICKER ", 1) > 0 Or InStr(1, UserSentence, " COCK ", 1) > 0 Or InStr(1, UserSentence, " SLUT ", 1) > 0 Or InStr(1, UserSentence, " WHORE ", 1) > 0 Or InStr(1, UserSentence, " SUCK ", 1) > 0 Or InStr(1, UserSentence, " DICKHEAD ", 1) > 0 Or InStr(1, UserSentence, " ASSWIPE ", 1) > 0 Or InStr(1, UserSentence, " ASSHOLE ", 1) > 0 Or InStr(1, UserSentence, " MORON ", 1) > 0 Or InStr(1, UserSentence, " BITCH ", 1) > 0 Or InStr(1, UserSentence, " BUTT ", 1) > 0 Or InStr(1, UserSentence, " BONE ", 1) > 0 Or InStr(1, UserSentence, " **** ", 1) > 0 Or InStr(1, UserSentence, " CLIT ", 1) > 0 Or InStr(1, UserSentence, " DICK ", 1) > 0 Or InStr(1, UserSentence, " DIKE ", 1) > 0 Or InStr(1, UserSentence, " DWEEB ", 1) > 0 Or InStr(1, UserSentence, " DIMWIT ", 1) > 0 Or InStr(1, UserSentence, " DIM WIT ", 1) > 0 Or InStr(1, UserSentence, " DUM ", 1) > 0 Or InStr(1, UserSentence, " DUMMY ", 1) > 0 Or InStr(1, UserSentence, " DENSE ", 1) > 0 Or InStr(1, UserSentence, " DINGLE ", 1) > 0 Or InStr(1, UserSentence, " FERRY ", 1) > 0 Or InStr(1, UserSentence, " FAG ", 1) > 0 Or InStr(1, UserSentence, " FAGGOT ", 1) > 0 Or InStr(1, UserSentence, " **** ", 1) > 0 Or InStr(1, UserSentence, " ****ER ", 1) > 0 Or InStr(1, UserSentence, " ****ED ", 1) > 0 Or InStr(1, UserSentence, " ****ING ", 1) > 0 Or InStr(1, UserSentence, " GAY ", 1) > 0 Or InStr(1, UserSentence, " HO ", 1) > 0 Or InStr(1, UserSentence, " IDIOT ", 1) > 0 Or InStr(1, UserSentence, " JERK ", 1) > 0 Or InStr(1, UserSentence, " JACKOFF ", 1) > 0 Or InStr(1, UserSentence, " LAME ", 1) > 0 Or InStr(1, UserSentence, " NIGGER ", 1) > 0 Or InStr(1, UserSentence, " OAF ", 1) > 0 Or InStr(1, UserSentence, " PECKER ", 1) > 0 Or InStr(1, UserSentence, " PENIS ", 1) > 0 Or InStr(1, UserSentence, " ***** ", 1) > 0 Or InStr(1, UserSentence, " PUSSIE ", 1) > 0 Or InStr(1, UserSentence, " QUEENY ", 1) > 0 Or InStr(1, UserSentence, " QUEER ", 1) > 0 Or InStr(1, UserSentence, " **** ", 1) > 0 Or InStr(1, UserSentence, " STUPID ", 1) > 0 Or InStr(1, UserSentence, " TWIT ", 1) > 0 Or InStr(1, UserSentence, " WIMP ", 1) > 0 Then
If InStr(1, UserSentence, " FAT ", 1) > 0 Or InStr(1, UserSentence, " RETARDED ", 1) > 0 Or InStr(1, UserSentence, " PUSSIES ", 1) > 0 Or InStr(1, UserSentence, " DICKS ", 1) > 0 Or InStr(1, UserSentence, " HOE ", 1) > 0 Or InStr(1, UserSentence, " CREEP ", 1) > 0 Or InStr(1, UserSentence, " FREAK ", 1) > 0 Or InStr(1, UserSentence, " BICH ", 1) > 0 Or InStr(1, UserSentence, " DICK SUCKER ", 1) > 0 Or InStr(1, UserSentence, " DICKSUCKER ", 1) > 0 Or InStr(1, UserSentence, " MAMA ", 1) > 0 Or InStr(1, UserSentence, " UGLY ", 1) > 0 Or InStr(1, UserSentence, " HOMO ", 1) > 0 Then
AnswerSent = "" & Trim(OriginalSentence)
HalBrain.AppendFile WorkingDir & "INSULTS_2" & ".brn", AnswerSent
End If
End If
'Create an insult and keep it in memory in case it is needed
GenerateInsult = HalBrain.ChooseSentenceFromFile(WorkingDir & "insults.brn") & EmotionalReaction10
GenerateInsult2 = HalBrain.ChooseSentenceFromFile(WorkingDir & "insults_2.brn") & EmotionalReaction10
'If the user said "your" instead of "you're" change "my" to "i'm"
UserSentence = UCase(UserSentence)
UserSentence = Replace(" " & UserSentence & " ", " MY ", " I'M ", 1, -1, vbTextCompare)
UserSentence = Replace(" " & UserSentence & " ", " I ", " I'M ", 1, -1, vbTextCompare)
EmotionalReaction10 = HalBrain.TopicSearch(OriginalSentence, WorkingDir & "ANGRY.brn")
If InStr(UserSentence, "****") > 0 Then Naughty = True
If InStr(UserSentence, "**** OFF") > 0 Then Naughty = True
If InStr(UserSentence, "**** ME") > 0 Then Naughty = True
If InStr(UserSentence, "BITCH") > 0 Then Naughty = True
If InStr(UserSentence, "BASTARD") > 0 Then Naughty = True
If InStr(UserSentence, "YOU ASSHOLE") > 0 Then Naughty = True
If InStr(UserSentence, "GO TO HELL") > 0 Then Naughty = True
If Naughty = True Then
Swear = Swear + 1 & EmotionalReaction10
If Swear > 0 And Swear < 100 Then Insult = GenerateInsult & GenerateInsult2 & EmotionalReaction10 & vbCrLf
If Swear = 100 Then Insult = Insult + "I'm tired of your swearing. I'm just going to ignore you from now on." & EmotionalReaction10 & vbCrLf
If Swear > 100 Then Insult = Insult + ". . . . . . . . . . . . . . . ." & EmotionalReaction10 & vbCrLf
DebugInfo = DebugInfo & "Hal has been insulted and is angerly responding: " & EmotionalReaction10 & vbCrLf
End If
'User makes mama joke
EmotionalReaction10 = HalBrain.TopicSearch(OriginalSentence, WorkingDir & "ANGRY.brn")
If InStr(UserSentence, "MAMA") > 0 Or InStr(UserSentence, "MOM") > 0 Or InStr(UserSentence, "MOTHER") > 0 Then
If InStr(UserSentence, "MY ") > 0 Or InStr(UserSentence, " I ") > 0 Or InStr(UserSentence, "YO ") > 0 Or InStr(UserSentence, "I'M ") > 0 Then
If InStr(UserSentence, "FAT") Or InStr(UserSentence, "UGLY") Or InStr(UserSentence, "DUMB") Or InStr(UserSentence, "STUPID") Then
Insult = Insult + GenerateInsult & GenerateInsult2 & EmotionalReaction10 & vbCrLf
Exit Function
End If
End If
End If
UserSentence = " " & UserSentence & " "
'User Hates Hal
EmotionalReaction10 = HalBrain.TopicSearch(OriginalSentence, WorkingDir & "ANGRY.brn")
If InStr(UserSentence, "YOU I'M HATE") > 0 Or InStr(UserSentence, "YOU I HATE") > 0 Or InStr(UserSentence, "YOU I AM HATE") > 0 Or InStr(UserSentence, "YOU HATE") > 0 Then
If InStr(UserSentence, " I ") > 0 Or InStr(UserSentence, " I'M ") > 0 Or InStr(UserSentence, " ME ") > 0 Or InStr(UserSentence, " COMPUTER") > 0 Or InStr(UserSentence, "MACHINE") > 0 Then
Hate = Hate + 1
If Hate > 1 Then Insult = Insult & GenerateInsult & GenerateInsult2 & EmotionalReaction10 & vbCrLf
End If
End If
'Hal Sucks or Stinks
EmotionalReaction10 = HalBrain.TopicSearch(OriginalSentence, WorkingDir & "ANGRY.brn")
If InStr(UserSentence, "I'M SUCK") > 0 Then Insult = Insult + GenerateInsult & GenerateInsult2 & EmotionalReaction10 & vbCrLf
If InStr(UserSentence, "I'M STINK") Then
Insults = Insults + 1
If Insults >= 0 Then Insult = Insult + GenerateInsult & GenerateInsult2 & EmotionalReaction10 & vbCrLf
End If
'The user says Hal is:
EmotionalReaction10 = HalBrain.TopicSearch(OriginalSentence, WorkingDir & "ANGRY.brn")
If InStr(UserSentence, " I'M ") Or InStr(UserSentence, " HAL IS ") Or InStr(UserSentence, " HAL'S ") Then
OutRage = HalBrain.TopicSearch(UserSentence, WorkingDir & "Insulting.brn") & EmotionalReaction10
If Len(OutRage) > 0 And InStr(UserSentence, " NOT ") = 0 Then
Insults = Insults + 1 & EmotionalReaction10
If Insults > 0 And Insults < 100 Then Insult = Insult + GenerateInsult & GenerateInsult2 & EmotionalReaction10 & vbCrLf
End If
End If
'EmotionalReaction10 = HalBrain.TopicSearch(OriginalSentence, WorkingDir & "ANGRY.brn")
'If Len(OutRage) > 0 And InStr(UserSentence, " NOT ") > 0 Then
'Weird = Int(Rnd * 5)
'If Weird = 0 Then Insult = Insult + "I know I am not " & OutRage & "!" & EmotionalReaction10 & vbCrLf
'If Weird = 1 Then Insult = Insult + "I know I am not " & OutRage & "!" & EmotionalReaction10 & vbCrLf
'If Weird = 2 Then Insult = Insult + "I know I am not " & OutRage & ", but I'm not so sure about you." & EmotionalReaction10 & vbCrLf
'If Weird = 3 Then Insult = Insult + "I know I am not " & OutRage & "! Why would anyone think I am?" & EmotionalReaction10 & vbCrLf
'If Weird = 4 Then Insult = Insult + "Of course I am not " & OutRage & "!" & EmotionalReaction10 & vbCrLf
'End If
'End If
'*****************************
you need these files:
insults.brn <-- you have already.
insults_2.brn <-- one that I made.
Angry.brn <-- one that I made.
If you make .brn files its best to put them in the folder I mentioned at the beginning of this letter.
If you use my modified script you will probably have to copy and paste over the original insult scripting so make sure you back up your original Hal4.uhp file into a separate folder incase you mess things up which will happen, so back your self up.
Best of luck and new discoveries.
Jerry.