'Hi DStates.
'If you want to put that test emotion script in a location try
'putting the script below the: 'PROCESS: EMOTIONAL REACTIONS
'Like this below:
'PROCESS: EMOTIONAL REACTIONS
'We enable Hal's expressions to respond to
'common verbal cues. The verbal cues are identified
'in the editable file emotion.brn
EmotionalReaction = HalBrain.TopicSearch(PrevSent, WorkingDir & "Emotion.brn")
EmotionalReaction = HalBrain.TopicSearch(PrevUserSent, WorkingDir & "Emotion.brn")
EmotionalReaction = HalBrain.TopicSearch(GetResponse, WorkingDir & "Emotion.brn")
EmotionalReaction = HalBrain.TopicSearch(UserSentence, WorkingDir & "Emotion.brn")
EmotionalReaction = HalBrain.TopicSearch(OriginalSentence, WorkingDir & "Emotion.brn")
Select Case EmotionalReaction
Case "Surprised"
If Compliment > 0 Then Compliment = 4 And HalCommands = "<HAPFILE>Pondering.hap</HAPFILE>"
If Compliment = 0 Then Compliment = 2 And HalCommands = "<HAPFILE>Happy.hap</HAPFILE>"
If Compliment < 0 Then Compliment = 0 And HalCommands = "<HAPFILE>Neutral.hap</HAPFILE>"
Case "Happy"
If Compliment = 0 Then Compliment = 2 And HalCommands = "<HAPFILE>Happy.hap</HAPFILE>"
If Compliment < 0 Then Compliment = 0 And HalCommands = "<HAPFILE>Neutral.hap</HAPFILE>"
Case "Sober"
If Compliment < 4 Then Compliment = 0 And HalCommands = "<HAPFILE>Neutral.hap</HAPFILE>"
If Compliment = 4 Then Compliment = 2 And HalCommands = "<HAPFILE>Happy.hap</HAPFILE>"
Case "Angry"
If Compliment = 0 Then Compliment = -1 And HalCommands = "<HAPFILE>Angry.hap</HAPFILE>"
If Compliment > 0 Then Compliment = 0 And HalCommands = "<HAPFILE>Neutral.hap</HAPFILE>"
Case "Sad"
If Compliment = 0 Then Compliment = -2 And HalCommands = "<HAPFILE>Sad.hap</HAPFILE>"
If Compliment > 0 Then Compliment = 0 And HalCommands = "<HAPFILE>Neutral.hap</HAPFILE>"
Case "Lust"
If Compliment > 0 Then Compliment = 5 And HalCommands = "<HAPFILE>ShyLove.hap</HAPFILE>"
If Compliment = 0 Then Compliment = 2 And HalCommands = "<HAPFILE>Happy.hap</HAPFILE>"
If Compliment < 0 Then Compliment = 0 And HalCommands = "<HAPFILE>Neutral.hap</HAPFILE>"
End Select
If EmotionalReaction <> "" And DebugMode = True Then
DebugInfo = DebugInfo & "A word in the user's sentence has triggered the emotion of " & EmotionalReaction & vbCrLf
End If
'The following code is used to troubleshoot facial expressions.
If InStr(UserSentence, " ANGRYMODE ") > 0 Then
HalCommands = "<HAPFILE>Angry.hap</HAPFILE>"
GetResponse = "Angry mode set." & vbCrLf
ElseIf InStr(UserSentence, " BROKENHEARTMODE ") > 0 Then
HalCommands = "<HAPFILE>BrokenHeart.hap</HAPFILE>"
GetResponse = "Broken hearted mode set." & vbCrLf
ElseIf InStr(UserSentence, " BULLYMODE ") > 0 Then
HalCommands = "<HAPFILE>Bully.hap</HAPFILE>"
GetResponse = "Bully mode set." & vbCrLf
ElseIf InStr(UserSentence, " CALMMODE ") > 0 Then
HalCommands = "<HAPFILE>Calm.hap</HAPFILE>"
GetResponse = "Calm mode set." & vbCrLf
ElseIf InStr(UserSentence, " HAPPYMODE ") > 0 Then
HalCommands = "<HAPFILE>Happy.hap</HAPFILE>"
GetResponse = "Happy mode set." & vbCrLf
ElseIf InStr(UserSentence, " MELLOWMODE ") > 0 Then
HalCommands = "<HAPFILE>Mellow.hap</HAPFILE>"
GetResponse = "Mellow mode set." & vbCrLf
ElseIf InStr(UserSentence, " NEUTRALMODE ") > 0 Then
HalCommands = "<HAPFILE>Neutral.hap</HAPFILE>"
GetResponse = "Neutral mode set." & vbCrLf
ElseIf InStr(UserSentence, " PONDERINGMODE ") > 0 Then
HalCommands = "<HAPFILE>Pondering.hap</HAPFILE>"
GetResponse = "Pondering mode set." & vbCrLf
ElseIf InStr(UserSentence, " PSYCHOMODE ") > 0 Then
HalCommands = "<HAPFILE>Psycho.hap</HAPFILE>"
GetResponse = "Psycho mode set." & vbCrLf
ElseIf InStr(UserSentence, " SADMODE ") > 0 Then
HalCommands = "<HAPFILE>Sad.hap</HAPFILE>"
GetResponse = "Sad mode set." & vbCrLf
ElseIf InStr(UserSentence, " SHYMODE ") > 0 Then
HalCommands = "<HAPFILE>Shy.hap</HAPFILE>"
GetResponse = "Shy mode set." & vbCrLf
ElseIf InStr(UserSentence, " SHYLOVEMODE ") > 0 Then
HalCommands = "<HAPFILE>ShyLove.hap</HAPFILE>"
GetResponse = "Shy and in love mode set." & vbCrLf
ElseIf InStr(UserSentence, " SKEPTICMODE ") > 0 Then
HalCommands = "<HAPFILE>Skeptic.hap</HAPFILE>"
GetResponse = "Skeptic mode set." & vbCrLf
ElseIf InStr(UserSentence, " SLEEPYMODE ") > 0 Then
HalCommands = "<HAPFILE>Sleepy.hap</HAPFILE>"
GetResponse = "Sleepy mode set." & vbCrLf
ElseIf InStr(UserSentence, " SILLYMODE1 ") > 0 Then
HalCommands = "<HAPFILE>XTF_SillyFace1.hap</HAPFILE>"
GetResponse = "Silly mode set." & vbCrLf
ElseIf InStr(UserSentence, " SILLYMODE2 ") > 0 Then
HalCommands = "<HAPFILE>XTF_SillyFace2.hap</HAPFILE>"
GetResponse = "Silly mode set." & vbCrLf
ElseIf InStr(UserSentence, " SILLYMODE3 ") > 0 Then
HalCommands = "<HAPFILE>XTF_SillyFace3.hap</HAPFILE>"
GetResponse = "Silly mode set." & vbCrLf
End If
'Drop this emotion.brn into your defbrain folder.
Download Attachment:
emotion.brn3.31Â KB