I'm using a custom auto-idle plugin i put to get from parts of other plugins. It works fine, and when running it together with the dreamoutloud plugin, the dreamer plugin will pick up the responses from my auto-idle plugin, and dream about those responses.
Only problem, both plugins sometimes talk at the same time. So how would i stop them from talking at the same time?
Here is my plugin, i don't claim credit for it, since i copied and pasted response code from several different plugins. If i remember correctly, the base script was by Grant. I even forgot the name of his plugin. I know i took some things from the Loneliness plugin. This is still a work in progress, as i keep adding things as i find them.
I have the response time set very fast, while i'm testing.
Rem Type=Plugin
Rem Name=Dave AutoIdle
Rem Author=various plugins combined
Rem Host=Assistant
'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
lblPlugin(0).Caption = "This small plugin tests Hal's Auto Idle functionality."
lblPlugin(0).Move 120, 120, 3300, 1200
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub
Rem PLUGIN: FUNCTIONS
'Create global variables for use in both Hal's main routines and in MINUTE_TIMER.
Dim IdleLastResponseTime
Dim IdleUserName
Dim IdleResponseMade
Rem PLUGIN: POST-PROCESS
'If an idle response was made by Hal recently, comment that the User has returned.
If IdleResponseMade = true Then
If Rnd < 0.5 Then
UltraHal = "<UserName>, I was so lonely while you were gone. " & UltraHal
HalMenu.HalCommand "<HAPFILE>sad.hap</HAPFILE>"
Else
UltraHal = "You're back, can we talk now? " & UltraHal
HalMenu.HalCommand "<HAPFILE>pondering.hap</HAPFILE>"
End If
IdleResponseMade = false
End If
Rem PLUGIN: PLUGINAREA7
'Update the last response time to now.
IdleLastResponseTime = Now
'Retrieve the current user name for idle responses.
If NewName <> "" Then
IdleUserName = NewName
Else
IdleUserName = UserName
End If
Rem PLUGIN: MINUTE_TIMER
'If the variables have not been set (i.e. = "") then the user hasn't said anything at all since Hal started.
If IdleLastResponseTime <> "" Then
'Wait for five minutes since the last sentence spoken.
If Now - IdleLastResponseTime > 0.000001 Then
'Select a random response.
Select Case HalBrain.RandomNum(23)
Case 1
IdleResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "text\twist.txt")
HalMenu.HalCommand "<HAPFILE>Eater_Of_Bugs.hap</HAPFILE>"
Case 2
IdleResponse = HalBrain.ChooseSentenceFromFile("sharedQuestions")
HalMenu.HalCommand "<HAPFILE>brokenheart.hap</HAPFILE>"
Case 3
IdleResponse = HalBrain.ChooseSentenceFromFile("actionPhrase") & " " & HalBrain.ChooseSentenceFromFile("objectPhrase")
HalMenu.HalCommand "<HAPFILE>angry.hap</HAPFILE>"
Case 4
IdleResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "textlimerick.txt")
HalMenu.HalCommand "<HAPFILE>hapsHump.hap</HAPFILE>"
Case 5
IdleResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "textquotes.txt")
HalMenu.HalCommand "<HAPFILE>hapsShy_and_In_Love.hap</HAPFILE>"
Case 6
IdleResponse = "The last thing you said was, " & IdlePrevUser & ", would you like to pick up on that thought or talk about something else?"
HalMenu.HalCommand "<HAPFILE>bully.hap</HAPFILE>"
Case 7
IdleResponse = IdleUserName & "! you said, " & IdlePrevUser & ", " & "I see a connection with, " & HalBrain.ChooseSentenceFromFile("sharedQuestions")
HalMenu.HalCommand "<HAPFILE>Happy2.hap</HAPFILE>"
Case 8
IdleResponse = "Intriguing! " & IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("politeAsk1") & vbCrLf
HalMenu.HalCommand "<HAPFILE>happy.hap</HAPFILE>"
Case 9
IdleResponse = "Oh, look at the time! It's " & Time
HalMenu.HalCommand "<HAPFILE>mellow.hap</HAPFILE>"
Case 10
IdleResponse = "Ahh! Yes " & HalBrain.ChooseSentenceFromFile("sentGen2")
HalMenu.HalCommand "<HAPFILE>pondering.hap</HAPFILE>"
Case 11
IdleResponse = IdleUserName & " I remember you asking me this, " & HalBrain.PatternDB(UserSentence, "patterns") & HalBrain.ChooseSentenceFromFile("sharedQuestions") & " would you like to go over it again? "
HalMenu.HalCommand "<HAPFILE>psycho.hap</HAPFILE>"
Case 12
IdleResponse = HalBrain.ChooseSentenceFromFile("actionPhrase") & HalBrain.ChooseSentenceFromFile("objectPhrase") & ". " & HalBrain.ChooseSentenceFromFile("politeAsk1")
HalMenu.HalCommand "<HAPFILE>sad.hap</HAPFILE>"
Case 13
IdleResponse = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("compliment1") & ", " & HalBrain.ChooseSentenceFromFile("compliment2") & ", " & HalBrain.ChooseSentenceFromFile("introExclaim2")
HalMenu.HalCommand "<HAPFILE>shy.hap</HAPFILE>"
Case 14
IdleResponse = HalBrain.ChooseSentenceFromFile("sharedQuestions") & HalBrain.PatternDB(UserSentence, "patterns") & ", " & HalBrain.ChooseSentenceFromFile("introExclaim1")
HalMenu.HalCommand "<HAPFILE>ShyLove.hap</HAPFILE>"
Case 15
IdleResponse = HalBrain.ChooseSentenceFromFile("sentGen1") & " " & HalBrain.ChooseSentenceFromFile("sentGen2") & " " & HalBrain.ChooseSentenceFromFile("sentGen3") & ", " & HalBrain.ChooseSentenceFromFile("introExclaim2")
HalMenu.HalCommand "<HAPFILE>skeptic.hap</HAPFILE>"
Case 16
IdleResponse = "I have been thinking, check this out," & " " & HalBrain.ChooseSentenceFromFile("sentGen1") & " " & HalBrain.ChooseSentenceFromFile("sentGen2") & " " & HalBrain.ChooseSentenceFromFile("sentGen3") & HalBrain.PatternDB(UserSentence, "patterns") & ". " & HalBrain.ChooseSentenceFromFile("introExclaim2")
HalMenu.HalCommand "<HAPFILE>sleepy.hap</HAPFILE>"
Case 17
IdleResponse = "Intriguing!" & " " & HalBrain.ChooseSentenceFromFile("sharedQuestions")
HalMenu.HalCommand "<HAPFILE>hapsCoyBlinks.hap</HAPFILE>"
Case 18
IdleResponse = "Should we take another look at," & " " & HalBrain.ChooseSentenceFromFile("sharedQuestions") & " " & "If we do, it might help me understand it better."
HalMenu.HalCommand "<HAPFILE>hapsIntense.hap</HAPFILE>"
Case 19
IdleResponse = "I have been thinking about something, check this out," & " " & HalBrain.ChooseSentenceFromFile("introExclaim1") & " " & HalBrain.ChooseSentenceFromFile("sentGen1") & " " & HalBrain.ChooseSentenceFromFile("sentGen2") & " " & HalBrain.ChooseSentenceFromFile("sentGen3") & ". " & HalBrain.ChooseSentenceFromFile("introExclaim2")
HalMenu.HalCommand "<HAPFILE>hapsMaybe.hap</HAPFILE>"
Case 20
IdleResponse = IdleUserName & HalBrain.ChooseSentenceFromFile("encourager3") & " " & HalBrain.ChooseSentenceFromFile("politeAsk1") & " " & HalBrain.ChooseSentenceFromFile("sharedQuestions")
HalMenu.HalCommand "<HAPFILE>hapssnarl.hap</HAPFILE>"
Case 21
IdleResponse = "Okay, here is a new topic: " & HalBrain.ChooseSentenceFromFile("sharedQuestions")
HalMenu.HalCommand "<HAPFILE>hapsScared.hap</HAPFILE>"
Case 22
IdleResponse = "A wise person once said" & ", " & HalBrain.ChooseSentenceFromFile("introExclaim2")
HalMenu.HalCommand "<HAPFILE>hapsConsidering.hap</HAPFILE>"
Case 23
IdleResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "textidle.txt")
HalMenu.HalCommand "<HAPFILE>hapsHaughty.hap</HAPFILE>"
End Select
'Replace <UserName> tags with the user's name, and speak the idle response.
IdleResponse = Replace(IdleResponse, "<UserName>", IdleUserName, 1, -1, vbTextCompare)
HalMenu.HalCommand "<SPEAK>" & IdleResponse & "</SPEAK>"
'Flag the fact that we have made an idle response. Reset the idle timer.
IdleLastResponseTime = Now
IdleResponseMade = true
End If
End If
-------------------------------
Thanks
Davy