Zabaware Forums > General Discussion

Old School hal plugins

<< < (3/3)

cyberjedi:
Rem Type=Plugin
Rem Name=Magic 8 Ball plug in v1
Rem Author= SystemShock
Rem Host=Assistant


'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "a magic 8 ball toy ...triggered by ..play magic eight ball"
    lblPlugin(0).Move 120, 120, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
    cmdPlugin(0).Move 800, 1300, 2100, 375
    cmdPlugin(0).Caption = "build one"
    cmdPlugin(0).Visible = True
End Sub



'-------------------------------------------------------------------------------------------------------
Rem PLUGIN: CUSTOMMEM2
    'The comment above tells Ultra Hal Assistant to insert the following code
    'on-the-fly into the main brain code in the section referenced.
'------------------
' Variables Setup
' all my variables have the prefix EIGHTball for this plugin. ;)
'------------------
DiagnosticsrSentence = LCase(UserSentence)
EIGHTballFile    = ""
EIGHTballHalCommands    = ""
Diagnostics   =""

'------------------
' plug in bit...;) useing variables set up^^^^^ there^^^^^
'  Diagnostics
'------------------
If InStr(1, OriginalSentence, "eight ball", 1) >0 Then Diagnostics = "True"
   
'Here we can add accociated responses to the above triggers.
If Diagnostics = "True" Then
   GetResponse = "focus on your question, are you ready to play magic eight ball boss? "
End If
   
If PrevSent = "focus on your question are you ready to play magic eight ball boss?" Then
   If Yes(OriginalSentence) = True Then GetResponse = "OK Boss her we go, and the magic eight ball says?"
   ' ball code goes here mate
   Select Case HalBrain.RandomNum(21)
   Case 1 GetResponse = "It is certain" & vbCrLf
   Case 2 GetResponse = "It is decidedly so" & vbCrLf
   Case 3 GetResponse =  "Without a doubt" & vbCrLf
   Case 4 GetResponse = "Yes ? definitely" & vbCrLf
   Case 5 GetResponse = "You may rely on it" & vbCrLf
   Case 6 GetResponse = "As I see it, yes" & vbCrLf
   Case 7 GetResponse = "Most likely" & vbCrLf
   Case 8 GetResponse = "Outlook good" & vbCrLf
   Case 9 GetResponse = "Yes" & vbCrLf
   Case 10 GetResponse = "Signs point to yes" & vbCrLf
   Case 11 GetResponse = "Reply hazy, try again" & vbCrLf
   Case 12 GetResponse = "Ask again later" & vbCrLf
   Case 13 GetResponse = "Better not tell you now" & vbCrLf
   Case 14 GetResponse = "Cannot predict now" & vbCrLf
   Case 15 GetResponse = "Concentrate and ask again" & vbCrLf
   Case 16 GetResponse = "Don't count on it" & vbCrLf
   Case 17 GetResponse = "My reply is no" & vbCrLf
   Case 18 GetResponse = "My sources say no" & vbCrLf
   Case 19 GetResponse = "Outlook not so good" & vbCrLf
   Case 20 GetResponse = "Very doubtful" & vbCrLf
   Case 21 GetResponse = "oh,**** I dropped it, sorry boss!" & vbCrLf
   End Select
Else
   If No(OriginalSentence) = True Then GetResponse = "OK i put it away then Boss."
   If Maybe(OriginalSentence) = True Then GetResponse = "if that the case I put it away ask me again some time. "
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 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

cyberjedi:
Rem Type=Plugin
Rem Name= forexlive
Rem Author= cyberjedi
Rem Host=All



Rem PLUGIN: PRE-PROCESS
    '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.

HalBrain.ReadOnlyMode = False
'Determines that you are talking about the Forex stock updated hourly
If InStr(1,InputString, "forex",1) > 0 Then
 UltraHal = Getforex(HalCommands)
ElseIf InStr(1,InputString, "forex",1) > 0 Then
 End If

 ' This bad boy is a Forex Scraper with a twist, All the data Scraped is ported through Hals Voice.  It took cyberjedi to pull it off. Enjoy. 
    ' This also Breaks Hals speech limitations on how much he can say. 
 ' Trigger= forex
     'I put this together while listening to this. -->>>https://www.youtube.com/watch?v=aqXW57WM9TA
 
 ' I give myself about a 7.5 on cool ideas here


Rem PLUGIN: FUNCTIONS
Function Getforex(HalCommands)

Const SVSFlagsAsync = 1
Const DontShowWindow = 0
Const WaitUntilFinished = 1
Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Sapi = CreateObject("SAPI.SpVoice")
   For Each Voice In Sapi.GetVoices
       i = i + 1
   Next
For loopvar = 0 to i-1
if loopvar = CInt(confirm_voice) then
Set Sapi.Voice = Sapi.GetVoices.Item(loopvar)
end if
Next
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
Set WshShell = CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
HalMenu.HalCommand "<SPEAK>" & "Reading headlines !" & "</SPEAK>"
For loopvar = 0 to 2
If tempconfirm = loopvar then
if tempconfirm = 1 then
HalMenu.HalCommand "<SPEAK>" & "Currently reading " & confirm & " latest headlines" & "</SPEAK>"
else if tempconfirm = 1 then
HalMenu.HalCommand "<SPEAK>" & "Okay ." & "</SPEAK>"
wscript.quit
else
HalMenu.HalCommand "<SPEAK>" & "Currently reading " & confirm & " latest headlines " & "</SPEAK>"
end if
end if
xmlDoc.async = false
xmlDoc.load("http://www.forexlive.com/feed/technicalanalysis") ' This is where u put you own rss feed .xml
Set nodelist = xmlDoc.selectNodes("rss/channel/item")
i = 3
For Each item In nodelist
Set f1 = item.selectsinglenode("title")
Set f2 = item.selectsinglenode("description")
HalMenu.HalCommand "<SPEAK>" & f1.text & "</SPEAK>"  ' these two lines are the Magic of the plugin
HalMenu.HalCommand "<SPEAK>" & f2.text & "</SPEAK>"  ' these two lines are the Magic of the plugin
i = i + 1
if i = tempconfirm then
wscript.Quit
end if
Next
end if
Next
End Function

cyberjedi:
https://feeds.a.dj.com/rss/RSSOpinion.xml
https://feeds.a.dj.com/rss/RSSWorldNews.xml
https://feeds.a.dj.com/rss/WSJcomUSBusiness.xml
https://feeds.a.dj.com/rss/RSSMarketsMain.xml
https://feeds.a.dj.com/rss/RSSWSJD.xml
https://feeds.a.dj.com/rss/RSSLifestyle.xml

Came from this site. https://www.wsj.com/news/rss-news-and-feeds . This is what Hal is all about.
These will work just fine in the Scrapers above. Look at the Forex.
Updated daily, well as soon as something happens

cyber

lightspeed:
although this is late , seems everything has been going on lately . thanks for taking the time to post these old school plug ins on here. it's appreciated all that you do .  :)

Navigation

[0] Message Index

[*] Previous page

Go to full version