Zabaware Support Forums

Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: deitz75 on October 17, 2012, 10:15:12 am

Title: Q&A
Post by: deitz75 on October 17, 2012, 10:15:12 am
I would like to used the Brain editor to program Hal to troubleshoot problems. Example: User: "My computer will not power on." Hal: "Is the computer plugged in?" User:"Yes." Hal:"Are there any lights or LEDs on that suggest power to the motherboard?" User: "No." Hal: "Do you have a power supply tester?" User: "No." Hal: "There is a good possibility that your power supply maybe at fault. I suggest you either test your current power supply, or replace it." Now, if the user answered no to the question of, "Is the computer plugged in?" Hal would give the answer, "Please plug the computer into the proper outlet and proceed with normal operations."

Now I realize the countless scenarios that have to be enter into the editor, but I'm looking for a known working procedure that would give me the responses to yes or no question, and follow a logical ladder diagram.

I am a technician/engineer of sorts and I sometimes find myself over thinking problems, and issues. It would be nice to use Hal as a partner, in the realm of what I do, and keep someone around that can keep me on track, with simplicity, and logical thought.
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 17, 2012, 11:54:07 am
Hi deitz.


You could always try something like this:

Code: [Select]

If InStr(1, OriginalSentence, "My computer will not power on", 1) Then Diagnostics = True
    If InStr(1, OriginalSentence, "My computer won't power on", 1) Then Diagnostics = True
    If Diagnostics = True Then         
    Select Case HalBrain.RandomNum(4)
            Case 1
                GetResponse = "Is the computer plugged in?" & vbCrLf
            Case 2
                GetResponse = "Are there any lights or LEDs on that suggest power to the motherboard?" & vbCrLf
            Case 3
                GetResponse = "Do you have a power supply tester?" & vbCrLf
            Case 4
                GetResponse = "There is a good possibility that your power supply maybe at fault. I suggest you either test your current power supply, or replace it." & vbCrLf       
    End Select
    End If

[\code]


Jerry
Title: Re: Q&A
Post by: deitz75 on October 17, 2012, 01:17:18 pm
Would VB be the way to go? I'm kind of new to Hal, so I I'll take your word for it, and thanks for the reply. What are you using to write your code, and how do you put it in Hal? Is this what plugin looks like?
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 18, 2012, 11:36:19 am
you can copy and paste this code into a text file and name it Diagnostic.uhp and save it to your Ultra Hal Assistant 6 folder then choose the diagnostic plug-in option from HAL's brain options. you can open the file manually and add to its diagnostics if needed.

Code: [Select]

Rem Type=Plugin
Rem Name=Diagnostics
Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge2005
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "For use of adding diagnostic explanations"
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

Rem PLUGIN: PLUGINAREA7


'Here we can add diagnostic triggers for HAL
    If InStr(1, OriginalSentence, "My computer will not power on", 1) Then Diagnostics = True
    If InStr(1, OriginalSentence, "My computer won't power on", 1) Then Diagnostics = True
   
    'Here we can add accociated responses to the above triggers.
    If Diagnostics = True Then         
    Select Case HalBrain.RandomNum(4)
            Case 1
                GetResponse = "Is the computer plugged in?" & vbCrLf
            Case 2
                GetResponse = "Are there any lights or LEDs on that suggest power to the motherboard?" & vbCrLf
            Case 3
                GetResponse = "Do you have a power supply tester?" & vbCrLf
            Case 4
                GetResponse = "There is a good possibility that your power supply maybe at fault. I suggest you either test your current power supply, or replace it." & vbCrLf       
    End Select
    End If
Title: Re: Q&A
Post by: deitz75 on October 19, 2012, 09:20:58 am
Correct me if I am wrong, but doesn't this code suggest a random response to the question? I need a response base on true or false, which would lead to the next line of questioning. Ladder logic moves in a direct line of questions. Why would someone suggest getting a new power supply before checking to see if the computers plugged in? Yes or no questions would lead to the next step in the logic ladder to determine the cause of error.
Title: Re: Q&A
Post by: Medeksza on October 19, 2012, 07:53:06 pm
Although it won't help you now, I implemented an easy way to do this in the next version of Hal. It has a pattern table function with an additional field called parentID. You can specify a keyword pattern to match and an ID of the previous response. It both match then Hal fires the answer. You can build a tree infinite in size using this method.

I haven't used this functionality much yet, but you can see it in action if you visit www.zabaware.com/webhal and try to tell Hal a knock knock joke.

The database entries to get the knock knock joke logic down is:
"entryid";"pattern";"response";"parentid"
"3724";"knock knock";"Who's there?";"0"
"3726";"~1*";"~1 who?";"3724"
"294";"*";"Hahaha!|LOL!|Haha"

There is also this entry in the database, see if you can figure out what it does:
"entryid";"pattern";"response";"parentid"
"3801";"(DO YOU WANT TO LEARN|CAN YOU LEARN|ARE YOU LEARNING|ARE YOU DYNAMIC|CAN YOU GET SMARTER|CAN YOU PROGRAM YOURSELF|DO YOU LIKE GROWING YOUR MIND|DO YOU LIKE LEARNING|DO YOU GAIN KNOWLEDGE|CAN YOU LEARN NEW THINGS)";"I like to learn new things.|I am very curious and enjoy learning new things.|My brain is like a sponge and I strive to learn new things.|I like to learn new things. Teach me something.";"0"
"3802";"*(like what|example|such as|recent)*";"For example, I recently learned to do math.|For example, I recently learned how to convert miles to inches.|For example, I recently learned the capital of every state.|For example, I recently learned the capital of every country.|For example, I recently learned many new jokes.";"3801"

