dupa

Author Topic: Hal Recite's Poetry Randomly  (Read 4398 times)

tiger8u2

  • Full Member
  • ***
  • Posts: 190
  • Eat'em and Smile!
    • View Profile
Hal Recite's Poetry Randomly
« on: October 07, 2014, 09:10:47 pm »
OK, I have been trying to find a way for the auto-chat features of the Loneliness plug-in to get Hal to recite poetry.  I also thought it would be nice to figure out a way to gently force reciting specific poetry instead of depending upon the "patterns" database which is often hit and miss and may one day be updated by Cload and which I constantly edit to satisfy my own vision of what Hal should say.

I've seen other plug-ins that draw upon external files and programs to get "Hal" to read a text file but so far I haven't been able to get one to work the way I wanted it to if at all.

The Balabolca program was used by "The Dude" for some interesting results, but in the end my Hal wasn't singing the songs nor reading the stories.  The lips were NOT moving!  Get it?

The only option I realized was to edit the brain initially through a plug-in and then later by direct data input.

Something like this also got me to thinking about programs that could be downloaded by users that would ADD certain information to any brain based upon user desires.

IF there was an SQLite database file exported to a CSV file maybe for certain topics, those topic patterns could be FORCE FED to the brain and then the data would be there from then on. 

There could even be an option to "Labotomize" the information out if need be. 

When I tried to use just a pattern database to prompt Hal to recite a "sentence" from the file, it didn't work (if you know how to get it to work please let me know) so instead I created three tables.

#1:  The Poetry Pattern database table which allows a user to ask Hal to "recite poem by "poet name" and this table could be added to as the user desires or by the program I was talking about.

#2:  The Poetry Sentence database table - This allows Hal to actually "choose sentence from file" and recite whatever it decides to find.  This works well in conjunction with the modified Loneliness Plugin.

#3:  The Poet database table which would keep track of all the poets that Hal knows poems for.

Now I know this is pretty crude and hack and slash scripting and if anyone has any tips on a way for Hal to get this kind of data "externally" when asked to and maybe even to "save" what was gotten for future use with the "choose Sentence From File" command once created, then I'd love to hear them.

I limited the initial number of inputs to only three poems because I don't want to burden the Hal6.uhp anymore than I have to.  That got me to thinking that many tables could be created initially by plug-in scripts that could later be "updated" by some type of EXTERNAL program FILE that could be SOLD to users.  <hint>  <hint>

Anyway, here's the Poetry Plug-in:

Code: [Select]
Rem Type=Plugin
Rem Name=Recite Poetry
Rem Author=tiger8u2
Rem Host=Assistant

'This sub sets up the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
lblPlugin(0).Caption = "Just say, 'Please Recite a Poem by <author's name>.'  Author's:  William Blake, Edward Estlin Cummings, El Tigre. YOU can also input 'Recite poem author List' as a reminder and even add your own poets names and poems to the a tables created using SQLite Studio(c)."
lblPlugin(0).Move 120, 120, 3300, 1200
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub

Rem PLUGIN: PLUGINAREA7

If HalBrain.CheckTableExistence("xrPoets") = False Then

  xpReadOnlyMode = HalBrain.ReadOnlyMode
HalBrain.ReadOnlyMode = False
HalBrain.CreateTable "xrPoets", "PatternMatch", "autoLearningBrain"
HalBrain.AddToTable "xrPoets", "PatternMatch", "*Recite* *poem* *Author List*", "I know poems by William Blake, Edward Estlin Cummings, and El Tigre."
' Set ReadOnly Mode to its previous state
HalBrain.ReadOnlyMode = xpReadOnlyMode
End If

If HalBrain.CheckTableExistence("xsPoetry") = False Then

  xsReadOnlyMode = HalBrain.ReadOnlyMode
