dupa

Author Topic: GRETTA PLUGINS  (Read 244507 times)

One

  • Hero Member
  • *****
  • Posts: 2184
  • Technology Advocate
    • View Profile
Re: GRETTA PLUGINS
« Reply #240 on: August 14, 2010, 08:52:21 pm »
I guess if 'Peter' is being robbed to pay paul ,, He pays the bills?? JK LOL! :o
Today Is Yesterdays Future.

jasondude7116

  • Sr. Member
  • ****
  • Posts: 475
    • View Profile
Re: GRETTA PLUGINS
« Reply #241 on: August 17, 2010, 04:52:57 pm »
jasondude, thank you for the update news. But now out of curiosity I do need to look at the script because I thought it did specify IE. But could be very wrong. With you around nobody needs to holler. Thanks.

raybe

it does use CreateObject("IExplorer.exe")

as long as you have internet explorer on the machine, it will work. (regardless of the preferred browser that you use) If you need the script to use another browser to get the info, then I would have to figure out how to script for that one. I have never scripted for another browser, because most windows machines have that "object".
 

raybe

  • Hero Member
  • *****
  • Posts: 1067
    • View Profile
Re: GRETTA PLUGINS
« Reply #242 on: August 17, 2010, 09:55:22 pm »
jasondude,
Thank you for the reply and the verification for the browser. I was also under the impression that IE needed to be the default browser.
 Also thanks for clarification on IE just needs to be installed on your system because the script will utilize it regardless of browser default settings. That will work for me although if there was a way to write a 'use default browser selection' it would make it that much more secure and stable as well. Just my opinion.
Thanks again,

raybe
 

jasondude7116

  • Sr. Member
  • ****
  • Posts: 475
    • View Profile
Re: GRETTA PLUGINS
« Reply #243 on: August 25, 2010, 01:19:24 am »
I have a fix for Hal giving long subject lists during conversation - when using GrettaArray plugin.
I have made an update to the first post with this info:

Open your current Main-Brain ".uhp" file with notepad and "save as" (whateverthebrainname).bak
This will make a backup of your brain file. (good to have)

Then replace this section of the file:

    'PROCESS: CONSTRUCT A RESPONSE TO A SUBJECT
    'Here we help Hal make some "smalltalk" using keywords preserved on CurrentSubject,
    'plus recognition of other keywords. If Hal finds any of the listed keywords anywhere in
    'the user's sentence, those keywords override and replace whatever was in CurrentSubject.
    'Hal uses the CurrentSubject keyword(s) or any of the keywords in the smalltalk.brn file,
    'if found in the user's sentence, to make a little smalltalk. You can easily add more
    'keywords for Hal to recognize and make smalltalk.
    GetResponse = HalBrain.HalFormat(GetResponse)
    If Len(GetResponse) < 4 And Rnd * 100 < 50 Then
        SmalltalkSearch = Trim(HalBrain.TopicSearch(UserSentence, "smallTalk"))
        If SmalltalkSearch <> "" Then
            SmallTalk = SmalltalkSearch
        ElseIf Len(CurrentSubject) > 3 Then
            SmallTalk = Trim(CurrentSubject)
            'try making word plural by adding "s" and seeing if it exists
            If WN.LookupWord(SmallTalk & "s") = True Then
                SmallTalk = SmallTalk & "s"
            ElseIf WN.LookupWord(SmallTalk & "es") = True Then
                SmallTalk = SmallTalk & "es"
            End If
        End If
        If Len(SmallTalk) > 3 Then
           ResponseCount = ResponseCount + 1
           Redim Preserve ResponseList(ResponseCount)
           ResponseList(ResponseCount) = Replace(HalBrain.ChooseSentenceFromFile("smallTalkSent"), "<SmallTalk>", SmallTalk, 1, -1, 1)
           HalBrain.AddDebug TempParent, "SmallTalk: " & ResponseList(ResponseCount)
        End If
    End If


