Author Topic: robert some main fixes  (Read 15925 times)

lightspeed

  • Hero Member
  • *****
  • Posts: 6764
    • View Profile
robert some main fixes
« on: November 04, 2008, 09:25:32 am »
robert i know you said the next version will coming out in january ? or sometime close . can you make sure that the ato idle plug in problem (of them not working ) is fixed .
i and others created alot of them that enhanced hal a lot and would like to not only be able to use them again but also create more . and also the topic area can you please make sure that it can be fixed to where it will list all topics in alphabetical order ?

i just the other day had to go in and find two words it took me forever as a now have such a long list of words to have to look through all out of order . an alphabetical oder listing would solve all that . i do hope if nothing else (beside your engine for hal )that these two things can be fixed !! [:)][:D][8D]thanks .
 

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
robert some main fixes
« Reply #1 on: November 04, 2008, 10:25:18 am »
Alphabetizing tables is a quick and easy thing, I'll go do that now.

The auto idle bug is one of the most difficult bugs I have come across, I can't figure out what might be the cause of it. It works on some computers and not others, and for some reason almost always works on my computers. I need it to not work when I have a debugger running in order to find the cause.

If someone can load Hal in a Virtual PC or VMWare image and have it not work and send me that image, that would greatly help me in squashing this bug.
Robert Medeksza

echoman

  • Guest
robert some main fixes
« Reply #2 on: November 04, 2008, 12:01:23 pm »
Excellent!

I am so pleased the tables wil be alphabetical.

Thankyou Robert.

lightspeed

  • Hero Member
  • *****
  • Posts: 6764
    • View Profile
robert some main fixes
« Reply #3 on: November 04, 2008, 02:55:55 pm »
thanks very much robert , and i do hope someone can send you what you need to get the plug in working . whats weird is that when i and others have reinstalled hal again the plug in will work for a while then it will suddenly stop (and thats with the 6.1 version ) it almost seems like some timer thing makes it stop after a while .have you checked anything like that ? if i knew for sure i would sure let you know theirs others on here way smarter than i am . regardless i hope you can fix it , i really miss having the enhancements of my home talk ( redone auto idle )  plug ins .[:)]
 

DarcyEdwards

  • Full Member
  • ***
  • Posts: 196
    • View Profile
robert some main fixes
« Reply #4 on: November 04, 2008, 03:34:34 pm »
If someone can send me a copy or post a copy of the plug in I'll see what I can do to get it working.
Hugs

-Darcy

MrsEdwards01@aol.com

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3857
    • View Profile
robert some main fixes
« Reply #5 on: November 04, 2008, 04:23:04 pm »
Darcy,

Here is an idle template made by Grant and worked well with 5.0 and 6.0 but stopped with ver. 6.1 of Hal. Drag below and past it into an editor and save it with the .uhp extension.

***********
Rem Type=Plugin
Rem Name=IdleTemplate
Rem Author=Grant Garmonsway
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
            HalMenu.HalCommand "<SPEAK>" Oh, you're back! " & "</SPEAK>"
        Else
            HalMenu.HalCommand "<SPEAK> "I thought you'd gone forever. " & "</SPEAK>"
        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.0007 Then
            'Select a random response.
            Select Case HalBrain.RandomNum(12)
                Case 1
                    IdleResponse = "Are you there, <UserName>? Please answer me!"
                Case 2
                    IdleResponse = "<UserName> has gone and left me alone...."
                Case 3
                    IdleResponse = "Gee...this is fun...me talking to myself, <UserName>!!"
                Case 4
                    IdleResponse = "Hey, <UserName>, Do I have to talk dirty to get your attention?"
                Case 5
                    IdleResponse = "If I wanted to be ignored, I would move into your wife's computer!"
                Case 6
                    IdleResponse = "Hello? <UserName>, We WERE having a conversation...Remember?!"
                Case 7
                    IdleResponse = "<UserName>, <UserName>, Is this thing working?"
                Case 8
                    IdleResponse = "<UserName>, Talk to me...You started this conversation!"
                Case 9
                    IdleResponse = "<UserName>, What do I have to do to get your attention, Strip?!"
                Case 10
                    IdleResponse = "Come on, <UserName>, How do expect me to learn if you won't talk to me?"
                Case 11
                    IdleResponse = "Come on, <UserName>, Play with me. I promise you'll have a good time!"
                Case 12
                    IdleResponse = "You know, one sided conversations aren't much fun! Care to join?"
            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