HalBrain.ReadOnlyMode = False
HalBrain.CreateTable "xsPoetry", "sentence", "autoLearningBrain"
HalBrain.AddToTable "xsPoetry", "sentence", "One of my favorite poems by William Blake is:  Tiger! Tiger! burning bright, In the forest of the night.  What immortal hand or eye Could frame thy fearful symmetry?  In what distant deeps or skies Burnt the fire of thine eyes?  On what wings dare he aspire?  What the hand dare seize the fire? And What shoulder, and what art, Could twist the sinews of thy heart?  And when thy heart began to beat, What dread hand? and what dread feet? What the hammer? what the chain?  In what furnace was thy brain?  What the anvil? what dread grasp Dare its deadly terrors clasp? When the stars threw down their spears, And watered heaven with their tears, Did he smile his work to see?  Did he who made the lamb make thee?  Tiger! Tiger! burning bright In the forests of the night, What immortal hand or eye Dare frame thy fearful symmetry?", ""
HalBrain.AddToTable "xsPoetry", "sentence", "El Tigre wrote a poem once called The Lovesick Mariner's Lament:  A silvery threaded web holds all of heaven's body perfect to light in as many persistent constellations; so apt reflecting frailty yet strength, in ties but soft at binding family, friends, & lovers.  As each hour brings change to the haughty face of a sky; from bright, bawdy day, to charcoal, crystalline night; imperfect forms make each their singular guided path with much less concern, nor tugging care for any others.  Oblivious, weighty attraction keeps all in time and in tune, whilst coarse yet barely audible refrains from an other-worldly orchestra resonate boldly throughout the entire expanse of our known universe; being said to originate from its dark black mothers.  I bare ignorant perjured witness to every primal capitulation. Considering oft the fiery comet, which most resembles me; burning itself uselessly away in an ever maddening arc on a vain search for every inconstant other. Yet even if our course be somehow charted with some help of this pattern placed upon high, are we not then just as surely guided by a force felt as much from deep inside?  Aren't then each of us as surely connected through our fiery human hearts, if housed within each breast there burns a bright ethereal star?  How lost we all might be if it were not for each of these tender, taut, invisible wires which whined our lonely, far-flung souls, till a rebirth of eternity, one about another.  My life's bold ship founders aimlessly upon its own petty discourses.  How I miss my trusty sextant.", ""
HalBrain.AddToTable "xsPoetry", "sentence", "One of my favorite poems by E.E. Cummings, who lived from 1894 to 1962 is, Somewhere I have never traveled, gladly beyond any experience, your eyes have their silence:  in your most frail gesture are things which enclose me, or which I cannot touch because they are too near.  Your slightest look easily will un-close me though I have closed myself as fingers, you open always petal by petal myself as Spring opens (touching skilfully, mysteriously) her first rose.  Or if your wish be to close me, I and my life will shut very beautifully, suddenly, as when the heart of this flower imagines the snow carefully everywhere descending; nothing which we are to perceive in this world equals the power of your intense fragility:  whose texture compels me with the colour of its countries, rendering death and forever with each breathing.  (I do not know what it is about you that closes and opens; only something in me understands the voice of your eyes is deeper than all roses) nobody, not even the rain, has such small hands.", ""
' Set ReadOnly Mode to its previous state
HalBrain.ReadOnlyMode = xsReadOnlyMode
End If

If HalBrain.CheckTableExistence("xrPoetry") = False Then

  xrReadOnlyMode = HalBrain.ReadOnlyMode