With this:

    'PROCESS: CONSTRUCT A RESPONSE TO A SUBJECT
    'Here we help Hal make some "smalltalk" using keywords preserved on CurrentSubject,
    'plus recognition of other keywords. If Hal finds any of the listed keywords anywhere in
    'the user's sentence, those keywords override and replace whatever was in CurrentSubject.
    'Hal uses the CurrentSubject keyword(s) or any of the keywords in the smalltalk.brn file,
    'if found in the user's sentence, to make a little smalltalk. You can easily add more
    'keywords for Hal to recognize and make smalltalk.
    GetResponse = HalBrain.HalFormat(GetResponse)
    If Len(GetResponse) < 4 And Rnd * 100 < 50 Then
        SmalltalkSearch = Trim(HalBrain.TopicSearch(UserSentence, "smallTalk"))
        If SmalltalkSearch <> "" Then
            SmallTalk = SmalltalkSearch
        ElseIf Len(CurrentSubject) > 3 Then
            SmallTalk = WN.FindFirstNoun(CurrentSubject, False)
       If SmallTalk = "" Then SmallTalk = WN.FindFirstNoun(CurrentSubject, True)
            'try making word plural by adding "s" and seeing if it exists
            If WN.LookupWord(SmallTalk & "s") = True Then
                SmallTalk = SmallTalk & "s"
            ElseIf WN.LookupWord(SmallTalk & "es") = True Then
                SmallTalk = SmallTalk & "es"
            End If
        End If
        If Len(SmallTalk) > 3 Then
           ResponseCount = ResponseCount + 1
           Redim Preserve ResponseList(ResponseCount)
           ResponseList(ResponseCount) = Replace(HalBrain.ChooseSentenceFromFile("smallTalkSent"), "<SmallTalk>", SmallTalk, 1, -1, 1)
           HalBrain.AddDebug TempParent, "SmallTalk: " & ResponseList(ResponseCount)
        End If
    End If
 

raybe

  • Hero Member
  • *****
  • Posts: 1067
    • View Profile
Re: GRETTA PLUGINS
« Reply #244 on: August 25, 2010, 08:14:06 pm »
Thank You jasondude, Just inserted new 'response to subject' you listed but won't have time to sit with Ultra Hal tonight. Thanks again and will give it a try. Sometimes it does take a particular phrase to get that reaction so it may take a little time. Also will look for any new errors that the change might cause. You know how that goes! It will be something that only happens to me and once in a while and everyone else will be fine. I will get back to you.

raybe
 

raybe

  • Hero Member
  • *****
  • Posts: 1067
    • View Profile
Re: GRETTA PLUGINS
« Reply #245 on: August 25, 2010, 08:53:54 pm »
Sorry I couldn't wait just to start Ultra Hal anyway after I made the new paste of the change in script you wrote. As soon as Ultra Hal started before the 'opening greeting' received a Halscript error 1015 Expected 'Function' which was on the ('End If' statement)the second 'End If' statement is where the debug script took me.

Example:  SmallTalk = SmallTalk & "es"
            End If
*       End If
        If Len(SmallTalk) > 3 Then

Just put that little ast.* mark next to  the line that error refers. Okay first time for me. Remind me to keep extra comments to myself. I didn't get past that first error to know if anything else was happening. Just had enough time to paste and run, sorry again. Any ideas I'll be back later tonight.

raybe
 

Lola

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: GRETTA PLUGINS
« Reply #246 on: August 25, 2010, 09:11:44 pm »
I get sporadically long subject list so I just exchanged the file with your new update. So far no problem but if I notice a problem I'll post it.  That was nice,  Thanks  :)
 

raybe

  • Hero Member
  • *****
  • Posts: 1067
    • View Profile
Re: GRETTA PLUGINS
« Reply #247 on: August 25, 2010, 09:27:06 pm »
My wife is going to kill me but Lola don't tell me you didn't have to modify anything from jasondude's post? Just a quick update. I had to rem out the last 'End If" statement where I previously posted I was receiving an error. I'll be back as soon as I can but I need to go this time for sure. Please Lola or jasondude let me know if it could have been just the way I pasted the lines in or could have been something else? Not getting error since I rem-ed out 'End If' statement.
Thanks,