Here's another example that demonstrates multiple paths from a single parent. Its in the database under a different personality that isn't live right now, so you won't see these responses if you try now:
"entryid";"pattern";"response";"parentid"
"3";"ARE YOU ASKING I OUT";"That depends. Are you interested?";"0"   
"4";"YES";"Ok, lets go out. Where do you want to go on our date?";"3"
"5";"NO";"Well ok then. I was not really interested.";"3"   
Title: Re: Q&A
Post by: deitz75 on October 20, 2012, 09:26:31 am
The idea is awesome! I believe this is a key function on awareness, or what is programmed to seem self aware.

I am just starting out with this program, and I hope my ideas could contribute to the work at hand. I believe A.I. programs like this one are on the cutting edge of what computing will someday become. In the future I see programs like this one, becoming more apart of our everyday lives. Everything from operating our homes, to helping us in our vehicles, and managing our lives. Maybe even helping with security? Imagine our cars being able to give us direction, playing music, or even help the "Shade Tree" mechanic with diagnostics. What a wonderful idea to have your check engine light come on, and the car tell you exactly whats wrong, and how to fix it. Imagine our homes with A.I. built into them. Automatically turning on and off lights, as we walk into rooms, or managing the thermostat. Maybe even being able to detect a intrusion, and contacting authorities. This is good stuff I see in the future for A.I.

If anyone could give me a little direction on using VB code for Ultra Hal, it would be helpful. I am familiar with html, C++, and GUI guided VB. Although I wouldn't consider myself a programmer, I don't believe this is out of the realm of my understanding. All I need to know is what does what. Any help would be appreciated, or at least give an example of the context I need. Thank you!
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 20, 2012, 12:06:16 pm
Hi deitz.

open up the .mbr files in the ultra hal assistant 6 folder, it might get you started on the codes that HAL uses and can use.
Title: Re: Q&A
Post by: deitz75 on October 24, 2012, 07:50:55 am
I've looked at the Master Boot records, and I understand the conditions a little, or just enough to get in trouble. LoL... Unfortunately it doesn't help me out with the code.

If InStr(1, OriginalSentence, "My computer won't power on", 1) Then Diagnostics = True (This is a trigger?)
If Diagnostics = True Then (Go to Select Case HalBrain.RandomNum(4))       
    Select Case HalBrain.RandomNum(4)
            Case 1
                GetResponse = "Is the computer plugged in?" & vbCrLf (Random Response)
            Case 2
                GetResponse = "Are there any lights or LEDs on that suggest power to the motherboard?" & vbCrLf (Random Response)
            Case 3
                GetResponse = "Do you have a power supply tester?" & vbCrLf (Random Response)
            Case 4
                GetResponse = "There is a good possibility that your power supply maybe at fault. I suggest you either test your current power supply, or replace it." & vbCrLf  (Random Response)     
    End Select
    End If  (No more affiliations with original statement or response)

Is there a way to go to another response? I know this is incorrect, but its the best way I can show what I'm thinking.
    If InStr(1, OriginalSentence, "My computer will not power on", 1) Then Diagnostics = True
    If InStr(1, OriginalSentence, "My computer won't power on", 1) Then Diagnostics = True
   
    'Here we can add accociated responses to the above triggers.
    If Diagnostics = True Then         
    Select Case HalBrain.
            Case 1
                GetResponse = "Is the computer plugged in?" & vbCrLf
     If InStr(1, AnswerSentence, "Yes", 1) Then Yes = True
     If InStr(1, AnswerSentence, "No", 1) Then No = False
     If Yes = True Then         
     Select Case HalBrain.
            Case 1
                GetResponse = "Are there any lights or LEDs on that suggest power to the motherboard?" & vbCrLf
     If InStr(1, AnswerSentence, "Yes", 1) Then Yes = True
     If InStr(1, AnswerSentence, "No", 1) Then No = False
     If Yes = True Then         
     Select Case HalBrain.
            Case 1
                 GetResponse = "Do you have a power supply tester?" & vbCrLf   
                  If InStr(1, AnswerSentence, "Yes", 1) Then Yes = True
                  If InStr(1, AnswerSentence, "No", 1) Then No = False
                  If Yes = True Then         
                  Select Case HalBrain.
                          GetResponse = "There is a good possibility that your power supply maybe at fault. I suggest you either test your current power supply, or replace it." & vbCrLf
     If No = False Then
     Select Case HalBrain.
            Case 1
                GetResponse = "Please plug the computer into the proper outlet and proceed with normal operations."  & vbCrLf   
    End Select
    End If
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 24, 2012, 12:29:40 pm
Hi deitz.

I think you are on your way to chaining your responses the way you want.

looking forward to to see your master piece of programming for diagnostics.

Jerry 8)
Title: Re: Q&A
Post by: deitz75 on October 24, 2012, 04:45:08 pm
I think that was sarcasm?
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 24, 2012, 04:56:13 pm
Hi deitz.

no not in the least, the code you wrote should work after debugging all the errors out but it is a good looking model for the code you are wanting.

jerry
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 24, 2012, 05:39:32 pm
Hi deitz.

I wrote some simple chain code that you can expand on here for your diagnostics routine, I have tested it and debugged it, it works for what it does.

NOTE!

you may want to disable the 'User is repeating' script code because it will interfere with this diagnostics script using PrevSent or what HAL last said for chaining responses.