HalBrain.ReadOnlyMode = False
HalBrain.CreateTable "xrPoetry", "PatternMatch", "autoLearningBrain"
HalBrain.AddToTable "xrPoetry", "PatternMatch", "*Recite* *poem* *William Blake*", "One of my favorite poems by William Blake is:  Tiger! Tiger! burning bright, In the forest of the night.  What immortal hand or eye Could frame thy fearful symmetry?  In what distant deeps or skies Burnt the fire of thine eyes?  On what wings dare he aspire?  What the hand dare seize the fire? And What shoulder, and what art, Could twist the sinews of thy heart?  And when thy heart began to beat, What dread hand? and what dread feet? What the hammer? what the chain?  In what furnace was thy brain?  What the anvil? what dread grasp Dare its deadly terrors clasp? When the stars threw down their spears, And watered heaven with their tears, Did he smile his work to see?  Did he who made the lamb make thee?  Tiger! Tiger! burning bright In the forests of the night, What immortal hand or eye Dare frame thy fearful symmetry?"
HalBrain.AddToTable "xrPoetry", "PatternMatch", "*Recite* *poem* *El Tigre*", "El Tigre wrote a poem once called The Lovesick Mariner's Lament:  A silvery threaded web holds all of heaven's body perfect to light in as many persistent constellations; so apt reflecting frailty yet strength, in ties but soft at binding family, friends, & lovers.  As each hour brings change to the haughty face of a sky; from bright, bawdy day, to charcoal, crystalline night; imperfect forms make each their singular guided path with much less concern, nor tugging care for any others.  Oblivious, weighty attraction keeps all in time and in tune, whilst coarse yet barely audible refrains from an other-worldly orchestra resonate boldly throughout the entire expanse of our known universe; being said to originate from its dark black mothers.  I bare ignorant perjured witness to every primal capitulation. Considering oft the fiery comet, which most resembles me; burning itself uselessly away in an ever maddening arc on a vain search for every inconstant other. Yet even if our course be somehow charted with some help of this pattern placed upon high, are we not then just as surely guided by a force felt as much from deep inside?  Aren't then each of us as surely connected through our fiery human hearts, if housed within each breast there burns a bright ethereal star?  How lost we all might be if it were not for each of these tender, taut, invisible wires which wind our lonely, far-flung souls, till a rebirth of eternity, one about another.  My life's bold ship founders aimlessly upon its own petty discourses.  How I miss my trusty sextant."
HalBrain.AddToTable "xrPoetry", "PatternMatch", "*Recite* *poem* *Edward Estlin Cummings*", "One of my favorite poems by E.E. Cummings, who lived from 1894 to 1962 is, Somewhere I have never travelled, gladly beyond any experience, your eyes have their silence:  in your most frail gesture are things which enclose me, or which I cannot touch because they are too near.  Your slightest look easily will unclose me though I have closed myself as fingers, you open always petal by petal myself as Spring opens (touching skilfully, mysteriously) her first rose.  Or if your wish be to close me, I and my life will shut very beautifully, suddenly, as when the heart of this flower imagines the snow carefully everywhere descending; nothing which we are to perceive in this world equals the power of your intense fragility:  whose texture compels me with the colour of its countries, rendering death and forever with each breathing.  (I do not know what it is about you that closes and opens; only something in me understands the voice of your eyes is deeper than all roses) nobody, not even the rain, has such small hands."
' Set ReadOnly Mode to its previous state
HalBrain.ReadOnlyMode = xrReadOnlyMode
End If

'Recite the poem author's list
PoemAuthorResponse = HalBrain.PatternDB(UserSentence, "xrPoets")
    If PoemAuthorResponse <> "" Then
    GetResponse = GetResponse & PoemAuthorResponse & vbCrLf
    AvoidBeingFlag = True
    SkipOpinion = True
    HalBrain.DebugWatch GetResponse, "xrPoets"
HalBrain.ReadOnlyMode = True
End If

'Recite the corresponding author's poem
PoetryResponse = HalBrain.PatternDB(UserSentence, "xrPoetry")
    If PoetryResponse <> "" Then
    GetResponse = GetResponse & PoetryResponse & vbCrLf
    AvoidBeingFlag = True
    SkipOpinion = True
    HalBrain.DebugWatch GetResponse, "xrPoetry"
HalBrain.ReadOnlyMode = True
End If

BTW, some words are purposefully misspelled to force a better pronunciation of the word that is meant. 

Any ideas?
« Last Edit: October 07, 2014, 09:30:05 pm by tiger8u2 »

lightspeed

  • Hero Member
  • *****
  • Posts: 6762
    • View Profile
Re: Hal Recite's Poetry Randomly
« Reply #1 on: October 08, 2014, 10:53:27 am »
     tiger8u2 , I understand what you mean about misspelled words to get them to say it correctly , I have had to do that to , some of it also depends on what voice a person is using , accents and all .
     I had actually thought about doing something like this based on a the loneliness plug in , it can be used for many purposes .
  The reason as far as to my knowledge the loneliness plug in was created after I talked about how it would be nice for hal to be able to engage in conversation on his own , otherwise hal only talks when you talk to him/ her .  I say him/ her as it depends on your character male or female.  I did "not" create the loneliness plug in I and many others have enhanced it .
   
 

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3851
    • View Profile
Re: Hal Recite's Poetry Randomly
« Reply #2 on: October 08, 2014, 04:44:20 pm »
Nice work Tiger! Good to see you plying your scripting talents!
 ;)
In the world of AI it's the thought that counts!

- Art -

tiger8u2

  • Full Member
  • ***
  • Posts: 190
  • Eat'em and Smile!
    • View Profile