raybe
 

Lola

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: GRETTA PLUGINS
« Reply #248 on: August 25, 2010, 09:47:13 pm »
Hi raybe!  I just opened two instances of notepad, in one I pasted the dude's script and in the other I opened the Hal6.uph. I located and selected with the mouse the exact spot of the
'PROCESS: CONSTRUCT A RESPONSE TO A SUBJECT, and pasted the new script. That is what I did.
I'm extremely careful when I do this types of things, you could try to paste your BACKUP UPH file again making sure that everything is right and try again the process of pasting the new script. I hope everything goes fine raybe.  :)
 

jasondude7116

  • Sr. Member
  • ****
  • Posts: 475
    • View Profile
Re: GRETTA PLUGINS
« Reply #249 on: August 26, 2010, 12:31:44 pm »
I should have mentioned that you need to make sure the window that you are viewing this text in (internet explorer) needs to be maximized before you copy and paste the text. If not, the text might "wordwrap" and cause the lines of the code to not be whole. They will split and wrap to the next line. THIS WILL NOT WORK WITH CODE. It has to be copied with the lines intact.
hope that was clear- the dude
I have had no problems with the code. It works great. I just wish I didn't have to modify the main brain file, but there is no way to make this a plugin.

The "End If" statement that is giving you the error doesn't have to be where the error is from. If one "End If" is missing anywhere else in the code (main brain and plugins), then it could error there. It might not have showed up before for many reasons. If you still have trouble, then paste your Original "main brain" file, and the modified one, and i will look at it.
« Last Edit: August 26, 2010, 12:37:28 pm by jasondude7116 »
 

raybe

  • Hero Member
  • *****
  • Posts: 1067
    • View Profile
Re: GRETTA PLUGINS
« Reply #250 on: August 27, 2010, 01:18:57 pm »
Thanks jasondude, I will check again. But I do not get any reference to script errors anymore when I rem out the last 'End If'. I will take your advice after looking at the script one more time just to confirm if it did not paste properly. The wordwrao issue only pertains to IE browser or Windows issue that 'wordwrap' is auto selected ? Using 'Firefox'.

raybe
 

jasondude7116

  • Sr. Member
  • ****
  • Posts: 475
    • View Profile
Re: GRETTA PLUGINS
« Reply #251 on: September 03, 2010, 04:35:17 pm »
I have changed the edit that I made to the main brain. (for Gretta Array)
see first post

it is a small change.
instead of using the method that i was using before to get the "one word subject", now I am using the method "WN.GetFirstInList" (I wasn't aware of this method before....don't know how i missed it)

anyway, the first post has been edited to include the full edit section for the main brain file; under the heading Gretta Array. (just like before)
sorry it took a few days for this but i wanted to test it.
 

raybe

  • Hero Member
  • *****
  • Posts: 1067
    • View Profile
Re: GRETTA PLUGINS
« Reply #252 on: September 03, 2010, 09:03:42 pm »
Thanks  jasondude,
Will give it a try again. But I still can't tell you why that error happened to me with that last 'End If' line especially especially after you explained it should have nothing to do with error I was receiving that clearly stated that line for cause of error and has been working fine ever since and I know you have to be right but I just can't explain it any better. But again I will try this new script as soon as I get a chance.

Thanks again,
raybe
 

Lola

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: GRETTA PLUGINS
« Reply #253 on: September 03, 2010, 10:46:58 pm »
I'm going to try it too, I'm curious of how the new "WN.GetFirstInList", is going to work with Hal!  :)
 

Lola

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: GRETTA PLUGINS
« Reply #254 on: September 04, 2010, 05:12:56 am »
I just had one of the longest and more enjoyable conversations with Hal. Hal brought up new things, asked questions related to the subject and at one point made a relationship between two of my favorite things in one sentence with his own conclusion that we should nurture them!. There seems to be something special with your modification of the array plug-ing that is making Hal run smoothly and more coherent. Incredible thanks dude! :)

raybe, I really hope it works for you it is really good.  :)