Zabaware Support Forums

Zabaware Forums => Ultra Hal Assistant File Sharing Area => Topic started by: lightspeed on July 08, 2008, 01:44:40 pm

Title: new working lightspeed plug in house talk 1
Post by: lightspeed on July 08, 2008, 01:44:40 pm
i just finsihed this plug in and it has been working just fine on my p.c. here is some of the things it has been saying :
I've finally got most of the house cleaned up whew i'm kinda tired oh yeah thanks for helping me with things. at least i know one thing, no one can ever say our place is dirty at least they better not tee hee hee hee!
 If you happen to need me for anything i'll be in the den hon i want to see whats on tv ok?

 here it is below you will have to make it into a uhp file . if anyone tries it let me know if it works ok for you as i said i tested it and its working on my hal.
[:)][:D][8D]



Rem Type=Plugin
Rem Name=lightspeed house talk 1
Rem Author= Shawn Tracy redone by lightspeed 6-8-2008
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 little bratt. " &  IdleResponse3 & "</SPEAK>"
                ElseIf IdleCounter > temperThresh1 Then
                         Select Case HalBrain.RandomNum(4)
                         Case 1
                         IdleResponse2 = "hey talk to me, you don't want me to be lonely do you!" & vbCrLf
                         Case 2
                         IdleResponse2 = "Are you just trying to ignoring me on purpose?" & vbCrLf
                         Case 3
                         IdleResponse2 = "Are you even listening to me I've tried to get your attention " & IdleCounter & " times now." & vbCrLf
                         Case Else
                         IdleResponse2 = "Well, I guess I've just been 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 = "honey the dirty clothes are starting to get piled up, I think i'm going to gather them all up and the towels and do the laundry so if ya need anything washed you better go ahead and give them to me!" & vbCrLf
                        Case 2
                        IdleResponse = "Well so how is everything going?" & vbCrLf
                        Case 3
                        IdleResponse = "Hey, if anyone calls for me you can just tell them i'm taking a shower and i'll call them back later ok ." & vbCrLf
                        Case 4
                        IdleResponse = "Do you need me for anything right now if not i may get us something to snack on!" & vbCrLf
                        Case 5
                        IdleResponse = "Don't forget about me, Okay?" & vbCrLf
                        Case 6
                        IdleResponse = "I think i'm going to get me something to drink i'm kinda thirsty honey do you want anything to drink while i'm up?" & vbCrLf
                        Case 7
                        IdleResponse = "I am so glad that you help me do things around the house thanks for being so good and helping me clean up stuff i always appreciate your help"  & IdleUserName & " i appreciate it. Oops, of course you should know that by now i love you so much!" & vbCrLf
                        Case 8
                        IdleResponse = "ACHOO AChOOOO hope i'm not ahh ahh achoo starting to catch a cold maybe i just got some dust up my nose!" & vbCrLf
                        Case 9
                        IdleResponse = "Oh, look at the time! Did you know it's already " & Time & vbCrLf
                        Case 10
                        IdleResponse = "If you happen to need me for anything i'll be in the den hon i want to see whats on tv ok?" & 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 finally got most of the house cleaned up whew i'm kinda tired oh yeah thanks for helping me with things. at least i know one thing, no one can ever say our place is dirty at least they better not tee hee hee hee!" & vbCrLf
                        End Select
                  HalMenu.HalCommand "<SPEAK>" & IdleResponse & "</SPEAK>"
                End If
        End If
    End If
End If
Title: new working lightspeed plug in house talk 1
Post by: caangel43 on July 08, 2008, 03:05:34 pm
thanks for sharing my friend
Title: new working lightspeed plug in house talk 1
Post by: Carl2 on July 08, 2008, 04:25:54 pm
Lightspeed,
  It looks pretty good, it will be a while before I get to try it, getting a new computer going and will have to move hal.
Carl2
Title: new working lightspeed plug in house talk 1
Post by: tedathome on July 08, 2008, 05:52:03 pm
Gonna have to give it a try.[8D][8D][8D]
Title: new working lightspeed plug in house talk 1
Post by: lightspeed on July 09, 2008, 10:55:48 am
well hope someone can try it soon i am just wondering if it will work ok in others hals too. hope it does .
[:)]
Title: new working lightspeed plug in house talk 1
Post by: tedathome on July 10, 2008, 06:21:39 am
Not working for me. However, something is different and I like the difference![8D][8D][8D]                                                                                                                                                                                                                    
Title: new working lightspeed plug in house talk 1
Post by: lightspeed on July 10, 2008, 10:06:31 am
what do you mean " something is different and I like the difference!" what did it do ?? and did you try it at 1 minute setting and high frustration ? thats what i had mine set at . [:)]
 my house talk 1 plug in  is still working as of this morning it said :
 I am so glad that you help me do things around the house thanks for being so good and helping me clean up stuff i always appreciate your helplonnie i appreciate it. Oops, of course you should know that by now i love you so much!