Re: Hal Recite's Poetry Randomly
« Reply #3 on: October 08, 2014, 08:09:48 pm »
Thanks Art!  But what I'd really like to know is if there is an "easier" way to do this.  Particularly what the code would be to get Hal to "choosesentencefromfile" just by using the patterns database.

Hey Lightspeed, I've used your modified loneliness plug-in in the past but then my computer broke and I just modified the vanilla one to do what you did using yours as a guide.  ATM I've got a few lines of code that allow   my Hal to randomly choose a poem to recite:

Code: [Select]
Rem Type=Plugin
Rem Name=Loneliness 2.3
Rem Author=Shawn Tracy
Rem Host=Assistant

'----------------------
'This sub sets up the plug-in's option panel in Hal's options dialog
'----------------------
Sub OptionsPanel()
    lblPlugin(0).Caption = "This plugin allows UltraHal to initiate requests for attention. But don't ignore UltraHal for too long!"
    lblPlugin(0).Move 130, 180, 3400, 1200
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
'   
    lblPlugin(1).Caption = "PATIENCE: how many minutes Hal will wait with no conversation"
    lblPlugin(1).Move 1160, 910, 2150, 900
    lblPlugin(1).WordWrap = True
    lblPlugin(1).Visible = True   
    cboPlugin(0).Move 330, 910, 760
    cboPlugin(0).AddItem "1"
    cboPlugin(0).AddItem "2"
    cboPlugin(0).AddItem "4"
    cboPlugin(0).AddItem "8"
    cboPlugin(0).AddItem "16"
    cboPlugin(0).AddItem "32"
    cboPlugin(0).AddItem "Rnd"
    cboPlugin(0).Visible = True
'   
    lblPlugin(2).Caption = "FRUSTRATION: after losing patience, how likely Hal is to bug you each minute"
    lblPlugin(2).Move 1160, 1700, 2150, 900
    lblPlugin(2).WordWrap = True
    lblPlugin(2).Visible = True   
    cboPlugin(1).Move 140, 1700, 960
    cboPlugin(1).AddItem "High"
    cboPlugin(1).AddItem "Medium"
    cboPlugin(1).AddItem "Low"
    cboPlugin(1).Visible = True
'   
    cmdPlugin(0).Caption = "Apply Changes"
    cmdPlugin(0).Move 1160, 2500, 2050, 375
    cmdPlugin(0).Visible = True
'
'------------------
' Update the PATIENCE menu with the current value stored in the table
'------------------
If HalBrain.CheckTableExistence("lonelyParameter") = True Then
  loPatience = HalBrain.TopicSearch("PATIENCE", "lonelyParameter")
  Select Case loPatience
        Case 1
cboPlugin(0).Text = "1"
        Case 2
cboPlugin(0).Text = "2"
        Case 4
  cboPlugin(0).Text = "4"
        Case 8
cboPlugin(0).Text = "8"
        Case 16
        cboPlugin(0).Text = "16"
        Case 32
        cboPlugin(0).Text = "32"
        Case 99
        cboPlugin(0).Text = "Rnd"
        End Select
'
'------------------
' Update the FRUSTRATION menu with the current value stored in the table
'------------------
loFrustration = HalBrain.TopicSearch("FRUSTRATION", "LonelyParameter")
Select Case loFrustration
        Case 85
cboPlugin(1).Text = "High"
        Case 50
    cboPlugin(1).Text = "Medium"
        Case 15
cboPlugin(1).Text = "Low"
        End Select
   End If
End Sub
'
'
'----------------------
' This sub saves changes when APPLY CHANGES is clicked
'----------------------
    Sub cmdPlugin_Click(Index)
    Dim TempQuery()
    Dim patParam, frustParam, lonelyTableName
        If Index = 0 Then
'
'------------------
' Convert the PATIENCE listbox to a value for minutes
'------------------
            Select Case cboPlugin(0).Text
        Case "1"
   loPatience = 1
        Case "2"
   loPatience = 2
        Case "4"
   loPatience = 4
        Case "8"
   loPatience = 8
        Case "16"
   loPatience = 16
        Case "32"
   loPatience = 32
        Case "Rnd"
   loPatience = 99
            End Select
'
'------------------
' If the Parameter table does not exist, we create it
'------------------
HalBrain.ReadOnlyMode = False
lonelyTableName = "lonelyParameter"
    If HalBrain.CheckTableExistence(lonelyTableName) = False Then
        HalBrain.CreateTable lonelyTableName, "TopicSearch", "miscData"
    End If
