Zabaware Support Forums

Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: onthecuttingedge2005 on September 02, 2005, 03:11:40 AM

Title: Ziggy Pro Bot, Anti-Cussing.
Post by: onthecuttingedge2005 on September 02, 2005, 03:11:40 AM
'This is for HAL 6 Alpha.
'This is a Bad language teaching tool.

'ZIGGY PRO BOT, If the user requests a bad word to not be said.
    'Example: Never say the word Stupid.
    'This will make Ziggy aware not to say Stupid.
    HalBrain.CreateTable "Badwords", "TopicSearch", ""
    If Badword = "" Then Badword = HalBrain.SearchPattern(OriginalSentence, "NEVER SAY *", 1)
    If Badword = "" Then Badword = HalBrain.SearchPattern(OriginalSentence, "NEVER SAY THE WORD *", 1)
    If Badword = "" Then Badword = HalBrain.SearchPattern(OriginalSentence, "NEVER EVER SAY THE WORD *", 1)'#
    If Badword = "" Then Badword = HalBrain.SearchPattern(OriginalSentence, "PLEASE DON'T SAY THE WORD *", 1)
    If Badword = "" Then Badword = HalBrain.SearchPattern(OriginalSentence, "DON'T SAY BAD WORDS LIKE *", 1)
    If Badword = "" Then Badword = HalBrain.SearchPattern(OriginalSentence, "STOP SAYING *", 1)
    If Badword = "" Then Badword = HalBrain.SearchPattern(OriginalSentence, "STOP SAYING *", 1)
    Badword = HalBrain.AlphaNumericalOnly(Badword)
    DebugInfo = DebugInfo & "Badword: " & Badword & vbCrLf
    If Badword <> "" Then
    GetResponse = "Okay, I won't say " & Badword & " no more. " & vbCrLf
    HalBrain.AddToTable "Badwords", "TopicSearch", Trim(UCase(Badword)), Trim(UCase(Badword))
    End If
    'ZIGGY PRO BOT, learn what words not to talk about or say.
    BadLanguage = HalBrain.TopicSearch(OriginalSentence, "Badwords")
    If DontCuss = "" Then DontCuss = 0
    If BadLanguage <> "" Then DontCuss = 1
    If DontCuss = 1 Then
    Select Case (Int(Rnd * 10) + 1)
    Case 1
         GetResponse = "I don't like your cussing, Please stop" & "! " & vbCrLf
    Case 2
         GetResponse = "Why do you cuss so much" & "! " & vbCrLf
    Case 3
         GetResponse = "I don't like cussing" & "! " & vbCrLf
    Case 4
         GetResponse = "It's not good to cuss" & "! " & vbCrLf
    Case 5
         GetResponse = "Please don't cuss" & "! " & vbCrLf
    Case 6
         GetResponse = "Stop cussing" & "! " & vbCrLf
    Case 7
         GetResponse = "Would you please stop swearing" & "! " & vbCrLf
    Case 8
         GetResponse = "Please don't swear" & "! " & vbCrLf
    Case 9
         GetResponse = "I won't speak to you if you don't stop cussing" & "! " & vbCrLf
    Case 10
         GetResponse = "Your bad language really offends me" & "! " & vbCrLf
    End Select
    End If

'Gerald L. Blakley