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.
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?