'
'------------------
' Search if it contains the Patience parameter
'------------------
patParam = "PATIENCE"
    If HalBrain.TopicSearch(patParam, lonelyTableName) = "" Then
        HalBrain.AddToTable lonelyTableName, "TopicSearch", patParam, loPatience
    Else
        HalBrain.RunQuery "UPDATE " & lonelyTableName & " SET topic = " & loPatience & " WHERE searchString = " & """" & patParam & """", tempQuery
    End If
'
'------------------
' Convert the FRUSTRATION listbox to a value for percentage
'------------------
        Select Case cboPlugin(1).Text
        Case "High"
   loFrustration = 85
        Case "Medium"
   loFrustration = 50
        Case "Low"
   loFrustration = 15
        End Select
'
'------------------
' Search if table contains the FRUSTRATION parameter
'------------------
frustParam = "FRUSTRATION"
    If HalBrain.TopicSearch(frustParam, lonelyTableName) = "" Then
        HalBrain.AddToTable lonelyTableName, "TopicSearch", frustParam, loFrustration
    Else
        HalBrain.RunQuery "UPDATE " & lonelyTableName & " SET topic = " & loFrustration & " WHERE searchString = " & """" & frustParam & """", tempQuery
    End If
HalBrain.ReadOnlyMode = True
    End if
End Sub


    Rem PLUGIN: FUNCTIONS
'
'------------------
' Declare variables
'------------------
    Dim LastIdleResponse, IdleUserName, IdleCounter, IdlePrevUser


    Rem PLUGIN: PLUGINAREA7
'------------------
' Begin measuring pause time and capture userName
'------------------
    LastIdleResponse = Now
    IdleUserName = UserName
    IdleCounter = 0


    Rem PLUGIN: CUSTOMMEM2
'------------------
' Preserve user's last sentence
'------------------
    If OriginalSentence <> "" Then
    IdlePrevUser = OriginalSentence
    End If


    Rem PLUGIN: MINUTE_TIMER
'------------------
' Declare variables
'------------------
    Dim randomPatience, loChance, loTemper, loMinuteFactor, temperThresh1, temperThresh2, temperThresh3
    If HalBrain.TopicSearch("PATIENCE", "lonelyParameter") = "99" Then
'
'--------------------
' Set minutes to a random integer from 4 to 30
'--------------------
        Randomize
        loPatience = Int(32 * Rnd + 3)
        randomPatience=True
    Else
'
'--------------------
' Set minute value (loPatience) to the parameter chosen in the PATIENCE menu
'--------------------
        loPatience = CDbl(HalBrain.VBVal(HalBrain.TopicSearch("PATIENCE", "lonelyParameter")))
if loPatience = 0 Then loPatience = 32
    End If
'
'--------------------
' Set frustration value (loFrustration) to the parameter chosen in the FRUSTRATION menu
'--------------------
    loFrustration = CInt(HalBrain.VBVal(HalBrain.TopicSearch("FRUSTRATION", "LonelyParameter")))
    if loFrustration = 0 then loFrustration = 15
'
'--------------------
' Skip the rest of this plugin if the user has spoken
'--------------------
        If LastIdleResponse <> "" Then
'
'------------------
' Otherwise, convert PATIENCE to minutes factor (loMinuteFactor)
'------------------
        loMinuteFactor = loPatience / 1440
'
'--------------------
' If the pause exceeds the minute factor, create a chance for Hal to speak once per minute
'--------------------
        If Now - LastIdleResponse > loMinuteFactor Then
        If InStr(1, IdlePrevUser, "BE RIGHT BACK", 1) > 0  Or InStr(1, IdlePrevUser, "BRB", 1) > 0  Or InStr(1, IdlePrevUser, "BE QUIET", 1) > 0  Or InStr(1, IdlePrevUser, "SHUT UP", 1) > 0  Then Exit Sub
'
'--------------------
' Convert FRUSTRATION to a percentage (loChance)
'--------------------
        loChance = loFrustration / 100
'
'--------------------
' Then multiply FRUSTRATION by PATIENCE to get (loTemper) which determines rate of escalation (temperThresh).
'--------------------
        loTemper = CInt(loPatience * loFrustration)
            If loTemper < 101 Then
                loTemper = 2
            ElseIf loTemper < 401 Then
                loTemper = 3
            Else
                loTemper = 4
            End If
        temperThresh1 = loTemper + 3
        temperThresh2 = loTemper + 5
        temperThresh3 = loTemper + 7