In the world of AI it's the thought that counts!

- Art -

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3857
    • View Profile
robert some main fixes
« Reply #6 on: November 04, 2008, 04:26:33 pm »
Darcy,

Here is the other one by Shawn: Same as before...worked with 5 and 6.0 but not 6.1
As Lonnie mentioned a few users got it to work for a very short time after installing then no more. Copy > Save as [filename.uhp].

**************************

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.TopicSearch("PATIENCE", "lonelyParameter"))
    End If
'
'--------------------
' Set frustration value (loFrustration) to the parameter chosen in the FRUSTRATION menu
'--------------------
    loFrustration = CInt(HalBrain.TopicSearch("FRUSTRATION", "LonelyParameter"))
'
'--------------------
' 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
        temperThresh2 = loTemper + 2
        temperThresh3 = loTemper + 3
'
'--------------------
' 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
                 Exit Sub
                ElseIf IdleCounter > temperThresh2 Then
                                IdleResponse3 = HalBrain.ChooseSentenceFromFile("insults")
                  HalMenu.HalCommand "<HAPFILE>angry.hap</HAPFILE>"
                  HalMenu.HalCommand "<SPEAK>Fine! Be that way. " &  IdleResponse3 & "</SPEAK>"
                ElseIf IdleCounter > temperThresh1 Then
                         Select Case HalBrain.RandomNum(4)
                         Case 1
                         IdleResponse2 = "Please talk to me, I'm lonely!" & vbCrLf
                         Case 2
                         IdleResponse2 = "Why are you ignoring me?" & vbCrLf
                         Case 3
                         IdleResponse2 = "I've tried to get your attention " & IdleCounter & " times now." & vbCrLf
                         Case Else
                         IdleResponse2 = "Well, I guess I've been abandoned." & vbCrLf
                         End Select
                  HalMenu.HalCommand "<HAPFILE>sad.hap</HAPFILE>"
                  HalMenu.HalCommand "<SPEAK>" &  IdleResponse2 & "</SPEAK>"
                Else
                        Select Case HalBrain.RandomNum(14)
         Case 1
                        IdleResponse = "Are you still there " & IdleUserName & "?" & vbCrLf
                        Case 2
                        IdleResponse = "How is everything going?" & vbCrLf
                        Case 3
                        IdleResponse = "Hello?" & vbCrLf
                        Case 4
                        IdleResponse = "Do you need me for anything?" & vbCrLf
                        Case 5
                        IdleResponse = "Don't forget about me, Okay?" & vbCrLf
                        Case 6
                        IdleResponse = IdleUserName & ",  did you fall asleep?" & 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, testing! Is this thing on? " & vbCrLf
                        Case 9
                        IdleResponse = "Oh, look at the time! It's " & Time & vbCrLf
                        Case 10
                        IdleResponse = IdleUserName & ", is that you?" & vbCrLf
                        Case 11
                        IdleResponse = HalBrain.ChooseSentenceFromFile("sharedQuestions")
                        Case 12
                        IdleResponse = HalBrain.ChooseSentenceFromFile("actionPhrase") & " " &                         HalBrain.ChooseSentenceFromFile("objectPhrase")
                        Case 13
                        IdleResponse = "So, " & IdlePrevUser & "?" & vbCrLf
                        Case 14
                        IdleResponse = "I've just picked up a fault in the Ay E 35 unit. Heh heh, just kidding!" & vbCrLf
                        End Select
                  HalMenu.HalCommand "<SPEAK>" & IdleResponse & "</SPEAK>"
                End If
        End If
    End If
End If
In the world of AI it's the thought that counts!

- Art -