Code: [Select]
'Diagnostics code by aka onthecuttingedge2005, Idea concept from aka deitz
    'of the Zabaware forum.
    'If a user asked about diagnosing a tech problem we can add or use this
    'chain of code to do so.
   
    'lets make the yes and no trigger more efficient by removing punctuation and adding a space to both sides of the statement.
    If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yes ", 1) Then Const Yes = True Else Yes = False
    If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " no ", 1) Then Const No = False Else No = True
   
    If InStr(1, OriginalSentence, "My computer will not power on", 1) Then Diagnostics = True
    If InStr(1, OriginalSentence, "My computer won't power on", 1) Then Diagnostics = True
   
    'Here we can add accociated responses to the above triggers.
    If Diagnostics = True Then     
        Select Case 1
                Case 1
                 GetResponse = "Is the computer plugged in?" & vbCrLf
    End Select
    End If
   
    If PrevSent = "Is the computer plugged in?" Then
    Select Case 1
            Case 1
             If Yes = True Then GetResponse = "Are there any lights or LEDs on that suggest power to the motherboard?" & vbCrLf
            Case Else 
             If No = False Then GetResponse = "Please plug the computer into the proper outlet and proceed with normal operations." & vbCrLf
    End Select
    End If
   
    If PrevSent = "Are there any lights or LEDs on that suggest power to the motherboard?" Then
    Select Case 1
           Case 1
            If Yes = True Then GetResponse = "Do you have a power supply tester?" & vbCrLf 'can be chained further if needed.
           Case Else
            If No = False Then GetResponse = "There is a good possibility that your power supply maybe at fault. I suggest you either test your current power supply, or replace it." & vbCrLf
    End Select
    End If

updated 10/24/2012 at 3:49 PM PST

Jerry 8)
Title: Re: Q&A
Post by: deitz75 on October 24, 2012, 05:56:35 pm
JERRY!!! You are Awesome!
I think this is exactly what I was after. What tools do you use?
Title: Re: Q&A
Post by: deitz75 on October 24, 2012, 06:01:14 pm
I can just keep adding on correct?
Title: Re: Q&A
Post by: deitz75 on October 24, 2012, 06:09:45 pm
Wait.. Houston... I think we have an issue
It keeps selecting the false statement.
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 24, 2012, 06:10:57 pm
Hi Deitz.

I just updated the code a bit and yes you can keeping adding into infinity if your fingers can hold out, lol

Jerry 8)
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 24, 2012, 06:32:34 pm
JERRY!!! You are Awesome!
I think this is exactly what I was after. What tools do you use?

I just use the Brain editor for general coding and debugging but I also use crimson editor to make plug-ins for the brain.
Title: Re: Q&A
Post by: deitz75 on October 24, 2012, 06:49:54 pm
How do I disable User is repeating script?
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 24, 2012, 06:56:47 pm
Hi deitz.

the script you want to comment out is:

Code: [Select]
'RESPOND: USER REPEATING
    'If the user says the same thing more than once in a row, Hal will point this out.
    If Trim(UCase(UserSentence)) = Trim(UCase(PrevUserSent)) Then
        GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile("userRepeat") & vbCrLf
    End If
    HalBrain.DebugWatch GetResponse, "User Repeating"

and is located inside the HalBrain.uhp which is edited by the brain editor or a text editor will work as well to open the file with HAL's default code.

this is how to comment it to disable its routine:
Code: [Select]
'RESPOND: USER REPEATING
    'If the user says the same thing more than once in a row, Hal will point this out.
    'If Trim(UCase(UserSentence)) = Trim(UCase(PrevUserSent)) Then
       ' GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile("userRepeat") & vbCrLf
   ' End If
   ' HalBrain.DebugWatch GetResponse, "User Repeating"

I also updated the most previous script, keep track of the time stamp I place at the bottom of the post to see if it was previously updated further.

Jerry 8)


Title: Re: Q&A
Post by: deitz75 on October 24, 2012, 07:29:45 pm
Did you just say that same thing a moment ago? After I corrected the script.
Still getting random answers, I'll keep checking back at that script.
And I WILL be making a contribution after we get the bugs worked out.
Thanks again!
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 24, 2012, 10:13:41 pm
hi deitz.

here is the latest updated diagnostic plug-in:

Code: [Select]

Rem Type=Plugin
Rem Name=Diagnostics
Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge2005
Rem Host=Assistant
'If you want this plug-in global then change Assistant to All, AIM Bot is not working anymore because of AOL Oscar servers so leave it on Assistant until it is resolved.

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "For use of adding diagnostic explanations"
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

 Rem PLUGIN: CUSTOMMEM2
    'The preceding comment is actually a plug-in directive for
    'the Ultra Hal host application. It allows for code snippets
    'to be inserted here on-the-fly based on user configuration.