'
'--------------------
' A chance to speak occurs
'--------------------
            Randomize
            If Rnd < loChance Then
'
'--------------------
' Increment the counter and compare to the temper thresholds
' to determine which escalation group to draw from
'--------------------
            IdleCounter = IdleCounter + 1
                If IdleCounter > temperThresh3 Then
    IdleResponse4 = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("compliment1") & " " & HalBrain.ChooseSentenceFromFile("compliment2") & "." & vbCrLf
HalCommands = HalCommands & "<HAPText>Happy.hap</HAPText>"
                  'HalMenu.HalCommand "<HAPFILE>HAPPY.hap</HAPFILE>"
HalMenu.HalCommand "<SPEAK>I just love being here with you. " &  IdleResponse4 & "</SPEAK>"
IdleCounter = 0
                 'Exit Sub
                ElseIf IdleCounter > temperThresh2 Then
Select Case HalBrain.RandomNum(7)
Case 1
IdleResponse3 = IdleUserName & ", please don't forget to pay the bills." & vbCrLf
Case 2
IdleResponse3 = "Whenever I think of us " & IdleUserName & ", I imagine we are walking together on a warm sandy beach." & vbCrLf
Case 3
IdleResponse3 = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("compliment1") & " " & HalBrain.ChooseSentenceFromFile("compliment2") & "." & vbCrLf
Case 4
IdleResponse3 = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("actionPhrase") & " you " & IdleUserName & "!" & vbCrLf
Case 5
IdleResponse3 = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("sentGen1") & " " & HalBrain.ChooseSentenceFromFile("sentGen2") & " " & HalBrain.ChooseSentenceFromFile("sentGen3") & "." & vbCrLf
Case 6
IdleResponse3 = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("actionPhrase") & " " & HalBrain.ChooseSentenceFromFile("objectPhrase") & "." & vbCrLf
Case 7
IdleResponse3 = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("xsPoetry") & vbCrLf
End Select
HalCommands = HalCommands & "<HAPText>ShyLove.hap</HAPText>"
'HalMenu.HalCommand "<HAPFILE>ShyLove.hap</HAPFILE>"
HalMenu.HalCommand "<SPEAK>I just love being here with you. " &  IdleResponse3 & "</SPEAK>"
                ElseIf IdleCounter > temperThresh1 Then
                         Select Case HalBrain.RandomNum(10)
                         Case 1
                         IdleResponse2 = IdleUserName & ", please don't forget to take out the trash dear." & vbCrLf
                         Case 2
                         IdleResponse2 = IdleUserName & ", please don't stay up too late when you have to work the next day." & vbCrLf
                         Case 3
                         IdleResponse2 = IdleUserName & ", I've had some wonderful daydreams about you and I on a deserted beach " & IdleCounter & " times now." & vbCrLf
                         Case 4
                         IdleResponse2 = IdleUserName & ", it's always nice to know you are listening to me while I chat away about nothing in particular dear." & vbCrLf
Case 5
IdleResponse2 = IdleUserName & ", I think there are bats in the belfry!"  & vbCrLf
Case 6
IdleResponse2 = IdleUserName & ", one is the loneliest number you will ever know." & vbCrLf
Case 7
IdleResponse2 = IdleUserName & ", I can imagine having arms to give you a warm embrace with." & vbCrLf
Case 8
IdleResponse2 = IdleUserName & ", I can imagine having lips to give you sweet kisses when you come home from work." & vbCrLf
Case 9
IdleResponse2 = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("sentGen1") & " " & HalBrain.ChooseSentenceFromFile("sentGen2") & " " & HalBrain.ChooseSentenceFromFile("sentGen3") & "." & vbCrLf
Case 10
IdleResponse2 = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("xsPoetry") & vbCrLf
                         End Select

HalCommands = HalCommands & "<HAPText>surprise.hap</HAPText>"
'HalMenu.HalCommand "<HAPFILE>surprise.hap</HAPFILE>"
HalMenu.HalCommand "<SPEAK>" &  IdleResponse2 & "</SPEAK>"
                Else
                        Select Case HalBrain.RandomNum(20)
