Here is the current emotional project I just started and will update it as I go when I have time to do so.
recent update on advanced emotion project below, you are welcome to modify the project along with me and visa versa as we go.
updated 7/12/2012 6:01PM PST
Rem Type=Plugin
Rem Name=Advanced Emotions
Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge2005
Rem Host=All
'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
lblPlugin(0).Caption = "Advanced Emotions Plug-in, This Plug-in Gives HAL Emotions and other optional abilities."
lblPlugin(0).Move 120, 10, 3300, 1000
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub
Rem PLUGIN: PLUGINAREA7
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.
If HalBrain.CheckTableExistence(UserName & "_Mad") = False Then HalBrain.CreateTable UserName & "_Mad", "Sentence", ""
If HalBrain.CheckTableExistence(UserName & "_Sadness") = False Then HalBrain.CreateTable UserName & "_Sadness", "Sentence", ""
If HalBrain.CheckTableExistence(UserName & "_Happy") = False Then HalBrain.CreateTable UserName & "_Happy", "Sentence", ""
If HalBrain.CheckTableExistence(UserName & "_Surprised") = False Then HalBrain.CreateTable UserName & "_Surprised", "Sentence", ""
'Here we can measure the amount of anger
AngerCounter = AngryCount(UserName)
'Here we can measure the amount of happiness.
HappyCounter = HappinessCount(UserName)
'Here we measure the amount of Sadness
SadnessCounter = SadnessCount(UserName)
'Here we measure the amount of surprise
SurprisedCounter = SurprisedCount(UserName)
'Negative and forceful
Anger = 0
'ChkEmotion = EmotionDetect(UserSentence)
UserSent = Trim(Ucase(UserSentence))
ChkEmotion = HalBrain.TopicSearch(UserSent, "emotion")
ChkEmotion = Trim(Ucase(ChkEmotion))
If ChkEmotion <> "" Then
HalBrain.ReadOnlyMode = False
Dim EmotQuery1()
If ChkEmotion = "HAPPY" Then
HalBrain.RunQuery "DELETE FROM " & UserName & "_Mad" & " WHERE recordId = 1", EmotQuery1
End If
If ChkEmotion = "ANGRY" Then
HalBrain.AddToTable UserName & "_Mad", "Sentence", "1",""
End If
Annoyance = 0
Contempt = 0
Disgust = 0
Irritation = 0
'Negative and not in control
Anxiety = 0
Embarrassment = 0
Fear = 0
Helplessness = 0
Powerlessness = 0
Worry = 0
'Negative thoughts
Doubt = 0
Envy = 0
Frustration = 0
Guilt = 0
Shame = 0
'Negative and passive
Boredom = 0
Despair = 0
Disappointment = 0
Hurt = 0
Sadness = 0
Dim EmotQuery2()
If ChkEmotion = "HAPPY" Then
HalBrain.RunQuery "DELETE FROM " & UserName & "_Sadness" & " WHERE recordId = 1", EmotQuery2
End If
If ChkEmotion = "SAD" Then
HalBrain.AddToTable UserName & "_Sadness", "Sentence", "1",""
End If
'Agitation
Stress = 0
Shock = 0
Tension = 0
'Positive and lively
Amusement = 0
Delight = 0
Elation = 0
Excitement = 0
Happiness = 0
Dim EmotQuery3()
If ChkEmotion = "HAPPY" Then
HalBrain.RunQuery "DELETE FROM " & UserName & "_Mad" & " WHERE recordId = 1", EmotQuery3
End If
If ChkEmotion = "HAPPY" Then
HalBrain.AddToTable UserName & "_Happy", "Sentence", "1", ""
End If
Joy = 0
Pleasure = 0
'Caring
Affection = 0
Empathy = 0
Friendliness = 0
Love = 0
'Positive thoughts
Courage = 0
Hope = 0
Pride = 0
Satisfaction = 0
Trust = 0
'Quiet positive
Calm = 0
Content = 0
Relaxed = 0
Relieved = 0
Serene = 0
'Reactive
Interest = 0
Politeness = 0
Surprised = 0
Dim EmotQuery4()
If ChkEmotion = "SURPRISED" And HappyCounter > AngerCounter Then
HalBrain.RunQuery "DELETE FROM " & UserName & "_Mad" & " WHERE recordId = 1", EmotQuery4
End If
If ChkEmotion = "SURPRISED" Then
HalBrain.AddToTable UserName & "_Surprised", "Sentence", "1", ""
End If
'set face to counted emotional variables.
'if HAL is angry then he will stay angry
'until the user makes HAL happy again.
'HAL will remember what emotional state
'he/she is in and continue that state.
If HappyCounter > AngerCounter And SadnessCounter Then
HalCommands = "<HAPFILE>Happy.hap</HAPFILE>"
HalCommands = HalCommands
End If
If AngerCounter > HappyCounter And SadnessCounter Then
HalCommands = "<HAPFILE>Angry.hap</HAPFILE>"
HalCommands = HalCommands
End If
If SadnessCounter > AngerCounter And HappyCounter Then
HalCommands = "<HAPFILE>Sad.hap</HAPFILE>"
HalCommands = HalCommands
End If
End If
Rem PLUGIN: FUNCTIONS
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.
'Anger counter
Function AngryCount(UserName)
Dim EmotQuery5()
If HalBrain.RunQuery("SELECT count(*) FROM " & Trim(UserName) & "_Mad", EmotQuery5) = True Then
AngryCount = EmotQuery5(1,0)
End If
End Function
'Happiness counter
Function HappinessCount(UserName)
Dim EmotQuery6()
If HalBrain.RunQuery("SELECT count(*) FROM " & Trim(UserName) & "_Happy", EmotQuery6) = True Then
HappinessCount = EmotQuery6(1,0)
End If
End Function
'Sadness counter
Function SadnessCount(UserName)
Dim EmotQuery7()
If HalBrain.RunQuery("SELECT count(*) FROM " & Trim(UserName) & "_Sadness", EmotQuery7) = True Then
SadnessCount = EmotQuery7(1,0)
End If
End Function
'Surprised counter
Function SurprisedCount(UserName)
Dim EmotQuery8()
If HalBrain.RunQuery("SELECT count(*) FROM " & Trim(UserName) & "_Surprised", EmotQuery8) = True Then
SurprisedCount = EmotQuery8(1,0)
End If
End Function
'Lets create an emotional detection function that we can
'use in our emotional code.
Function EmotionDetect(UserSentence)
'PROCESS: EMOTIONAL REACTIONS
'We enable Hal's expressions to respond to common verbal cues.
'The verbal cues are identified in the editable table "emotion"
If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
EmotionalReaction = Trim(Ucase(HalBrain.TopicSearch(UserSentence, "emotion")))
EmotionDetect = EmotionalReaction
End If
End Function
Jerry