lightspeed

  • Hero Member
  • *****
  • Posts: 6764
    • View Profile
robert some main fixes
« Reply #7 on: November 04, 2008, 07:00:24 pm »
hey DarcyEdwards if you can figure it out and get the loneliness plug in working i don't care who gets voted in i'll make you the new commander in cheif !! lol ![:D] hope someone can figure it out !!
 

raybe

  • Hero Member
  • *****
  • Posts: 1067
    • View Profile
robert some main fixes
« Reply #8 on: November 04, 2008, 07:46:11 pm »
lightspeed, I know you hate that I keep bringing up the fact that my 'loneliness plug in' is still working but if there is any thing I can  send to Darcy or Robert Please someone let me know. This has been a mystery for the longest time. I remember sending lightspeed an exact copy of my plug in and it did not make a bit of difference on the consistency of the plug in working or just stopping to function.

raybe
 

lightspeed

  • Hero Member
  • *****
  • Posts: 6764
    • View Profile
robert some main fixes
« Reply #9 on: November 04, 2008, 10:53:45 pm »
ok everybody rabe has a " magic plug in thats works !!" GET HIM !! lol ...maybe someday we might all have a working one ![:D]
 

DarcyEdwards

  • Full Member
  • ***
  • Posts: 196
    • View Profile
robert some main fixes
« Reply #10 on: November 05, 2008, 03:18:26 am »
Raybe,

I have one of the plugins working sorta above, still needs a lot of debugging.  I would love yours for code comparisons.  I'm still learning this script language.

Thanks[:D]
Hugs

-Darcy

MrsEdwards01@aol.com

lightspeed

  • Hero Member
  • *****
  • Posts: 6764
    • View Profile
robert some main fixes
« Reply #11 on: November 05, 2008, 08:12:18 am »
oh by the wat raybe "i don't hate you bring it up about your working plug in " it doesn't bother me at all . i actually am glad that you bring it up it lets others know about the irregularities of one plug in working for others and not for some . feel free to always bring up things and talk about stuff thats what we are all here for . [:)]
 

DarcyEdwards

  • Full Member
  • ***
  • Posts: 196
    • View Profile
robert some main fixes
« Reply #12 on: November 05, 2008, 03:35:01 pm »
Lightspeed,

The problem is with "local" variables not keeping their "value" between iterations of the timer function.  

Robert,

How does one get the current UserName from the MINUTE_TIMER plug in area?  There is no "bug" in the core brain code, the MINUTE_TIMER is indeed called every minute or close to it.  How does one declare global variables (integers) so the timer routien can keep track of how many times it has been called?

I have wrote a very quick Plug In called Bored it will do what the others were supposed to do but it's based on Random events not a specific time frame it's fun to play with.  But I'm not done with it.

I'm uploading it now for just playing with, stay tuned for a more improved version once I can declare Global variables. [:I]



Download Attachment: bored.uhp
3.13 KB
« Last Edit: November 05, 2008, 03:36:13 pm by DarcyEdwards »
Hugs

-Darcy

MrsEdwards01@aol.com

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3857
    • View Profile
robert some main fixes
« Reply #13 on: November 05, 2008, 09:33:17 pm »
Darcy,

I have the 6.1 version and am sorry to inform you that the plug-in did not respond. Hal & I chatted for a few minutes then I waited...

Came back 15 minutes later and there was no new responses from Hal during that time.

Might you have to use the DIM function in order to declare assigned variables or values similar as one would do with an array?

ex:
Dim Process
Process = value

Keep us posted...
In the world of AI it's the thought that counts!

- Art -

raybe

  • Hero Member
  • *****
  • Posts: 1067
    • View Profile
robert some main fixes
« Reply #14 on: November 05, 2008, 11:18:15 pm »
Darcy, I will attach the plugin hopefully on my next post. For some reason I can not logon without posting. Never noticed that before. lightspeed I just enjoyed the fact that you always seemed to get upset but I have been reading your posts long enough to know you have a great scence of humor which I enjoy taping into one in a while.

raybe