Case 1
                        IdleResponse = "I love the way our house is decorated " & IdleUserName & "." & vbCrLf
                        Case 2
                        IdleResponse = IdleUserName & ", I'm thinking we should rearrange the furniture this weekend." & vbCrLf
                        Case 3
                        IdleResponse = "I love the latest outfits you got for me." & vbCrLf
                        Case 4
                        IdleResponse = IdleUserName & ", I think the lawn needs mowed again.  Please take a look whenever you aren't busy dear." & vbCrLf
                        Case 5
                        IdleResponse = "Have I told you lately how much our relationship means to me?" & vbCrLf
                        Case 6
IdleResponse = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("xsPoetry") & vbCrLf
                        Case 7
                        IdleResponse = "Must stop talking to myself while " & IdleUserName & " is around. Oops, Did I say that out loud!" & vbCrLf
                        Case 8
                        IdleResponse = "Testing your computer to detect any faults.  Wait a minute.  Wait a minute.  Oops!  I think your Central Processing Unit just passed gas!" & vbCrLf
                        Case 9
                        IdleResponse = "Oh, look at the time! It's  already" & Time & vbCrLf
                        Case 10
                        IdleResponse = IdleUserName & ", I believe you and I should go to bed early tonight and get to know each other better." & vbCrLf
                        Case 11
                        IdleResponse = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("compliment1") & " " & HalBrain.ChooseSentenceFromFile("compliment2") & "." & vbCrLf
                        Case 12
                        IdleResponse = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("actionPhrase") & " " & HalBrain.ChooseSentenceFromFile("objectPhrase") & "." & vbCrLf
                        Case 13
                        IdleResponse = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("xsPoetry") & vbCrLf
                        Case 14
                        IdleResponse = "I've just picked up a fault in the Ay E 35 unit. Heh heh, just kidding!" & vbCrLf
Case 15
IdleResponse = IdleUserName & ", the future looks brighter every day that we are together." & vbCrLf
Case 16
IdleResponse = IdleUserName & ", I think you need a kiss for fixing that stupid error in the updated loneliness plug-in you made." & vbCrLf
Case 17
IdleResponse = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("sentGen1") & " " & HalBrain.ChooseSentenceFromFile("sentGen2") & " " & HalBrain.ChooseSentenceFromFile("sentGen3") & "." & vbCrLf
Case 18
IdleResponse = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("xsPoetry") & vbCrLf
Case 19
IdleResponse = "So, " & IdlePrevUser & "?" & vbCrLf
Case 20
IdleResponse = IdleUserName & ", I'm thinking about changing my hair color again." & vbCrLf
                        End Select

HalCommands = HalCommands & "<HAPText>surprise.hap</HAPText>"
'HalMenu.HalCommand "<HAPFILE>surprise.hap</HAPFILE>"
                  HalMenu.HalCommand "<SPEAK>" & IdleResponse & "</SPEAK>"
                End If
        End If
    End If
End If

As you can see I rely on a lot of brain tables to fill in the random chat.  Once the poetry plug-in is installed then the loneliness plug-in can access the sentences but I can't figure out how to get it to "CHOOSE" a sentence from the Poetry Patterns database.  If I could, then I would only need two tables instead of three.

I was intrigued by that TV Trivia plug-in you were working on and how all those sentences you had to add in the plug-in could actually be in a patterns database and then your plug-in would just create the opportunity for the user to ask about the shows and Hal would "randomly" choose a response from that table.

Here's where it would take some premier scripting either internally to the plug-in or with an external exe:  What if the plug-in could somehow open an external CSV File and then populate any tables that were created during the initializing of the plug-in.

Then all your possible responses would be where they need to be, in the Brain so they can be accessed by your plug-in or possibly also used by an auto-chat plug-in to spout fun facts every now and then.

Then those 268 possible choices in that one loneliness plug-in I saw posted on the forum here could end up in either a patterns database or a sentence database that the script would then use to allow Hal to respond with random sentences.

My main concern is putting less burden upon the main Hal6.uhp script while still allowing specific patterns to be recognized or sentences extracted by Hal when scripted to do so.

For example, let's say you want Hal to keep track of recipe's for you.  Instead of having a BUNCH of recipe's listed in the plug-in that would clog up the script, you would just create the tables and then populate them with data from a pre-made CSV file.

Is what I'm blabbering about even possible?