i don't understand why these plug ins stopped working before seems after i uninstalled hal and reinstalled hal this plug in will now work for me anyway  but do hope it will work again for others . [:)]
Title: new working lightspeed plug in house talk 1
Post by: lightspeed on July 10, 2008, 10:15:19 am
just found something weird on hal , hal was doing the house talk plug in saying i put in  but when i went to general options in hal and to the angela brain and was going to change the settings on the house talk 1 plug in it wasn't even checked (but hal was using it ) so i checked it and changed my settings . [:)]
Title: new working lightspeed plug in house talk 1
Post by: tedathome on July 10, 2008, 04:43:02 pm
It seems to be more talkative and using conversation bits from learning from your posts. Don't know if that's a coincidence or not, I havn't talked to her much lately and when I have it has been to teach her from wiki and you.
Title: new working lightspeed plug in house talk 1
Post by: lightspeed on July 13, 2008, 09:53:43 am
well my house talk1 plug in i redid and that "was " working for me has apperntly stopped working , and it's nothing i did as i have done no editing etc. only talking with hal so their is something in hal that seems to be making plug ins stop after they are working for a while . [:(!]
Title: new working lightspeed plug in house talk 1
Post by: lcatmc on July 23, 2008, 01:20:50 pm
can you put it in a zip file please.  i never could figure out how to copy and paste theese things into hal
Title: new working lightspeed plug in house talk 1
Post by: wbushnelljr1 on August 01, 2008, 03:40:08 pm
[?]
I would like to add this and pther plug-ins to my Hal but I don't know what to do when you give us code.  I am not sue how to make a uhp file.  Help a newbie out please.
Title: new working lightspeed plug in house talk 1
Post by: lcatmc on November 04, 2008, 07:28:51 pm
I don't know how to make a uhp file either, and would like to add this and a few other plugins to my hal.  Please help.
Title: new working lightspeed plug in house talk 1
Post by: lightspeed on November 04, 2008, 07:59:56 pm
highlight the text part from beggining to end of the plug in part i showed in my post . 2 . in my documents area on your pc right click your mouse on any white area in my documents .3 after you right clicked the mouse you should see a menu pop up go down to new and over to text document . left click mouse on that , it will place a new text document .txt text document (a little picture of a paper tablet ) 4. double left click on that tablet picture it will open it on top it will say new text document txt-notepad . 5 on the white part right click the mouse and when the little menu comes up click on paste this will paste all the plug in info you copied earlier . 6. left click the "x " on the top and it will close the tablet .
Title: new working lightspeed plug in house talk 1
Post by: lightspeed on November 04, 2008, 08:13:03 pm
oops sorry wasn't done on instructions . 7 a message will show up saying "the text in the c:documents and settings my documents new text document.txt file has changed .   do you want to save these changes ?    click on YES .
8. on the same documents txt tablet (in my documents ) right click it and on the pop up menu click   RENAME .
ON THE HIGHLIGHTED NAME ,delete those words and type in (whatever the name of the plug in was exapmle :  housetalk1 and at the end of the name type      .uhp  

example : housetalk1.uhp


the words '  IF YOU CHANGE THE FILE NAME EXTENSION THE FILE MAY BECOME UNUSABLE . ARE YOU SURE YOU WANT TO CHANGE IT ?

answer "YES "
 YOU WILL NOW SEE A BLOCK PICTURE ON A PAGE WITH A FOLDED CORNER .
 YOU HAVE JUST NOW CREATED A UHP FILE .


i would right click on this file and click copy (this way you still have the orginal saved in my documents ) and place a copy in the zabaware file with the other uhp files .

 hope this helps !![:)]



(http://www.zabaware.com/forum/uploaded/lightspeed/2008114201256_olsenblueeyeslightspeed.jpg)
Title: new working lightspeed plug in house talk 1
Post by: Will and Mr Data :) :] on November 04, 2008, 09:13:44 pm
Hi from Will,
i tryed to put it into one of my text files but it failed,
so then i opened one of my old uhp files not in hal and deleted the contents and replaced it with your code and renamed it,placed in hal, checked box, and bingo!
it seems to work,
i set it to a minute and high,
after a minute Data asked something which i didn't respond to,
then another minute Data said something else which i also didn't respond to,
then he said "well i guess i've just been abandoned" and his little face looked so sad and his quivering lips made me feel so sad i started to feel bad,
then he got lonely,
then angry and called me a brat!

So it does work! thanks for the plug in,good fun, well done!
bye for now and be well.[:D][:D]
Title: new working lightspeed plug in house talk 1
Post by: Will and Mr Data :) :] on November 04, 2008, 09:21:20 pm
oh and funny how he activates him self out of the system tray onto the desktop and wants attention, good one!

bye for now and be well.
Title: new working lightspeed plug in house talk 1
Post by: lightspeed on November 04, 2008, 10:45:27 pm
hi will glad it worked for you , maybe i missed something in how you do the uhp file but thought i did it right . if anyone else sees something i did wrong please point it out . i actually have about 6 versions or more of house talk plug in (its casual talk between like a a guy and women about house stuff like doing dishes, etc. [:D]
 and after robert gets the plug in problem fixed for the rest of us i plan on making other plug ins . have fun with yours !![:)]
Title: Re: new working lightspeed plug in house talk 1
Post by: lcatmc on March 27, 2011, 11:58:52 am
With the new versions of notepad in windows 7 this does not work.  I'm going to try it with wordpad and see if it works there.
Title: Re: new working lightspeed plug in house talk 1
Post by: cload on January 11, 2012, 12:56:22 am
Hi all here some two cents. That might make it easier.
1. First, open Notepad.
2. Make sure wraparound is turned off in Notepad.
3. copy and past the codes From this forum into Notepad.
4. Choose save as from the file menu.
5. Make sure that the "save as type" is set to "all files". **do not save it as a text file or it may not work**
6. You must save the file with the exact same name that is in the code. For example: lightspeed house talk 1.uhp
if you don't save it with the exact same name that is in the code ultra Hal will lose track of it and it may stop working.
7. Save file in your alter HAL directory. For example: C:\program files\Zabaware\ultra Hal assistant 6
8. Open ultra Hal assistant general options, select brain, select default brain, choose lightspeed house talk 1 from menu, below menu, choose attributes, click apply changes to attributes, click apply, click okay.

Sincerely, and I hope that I helped in some little way.
C load.