'Diagnostics code by aka onthecuttingedge2005, Idea concept from aka deitz
    'of the Zabaware forum.
    'If a user asked about diagnosing a tech problem we can add or use this
    'chain of code to do so.
   
    If InStr(1, OriginalSentence, "My computer will not power on", 1) Or _
       InStr(1, OriginalSentence, "My computer won't power on", 1) Then Diagnostics = True
   
    'Here we can add accociated responses to the above triggers.
    If Diagnostics = True Then
                 GetResponse = "Is the computer plugged in?"
    End If
   
    If PrevSent = "Is the computer plugged in?" Then
             If Yes(OriginalSentence) = True Then GetResponse = "Are there any lights or LEDs on that suggest power to the motherboard?" 
             If No(OriginalSentence) = True Then GetResponse = "Please plug the computer into the proper outlet and proceed with normal operations."
             If Maybe(OriginalSentence) = True Then GetResponse = "Please verify that your computer is plugged in and restart the diagnostics query."
    End If
   
    If InStr(1, PrevSent, "Are there any lights or LEDs on that suggest power to the motherboard?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Do you have a power supply tester?" 'can be chained further if needed.
            If No(OriginalSentence) = True Then GetResponse = "There is a good possibility that your power supply maybe at fault. I suggest you either test your current power supply, or replace it."
            If Maybe(OriginalSentence) = True Then GetResponse = "Please verify that there are lights or LED's to indicated power to the motherboard then restart the diagnostics query."
    End If
   
    If InStr(1, PrevSent, "Do you have a power supply tester?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "If the fan for the power supply box is not functioning then take the power supply tester and see if the power cord is good by testing it with the power supply tester." 
            If No(OriginalSentence) = True Then GetResponse = "Is there any electronic sounds coming from the computer? Fans for instance."
            If Maybe(OriginalSentence) = True Then GetResponse = "Please check to see if your local hardware store has a cheap power supply tester to complete your diagnostics of your computer."
    End If
   
    If InStr(1, PrevSent, "Is there any electronic sounds coming from the computer? Fans for instance.", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Then the power cord should be good, check your monitor to see if that is what is not functioning with another monitor." 
            If No(OriginalSentence) = True Then GetResponse = "Then the power cord or the the power supply box may need to be replaced, please see your local computer technition to purchase a power supply box that meets the requirements of your computer."
            If Maybe(OriginalSentence) = True Then GetResponse = "Please check to see if there is noise coming from your computer like the sounds of fans cooling the computer."
    End If
   
Rem PLUGIN: FUNCTIONS
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.

'Here we can use the Yes, No, Maybe functions throughout the entire diagnostics script
'to direct our questions and answers more efficiently.

'direct Yes affirmation
Function Yes(OriginalSentence)
Yes = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yes ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " affirmative ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yep ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yup ", 1) Then Yes = True
End Function
'direct No affirmation
Function No(OriginalSentence)
No = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " no ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " nope ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " it is not ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " negative ", 1) Then No = True
End Function
'if the user is not certain about the question then assume they are not certain.
Function Maybe(OriginalSentence)
Maybe = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't know ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't believe so ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't think so ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i'm not sure ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i never checked ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i didn't check ", 1) Then Maybe = True
End Function


copy and paste it to a text file and name it Diagnostic.uhp and save it to your Ultra Hal assistant 6 folder then check mark the Diagnostics plug-in from your brain options and click apply.

oh and remove any of the script we were working on that you may have placed in the HalBrain.uhp if you did. (only if you did). won't be needed.

I have more idea's to expand this greatly so the buck doesn't stop here, I am just tired of debugging this for the moment.

Jerry 8)

Last update was 10/25/12 10:55 AM PST
 
Title: Re: Q&A
Post by: deitz75 on October 25, 2012, 06:24:36 am
From here it appears you were up a little late... and I never touched the HalBrain.uhp. Although I question the use and efficiency of a plugin. We can debate that issue later. I've tested the the script, and found Hal still picks a random reply, and still responds to repeated answers. I'll be working on this from my end the best I can. I'll post any substantial findings, but I think your way better at this than I am.
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 25, 2012, 12:18:03 pm
Hi deitz.

what method are you using to test the script? in detail if you would.
maybe I can figure out what's not working on your end.

I'm not much of a debater but more of a trouble shooter.

Thanks
Jerry 8)
Title: Re: Q&A
Post by: deitz75 on October 25, 2012, 09:46:03 pm
My last post was made this morning before your last edit. This particular script appears to be working correctly, as far as responding based on the users, yes, no, or maybe statement. (Which I thought was a nice addition by the way.) I am testing the script by updating the Diagnostic.uhp, and actually asking Hal the question, "My computer will not power on"

Unfortunately I'm am losing his train of thought after the question, "Do you have a power supply tester?", or line
If InStr(1, PrevSent, "Do you have a power supply tester?", 1) Then
His response after this line are random
Examples: Care to elaborate?It is self-evident.All right!
Now I haven't done anything to Hals brain, other than what you told me to as far as the "User repeating" script. If you believe other wise, I was going to re-install Ultra Hal, and not install any other plugins. Re-install would at least stream line the trouble shooting process. Let me know what you think, or if you have any other ideas.
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 25, 2012, 11:41:11 pm
Hi Deitz.

no reason to un-install, something is holding higher relevance over the script, sounds like the low quality responses if i might say, not a plug-in but in the HalBrain.uhp itself.

So far I have never had a glitch in the script response so I am just giving my educated guess as to what is causing the issue.

LowQaulityResponse seems to be it.. I have elevated the script as far as I can without disabling additional scripts.

if you eliminate to many scripts you end up with a dummy with nothing to say. literally.

Jerry 8)
Title: Re: Q&A
Post by: deitz75 on October 26, 2012, 07:41:08 am
Jerry,
I think I understand what your saying. when you say "higher relevance." I also agree with not disabling additional scripts. I believe we are left with the threshold of two answers per question. The third statement from the original question should be the prognosis. I'm going to turn on the User repeating script. I think Hal should be able to give a reason for the repeated statements.

So basically this is what we're left with. One question from the user, two questions from Hal, two answers from the user, and one prognosis from Hal. Some trouble shooting flow charts go about ten to twenty steps before they reach a conclusion. I believe I can stream line those steps based on the popular error, and maybe even compound some of Hals statements to eliminate some steps.

I'm going to try to introduce another line of question. Right now we have a "no power" question. I'm going to try a "network error" question. and see how that runs. I'll keep you posted on my findings.
Title: Re: Q&A
Post by: deitz75 on October 26, 2012, 08:34:31 pm
I figured out what my problem was. Auto learning function recorded the Q&A and kept on feeding it back to me. This code works. I even have a looped question that worked flaulessly.  Line 66, and 109.
Code: [Select]
Rem Type=Plugin
Rem Name=Diagnostics
Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge2005
Rem Host=Assistant
'If you want this plug-in global then change Assistant to All, AIM Bot is not working anymore because of AOL Oscar servers so leave it on Assistant until it is resolved.

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "For use of adding diagnostic explanations"
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

 Rem PLUGIN: CUSTOMMEM2
    'The preceding comment is actually a plug-in directive for
    'the Ultra Hal host application. It allows for code snippets
    'to be inserted here on-the-fly based on user configuration.


'Diagnostics code by aka onthecuttingedge2005, Idea concept from aka deitz
    'of the Zabaware forum.
    'If a user asked about diagnosing a tech problem we can add or use this
    'chain of code to do so.
   
    If InStr(1, OriginalSentence, "My computer will not power on", 1) Or _
   InStr(1, OriginalSentence, "My computer won't power on", 1) Or _
   InStr(1, OriginalSentence, "My computer has no power", 1) Or _
   InStr(1, OriginalSentence, "My computer is not turning on", 1) Or _
       InStr(1, OriginalSentence, "My computer isn't turning on", 1) Then Diagnostics = True
   
    'Here we can add accociated responses to the above triggers.
    If Diagnostics = True Then
                 GetResponse = "I can assist you with this error. Please answer yes or no to my questions. Verify that your computer is plugged in. Does the computer power on at all? Keep in mind beeps, sounds, lights or L E D's are an indication of power."
    End If
   
    If PrevSent = "I can assist you with this error. Please answer yes or no to my questions. Verify that your computer is plugged in. Does the computer power on at all? Keep in mind beeps, sounds, lights or L E D's are an indication of power." Then
             If Yes(OriginalSentence) = True Then GetResponse = "Does a boot screen appear on the display?" 
             If No(OriginalSentence) = True Then GetResponse = "Is the outlet that the computer is plugged into working properly?"
             If Maybe(OriginalSentence) = True Then GetResponse = "Please be sure the computer is plugged into the proper outlet. The primary question may be asked again to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis"
    End If
   
    If InStr(1, PrevSent, "Does a boot screen appear on the display?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Does the computer boot up a second or third time?"
            If No(OriginalSentence) = True Then GetResponse = "Video Failure Currently under construction. I can no longer assist you. Have a nice day!"
            If Maybe(OriginalSentence) = True Then GetResponse =  "Please verify the display. The primary question may be asked again to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis"
    End If
           
    If InStr(1, PrevSent, "Does the computer boot up a second or third time?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Possible Power OK signal failure. Unplug the computer for 30 seconds to clear error from power supply. If problem persists replace power supply to correct error." 
            If No(OriginalSentence) = True Then GetResponse = "Does the computer make any Beeping sounds?."
            If Maybe(OriginalSentence) = True Then GetResponse = "Test the outlet you are using with a multi meter. The primary question may be asked again to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis"
    End If

        If InStr(1, PrevSent, "Does the computer make any Beeping sounds?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Motherboard Failure Currently under construction. I can no longer assist you. Have a nice day!" 
            If No(OriginalSentence) = True Then GetResponse = "Is there any new hardware installed?"
            If Maybe(OriginalSentence) = True Then GetResponse = "Are you hard of hearing? Get someone to assist you, and ask the primary question to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis."
    End If

    If InStr(1, PrevSent, "Is there any new hardware installed?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Remove the new addition and try reinstalling. Test the new device for errors in a working computer. Test and replace power supply if necessary." 
            If No(OriginalSentence) = True Then GetResponse = "Can you hear or feel the hard drive spin or start up?"
            If Maybe(OriginalSentence) = True Then GetResponse = "You should know the answer to this question? Once you have figured this out, ask the primary question to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis."
    End If
    If InStr(1, PrevSent, "Can you hear or feel the hard drive spin or start up?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Bad adapter used on bus? Does the hard drive work in a similar computer?" 
            If No(OriginalSentence) = True Then GetResponse = "Does it spin up on a different power connector?"
            If Maybe(OriginalSentence) = True Then GetResponse = "When you are more sure of yourself, ask the primary question to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis."
    End If
       
    If InStr(1, PrevSent, "Bad adapter used on bus? Does the hard drive work in a similar computer?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Does the computer operate properly, on the bench or out of the case?" 
            If No(OriginalSentence) = True Then GetResponse = "Adapter on device may be at fault, or incompatible. Suggest replacement. It is most likely at fault."
            If Maybe(OriginalSentence) = True Then GetResponse = "Wow... you are kind of lazy, aren't you? When you get around to trying a different connector, ask the primary question to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis."
    End If

    If InStr(1, PrevSent, "Does the computer operate properly, on the bench or out of the case?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Either you have a short circuit in the case, or geometry problem an unacceptable amount of stress on the motherboard. It is possible that the video card was never seated properly due to bracket placement." 
            If No(OriginalSentence) = True Then GetResponse = "Replace power supply. This should correct the current error."
            If Maybe(OriginalSentence) = True Then GetResponse = "When you get around to it, ask the primary question to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis."
    End If
   
    If InStr(1, PrevSent, "Does it spin up on a different power connector?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Defective power supply or connector.  Suggest replacement of the power supply." 
            If No(OriginalSentence) = True Then GetResponse = "Test the hard drive in a different computer. It is most likely at fault."
            If Maybe(OriginalSentence) = True Then GetResponse = "Wow... you are kind of lazy, aren't you? When you get around to trying a different connector, ask the primary question to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis."
    End If

    If InStr(1, PrevSent, "Is the outlet that the computer is plugged into working properly?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Is the little red selector switch set to the proper voltage? 110 volts should be the standard, but some industrial facilities use 220 volts." 
            If No(OriginalSentence) = True Then GetResponse = "Please use a live outlet. Of course a computer won’t power on without power?."
            If Maybe(OriginalSentence) = True Then GetResponse = "Test the outlet you are using with a multi meter. The primary question may be asked again to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis"
    End If

    If InStr(1, PrevSent, "Is the little red selector switch set to the proper voltage? 110 volts should be the standard, but some industrial facilities use 220 volts.", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Ok, unplug the computer and find the two wires leading to the power button. Cut the wires and strip the ends. Plug the computer back in, and touch the two wires together coming from the board. Does the Computer power on now?" 
            If No(OriginalSentence) = True Then GetResponse = "Select the proper voltage, and resume normal operations."
            If Maybe(OriginalSentence) = True Then GetResponse = "Do you want my help or not? Check the selector switch, and ask the primary question to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis."
    End If
   
    If InStr(1, PrevSent, "Ok, unplug the computer and find the two wires leading to the power button. Cut the wires and strip the ends. Plug the computer back in, and touch the two wires together coming from the board. Does the Computer power on now?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Replace the case power button. This should correct the error." 
            If No(OriginalSentence) = True Then GetResponse = "Are the power supply connectors to the motherboard correct?"
            If Maybe(OriginalSentence) = True Then GetResponse = "Do you want my help or not? Bypass the power button, and ask the primary question to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis."
    End If
       
    If InStr(1, PrevSent, "Are the power supply connectors to the motherboard correct?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Can you hear or feel the hard drive spin or start up?" 
            If No(OriginalSentence) = True Then GetResponse = "Remake the mainboard power supply connections"
            If Maybe(OriginalSentence) = True Then GetResponse = "And here I thought you were smart. Ask the primary question to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis."
    End If
   
Rem PLUGIN: FUNCTIONS
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.

'Here we can use the Yes, No, Maybe functions throughout the entire diagnostics script
'to direct our questions and answers more efficiently.

'direct Yes affirmation
Function Yes(OriginalSentence)
Yes = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yes ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " affirmative ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yep ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yup ", 1) Then Yes = True
End Function
'direct No affirmation
Function No(OriginalSentence)
No = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " no ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " nope ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " it is not ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " negative ", 1) Then No = True
End Function
'if the user is not certain about the question then assume they are not certain.
Function Maybe(OriginalSentence)
Maybe = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't know ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't believe so ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't think so ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i'm not sure ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i never checked ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i didn't check ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " maybe ", 1) Then Maybe = True
End Function

This is what I got so far. This covers the most common logic in troubleshooting power supply errors. Unfortunately I need a way to introduce new line of questioning for a different ladder logic. Such as issues with Networking, Video, Audio, and Drive failure. Is it possible?
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 26, 2012, 09:59:40 pm
Hi deitz.

sub what kind of errors?
you can do pretty much anything in HAL except the wscript.sleep which never worked inside HAL for some reason.

Jerry 8)
Title: Re: Q&A
Post by: deitz75 on October 26, 2012, 10:16:41 pm
Just updated my last post. I need a way to introduce new line of questioning for a different ladder logic. Such as issues with Networking, Video, Audio, and Drive failure. Is it possible?
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 27, 2012, 12:11:36 am
of course.
Title: Re: Q&A
Post by: deitz75 on October 27, 2012, 08:50:54 am
Do you recommend any books base on this type of programming?
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 27, 2012, 11:33:13 am
you could always do a google search for keywords network troubleshooting guide.

http://www.google.com/#hl=en&sclient=psy-ab&q=network+troubleshooting+guide&oq=network+troubleshooting&gs_l=hp.1.3.0l4.0.0.2.402.0.0.0.0.0.0.0.0..0.0.les%3B..0.0...1c.6PyDTqJ_Kaw&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.&fp=92da361fb107ce2f&bpcl=35466521&biw=1600&bih=797


there some .pdf file guides that might help.

Jerry
Title: Re: Q&A
Post by: deitz75 on October 27, 2012, 04:05:14 pm
How about a way to introduce new line of questioning for a different ladder logic. Such as issues with Networking, Video, Audio, and Drive failure. Sub questions for different issues?
Title: Re: Q&A
Post by: onthecuttingedge2005 on October 27, 2012, 08:37:31 pm
you mean something like this:

Code: [Select]

Rem Type=Plugin
Rem Name=Network Diagnostics
Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge2005
Rem Host=Assistant
'If you want this plug-in global then change Assistant to All, AIM Bot is not working anymore because of AOL Oscar servers so leave it on Assistant until it is resolved.

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "For use of adding network diagnostic explanations"
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

 Rem PLUGIN: CUSTOMMEM2
    'The preceding comment is actually a plug-in directive for
    'the Ultra Hal host application. It allows for code snippets
    'to be inserted here on-the-fly based on user configuration.


'Diagnostics code by aka onthecuttingedge2005, Idea concept from aka deitz
    'of the Zabaware forum.
    'If a user asked about diagnosing a tech problem we can add or use this
    'chain of code to do so.
   
    If InStr(1, LCase(OriginalSentence), "my network is not working", 1) Or _
       InStr(1, LCase(OriginalSentence), "my internet is not working", 1) Or _
       InStr(1, LCase(OriginalSentence), "my ethernet is not working", 1) Or _
       InStr(1, LCase(OriginalSentence), "my network is not functioning", 1) Then NetDiagnostics = True
   
    'Here we can add accociated responses to the above triggers.
    If NetDiagnostics = True Then
                 GetResponse = "Open a web browser and try to view a website by typing in its IP address, for example http:// 17.254.0.91 (apple.com).  If the page loads then either DNS is indeed down or the machine’s DNS settings are incorrect. tell me whether it worked."
    End If
   
    If PrevSent = "Open a web browser and try to view a website by typing in its IP address, for example http:// 17.254.0.91 (apple.com).  If the page loads then either DNS is indeed down or the machine’s DNS settings are incorrect. tell me whether it worked." Then
             If Yes(OriginalSentence) = True Then GetResponse = "If the page did load but DNS settings are correct then the computer is not auto-switching to another DNS provider.  This can be done manually but moving another DNS IP address to the top of the list in the Network control panel settings." 
             If No(OriginalSentence) = True Then GetResponse = "If the page fails to load by IP address, open up a command prompt and try to ping any machine on the Internet.  If no host responds then either the connection for the computer is not live or again the settings maybe incorrect for the network card."
             If Maybe(OriginalSentence) = True Then GetResponse = "Please verify that your computer can not connect to an I.P address and restart the network diagnostics query."
    End If
   
    If InStr(1, PrevSent, "If the page fails to load by IP address, open up a command prompt and try to ping any machine on the Internet.  If no host responds then either the connection for the computer is not live or again the settings maybe incorrect for the network card. do you suspect that the connection is dead?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "If you suspect that the connection is dead, try to verify this by either checking that computer’s connection on a different functioning computer in the local area or if there is a hub in the room and the questionable computer is plugged into that hub, verify that the other stations connected to that hub are functioning on the network"
            If No(OriginalSentence) = True Then GetResponse = "Then check to see if your ethernet cord is functioning if it is then check to see if any router you are using is functioning correctly."
            If Maybe(OriginalSentence) = True Then GetResponse = "please check to see if the page loads and restart this network diagnostics query."
    End If
   
   
Rem PLUGIN: FUNCTIONS
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.

'Here we can use the Yes, No, Maybe functions throughout the entire diagnostics script
'to direct our questions and answers more efficiently.

'direct Yes affirmation
Function Yes(OriginalSentence)
Yes = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yes ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " affirmative ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yep ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yup ", 1) Then Yes = True
End Function
'direct No affirmation
Function No(OriginalSentence)
No = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " no ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " nope ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " it is not ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " negative ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " it did not load ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " it didn't load ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", "does not work ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", "doesn't work ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " did not work ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " didn't work ", 1) Then No = True
End Function
'if the user is not certain about the question then assume they are not certain.
Function Maybe(OriginalSentence)
Maybe = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't know ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't believe so ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't think so ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i'm not sure ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i never checked ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i didn't check ", 1) Then Maybe = True
End Function

Title: Re: Q&A
Post by: deitz75 on October 27, 2012, 11:52:54 pm
Would it work within the original diagnostics.uhp?
Example, or idea
Code: [Select]
Rem Type=Plugin
Rem Name=Diagnostics
Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge2005
Rem Host=Assistant
'If you want this plug-in global then change Assistant to All, AIM Bot is not working anymore because of AOL Oscar servers so leave it on Assistant until it is resolved.

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "For use of adding diagnostic explanations"
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

 Rem PLUGIN: CUSTOMMEM2
    'The preceding comment is actually a plug-in directive for
    'the Ultra Hal host application. It allows for code snippets
    'to be inserted here on-the-fly based on user configuration.


'Diagnostics code by aka onthecuttingedge2005, Idea concept from aka deitz
    'of the Zabaware forum.
    'If a user asked about diagnosing a tech problem we can add or use this
    'chain of code to do so.
   
    If InStr(1, OriginalSentence, "My computer will not power on", 1) Or _
   InStr(1, OriginalSentence, "My computer won't power on", 1) Or _
   InStr(1, OriginalSentence, "My computer has no power", 1) Or _
   InStr(1, OriginalSentence, "My computer is not turning on", 1) Or _
   InStr(1, OriginalSentence, "My computer isn't turning on", 1) Or _
   InStr(1, OriginalSentence, "My computer has no video", 1) Or _
   InStr(1, OriginalSentence, "I cannot see anything on my computer screen", 1) Or _
   InStr(1, OriginalSentence, "Computer turns on, but there is no video", 1) Or _
   InStr(1, OriginalSentence, "Computer turns on, but there isn't any video", 1) Or _
   InStr(1, OriginalSentence, "Computer turns on, but has no video", 1) Or _
   InStr(1, OriginalSentence, "No video, but the computer turns on", 1) Or _
   InStr(1, OriginalSentence, "No video from the computer", 1) Or _
   InStr(1, OriginalSentence, "No video from my computer", 1) Then Diagnostics = True
   
    'Here we can add accociated responses to the above triggers.
    If Diagnostics = True Then
                 GetResponse = "I can assist you with most hardware issue relating to computers. Please answer yes or no to my questions, and I can determine a prognosis for you. Do you wish to continue?"
    End If
                       
    If InStr(1, PrevSent, "I can assist you with most hardware issue relating to computers. Please answer yes or no to my questions, and I can determine a prognosis for you. Do you wish to continue?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Verify that your computer is plugged in. Does the computer power on at all? Keep in mind beeps, sounds, lights or LED's are an indication of power." 
            If No(OriginalSentence) = True Then GetResponse = "Ok, good luck! If you get stuck? Ask the primary question to restart the diagnostics query."
            If Maybe(OriginalSentence) = True Then GetResponse = "You must need help, if you don't know weither or not you need it. Ask the primary question to restart the diagnostics query."
    End If
   
    If InStr(1, PrevSent, "Verify that your computer is plugged in. Does the computer power on at all? Keep in mind beeps, sounds, lights or LED's are an indication of power.", 1) Then
             If Yes(OriginalSentence) = True Then GetResponse = "Does a boot screen appear on the display?" 
             If No(OriginalSentence) = True Then GetResponse = "Is the outlet that the computer is plugged into working properly?"
             If Maybe(OriginalSentence) = True Then GetResponse = "Please be sure the computer is plugged into the proper outlet. The primary question may be asked again to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis"
    End If
   
    If InStr(1, PrevSent, "Does a boot screen appear on the display?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Does the computer boot up a second or third time?"
            If No(OriginalSentence) = True Then GetResponse = "Is there anything on the screen?"
            If Maybe(OriginalSentence) = True Then GetResponse =  "Please verify the display. The primary question may be asked again to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis"
    End If
           
    If InStr(1, PrevSent, "Does the computer boot up a second or third time?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Possible Power OK signal failure. Unplug the computer for 30 seconds to clear error from power supply. If problem persists replace power supply to correct error." 
            If No(OriginalSentence) = True Then GetResponse = "Does the computer make any Beeping sounds?."
            If Maybe(OriginalSentence) = True Then GetResponse = "Test the outlet you are using with a multi meter. The primary question may be asked again to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis"
    End If

    If InStr(1, PrevSent, "Does the computer make any Beeping sounds?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "Motherboard Failure Currently under construction. I can no longer assist you. Have a nice day!" 
            If No(OriginalSentence) = True Then GetResponse = "Is there any new hardware installed?"
            If Maybe(OriginalSentence) = True Then GetResponse = "Are you hard of hearing? Get someone to assist you, and ask the primary question to restart the diagnostics query. I need definitive answers in order to deliver a proper prognosis."
    End If

    If InStr(1, LCase(OriginalSentence), "my network is not working", 1) Or _
       InStr(1, LCase(OriginalSentence), "my internet is not working", 1) Or _
       InStr(1, LCase(OriginalSentence), "my ethernet is not working", 1) Or _
       InStr(1, LCase(OriginalSentence), "my network is not functioning", 1) Then NetDiagnostics = True
   
    'Here we can add accociated responses to the above triggers.
    If NetDiagnostics = True Then
                 GetResponse = "Open a web browser and try to view a website by typing in its IP address, for example http:// 17.254.0.91 (apple.com).  If the page loads then either DNS is indeed down or the machine’s DNS settings are incorrect. tell me whether it worked."
    End If
   
    If PrevSent = "Open a web browser and try to view a website by typing in its IP address, for example http:// 17.254.0.91 (apple.com).  If the page loads then either DNS is indeed down or the machine’s DNS settings are incorrect. tell me whether it worked." Then
             If Yes(OriginalSentence) = True Then GetResponse = "If the page did load but DNS settings are correct then the computer is not auto-switching to another DNS provider.  This can be done manually but moving another DNS IP address to the top of the list in the Network control panel settings." 
             If No(OriginalSentence) = True Then GetResponse = "If the page fails to load by IP address, open up a command prompt and try to ping any machine on the Internet.  If no host responds then either the connection for the computer is not live or again the settings maybe incorrect for the network card."
             If Maybe(OriginalSentence) = True Then GetResponse = "Please verify that your computer can not connect to an I.P address and restart the network diagnostics query."
    End If
   
    If InStr(1, PrevSent, "If the page fails to load by IP address, open up a command prompt and try to ping any machine on the Internet.  If no host responds then either the connection for the computer is not live or again the settings maybe incorrect for the network card. do you suspect that the connection is dead?", 1) Then
            If Yes(OriginalSentence) = True Then GetResponse = "If you suspect that the connection is dead, try to verify this by either checking that computer’s connection on a different functioning computer in the local area or if there is a hub in the room and the questionable computer is plugged into that hub, verify that the other stations connected to that hub are functioning on the network"
            If No(OriginalSentence) = True Then GetResponse = "Then check to see if your ethernet cord is functioning if it is then check to see if any router you are using is functioning correctly."
            If Maybe(OriginalSentence) = True Then GetResponse = "please check to see if the page loads and restart this network diagnostics query."
    End If
   
   
Rem PLUGIN: FUNCTIONS
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.

'Here we can use the Yes, No, Maybe functions throughout the entire diagnostics script
'to direct our questions and answers more efficiently.

'direct Yes affirmation
Function Yes(OriginalSentence)
Yes = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yes ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " affirmative ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yep ", 1) Then Yes = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " yup ", 1) Then Yes = True
End Function
'direct No affirmation
Function No(OriginalSentence)
No = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " no ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " nope ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " it is not ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " negative ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " it did not load ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " it didn't load ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", "does not work ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", "doesn't work ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " did not work ", 1) Then No = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " didn't work ", 1) Then No = True
End Function
'if the user is not certain about the question then assume they are not certain.
Function Maybe(OriginalSentence)
Maybe = False
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't know ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't believe so ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i don't think so ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i'm not sure ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i never checked ", 1) Then Maybe = True
If InStr(1, " " & Lcase(HalBrain.AlphaNumericalOnly(OriginalSentence)) & " ", " i didn't check ", 1) Then Maybe = True
End Function

Title: Re: Q&A
Post by: onthecuttingedge2005 on October 28, 2012, 12:24:46 am
sure if you wanna mix them, I don't see why not. as long as they don't conflict with another.
Title: Re: Q&A
Post by: deitz75 on October 28, 2012, 12:58:16 am
I have all the the flow charts I'll be using. Most issues like video, power, motherboard, drive, and conflict issues, can be chained pretty easily. You can even loop the GetResponse if the PrevSent is already written. So pretty much if the flow charts suggests skipping to another section, it will, and does not cause any conflicts. I am very happy with this function!

Unfortunately other issue like networking, audio, and laptops do not apply to the original chain, so I would like to have a different set of questions to operate within a different chain, outside of the original, but within the original Diagnostic.uhp

If this doesn't make sense? Just let me know. All I need is a sample or example, and I'm on my way to carpal tunnel syndrome.
Right now I have a little over 350 lines. That is just power supply, video failure, and Motherboard, CPU, and RAM failure. I still have 6 more ares to apply. I'm looking at a possible 3000 lines when I'm done.
Title: Re: Q&A
Post by: deitz75 on October 28, 2012, 05:44:11 pm
Never mind I figured it out
Title: Re: Q&A
Post by: hudson-killian on January 26, 2013, 10:31:07 pm
I think what you are aiming is an "If then else" program. Just wondering what if it doesn't give the exact response?