
rem 28310
rem Merlin
rem 3
rem Guest
Dim PippinAgent
Dim LoadRequestUNC
Dim LoadRequestURL
Dim GetShowAnimation
Dim DidMove
Dim IntroStart
'dim currentDate
'dim QOTD
Sub window_onload()
'document.all.divOutputStatus.innerHTML = "Close this Windows when finished."
'document.all.divOutputStatus.innerHTML = "<a href='' onclick='DeltaSeven()'>Start Newscaster</a>"
LoadCharacter

rem window.open "http://www.pippin.us/en/Introduction.asp", "pippinwebsite"

End Sub
Sub InitCommands
PippinAgent.Commands.RemoveAll
PippinAgent.Commands.Add "ACO", "Advanced Character &Options", "Options"
PippinAgent.Commands("ACO").VoiceCaption = "Options"
PippinAgent.Commands("ACO").ConfidenceText = "No he comprendido."
PippinAgent.Commands("ACO").Confidence = -60
'PippinAgent.Commands.Add "Default", "Go to pippin.us &Default Page Form", "Default"
'PippinAgent.Commands("Default").VoiceCaption = "Default"
'PippinAgent.Commands("Default").ConfidenceText = "No he comprendido."
'PippinAgent.Commands("Default").Confidence = -60
'PippinAgent.Commands.Add "Change", "&Change Character", "Change"
'PippinAgent.Commands("Change").VoiceCaption = "Change"
'PippinAgent.Commands("Change").ConfidenceText = "No he comprendido."
'PippinAgent.Commands("Change").Confidence = -60
PippinAgent.Commands.Add "SEP1", "______________________________", ""

PippinAgent.Commands.Add "All", "Read &All News", "All"
PippinAgent.Commands("All").VoiceCaption = "All"
PippinAgent.Commands("All").ConfidenceText = "No he comprendido."
PippinAgent.Commands("All").Confidence = -60

PippinAgent.Commands.Add "News", "Read &News", "Noticias"
PippinAgent.Commands("News").VoiceCaption = "Noticias"
PippinAgent.Commands("News").ConfidenceText = "No he comprendido."
PippinAgent.Commands("News").Confidence = -60
PippinAgent.Commands.Add "Stocks", "Read &Market Quotes", "Market"
PippinAgent.Commands("Stocks").VoiceCaption = "Market"
PippinAgent.Commands("Stocks").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("Stocks").Confidence = -60
'PippinAgent.Commands.Add "CurrencyEx", "Read &Currency Exchange", "Currency"
'PippinAgent.Commands("CurrencyEx").VoiceCaption = "Currency"
'PippinAgent.Commands("CurrencyEx").ConfidenceText = "Didn't understand your request."
'PippinAgent.Commands("CurrencyEx").Confidence = -60
PippinAgent.Commands.Add "Sports", "Read &Sports News", "Sports"
PippinAgent.Commands("Sports").VoiceCaption = "Sports"
PippinAgent.Commands("Sports").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("Sports").Confidence = -60
PippinAgent.Commands.Add "Weather", "Read &Weather", "Weather"
PippinAgent.Commands("Weather").VoiceCaption = "Weather"
PippinAgent.Commands("Weather").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("Weather").Confidence = -60
PippinAgent.Commands.Add "Odd", "Read &Odd News", "Odd"
PippinAgent.Commands("Odd").VoiceCaption = "Odd"
PippinAgent.Commands("Odd").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("Odd").Confidence = -60
'PippinAgent.Commands.Add "Website", "Read &Website Information", "Website"
'PippinAgent.Commands("Website").VoiceCaption = "Website"
'PippinAgent.Commands("Website").ConfidenceText = "Didn't understand your request."
'PippinAgent.Commands("Website").Confidence = -60
'PippinAgent.Commands.Add "Read", "&Read the Current Page", "Read"
'PippinAgent.Commands("Read").VoiceCaption = "Read"
'PippinAgent.Commands("Read").ConfidenceText = "Didn't understand your request."
'PippinAgent.Commands("Read").Confidence = -60
PippinAgent.Commands.Add "SEP2", "______________________________", ""
'PippinAgent.Commands.Add "Chat", "&Chat with Merlin", "Chat"
'PippinAgent.Commands("Chat").VoiceCaption = "Chat"
'PippinAgent.Commands("Chat").ConfidenceText = "Didn't understand your request."
'PippinAgent.Commands("Chat").Confidence = -60
PippinAgent.Commands.Add "Hello", "Say &Hello", "Hello"
PippinAgent.Commands("Hello").VoiceCaption = "Hello"
PippinAgent.Commands("Hello").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("Hello").Confidence = -60
PippinAgent.Commands.Add "Sing", "&Sing a song", "Sing"
PippinAgent.Commands("Sing").VoiceCaption = "Canta"
PippinAgent.Commands("Sing").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("Sing").Confidence = -60
PippinAgent.Commands.Add "Joke", "Tell a &Joke", "Joke"
PippinAgent.Commands("Joke").VoiceCaption = "Joke"
PippinAgent.Commands("Joke").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("Joke").Confidence = -60
PippinAgent.Commands.Add "QOTD", "Read &Quote of the day", "Quote"
PippinAgent.Commands("QOTD").VoiceCaption = "Quote"
PippinAgent.Commands("QOTD").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("QOTD").Confidence = -60
'PippinAgent.Commands.Add "SEP3", "______________________________", ""
'PippinAgent.Commands.Add "Latest", "&Retrieve latest news", "Retrieve"
'PippinAgent.Commands("Latest").VoiceCaption = "Retrieve"
'PippinAgent.Commands("Latest").ConfidenceText = "Didn't understand your request."
'PippinAgent.Commands("Latest").Confidence = -60
PippinAgent.Commands.Add "SEP4", "______________________________", ""
PippinAgent.Commands.Add "Download", "&Download this script to your website", "Download"
PippinAgent.Commands("Download").VoiceCaption = "Download"
PippinAgent.Commands("Download").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("Download").Confidence = -60
PippinAgent.Commands.Add "AgentHelp", "&Help for the Agent", "Help"
PippinAgent.Commands("AgentHelp").VoiceCaption = "Help"
PippinAgent.Commands("AgentHelp").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("AgentHelp").Confidence = -60
PippinAgent.Commands.Add "AgentDL", "Microsoft &Agent Home Page", "Agent"
PippinAgent.Commands("AgentDL").VoiceCaption = "Agent"
PippinAgent.Commands("AgentDL").ConfidenceText = "Didn't understand your request."
PippinAgent.Commands("AgentDL").Confidence = -60

End Sub
Sub AgentControl_Command (ByVal UserInput)
HeardWhat = UserInput.Voice
If (UserInput.Confidence <= -60) then 
BadAcceptanceRec
Exit Sub
ElseIf (UserInput.Alt1Name="") and (UserInput.Alt2Name<>"") and (UserInput.Name<>UserInput.Alt2Name) And (Abs(UserInput.Confidence-UserInput.Alt2Confidence) < 10) then
msgbox "failed first alt"
BadAcceptanceRec
Exit Sub
Else
HeardSomething = True
ChosenBySpeech = True
NoInput = 0
RecogError = 0
CommandSelected = UserInput.Name
Select Case CommandSelected
Case "All"
'window.open "http://www.pippin.us/en/DeltaSeven.asp", "pippinwebsite"
DeltaSeven()
Exit Sub
Case "ACO"
AgentControl.PropertySheet.Visible = True
Exit Sub
Case "Change"
Change()
Exit Sub
Case "Default"
Default()
Exit Sub
Case "News"
PippinAgent.SoundEffectsOn =True
News()
Exit Sub
Case "Sports"
PippinAgent.SoundEffectsOn =True
Sports()
Exit Sub
Case "Weather"
PippinAgent.SoundEffectsOn =True
Weather()
Exit Sub
Case "Stocks"
PippinAgent.SoundEffectsOn =True
Stocks()
Exit Sub
'Case "CurrencyEx"
'PippinAgent.SoundEffectsOn =True
'window.open "http://www.pippin.us/en/Currency.asp", "pippinwebsite"
'CurrencyEx()
'Exit Sub
Case "Odd"
PippinAgent.SoundEffectsOn =True
Odd()
Exit Sub
Case "Website"
PippinAgent.SoundEffectsOn =True
Information()
Exit Sub
Case "Alerts"
NoAlerts()
Exit Sub
Case "Latest"
GetLatest()
Exit Sub
Case "DoAlerts"
DoAlerts()
Exit Sub
Case "Sing"
Sing()
Exit Sub
Case "Joke"
Joke()
Exit Sub
Case "Read"
window.top.main.ReadThisPage()
Exit Sub
Case "QOTD"
QOTD()
Exit Sub
Case "SPSB"
window.open "http://www.pippin.us/en/menu2.asp?BankID=99", "Menu"
Exit Sub
Case "Download"

window.open "http://www.pippin.us/en/UseOurAgentScript.asp", "_top"
Exit Sub
Case "Hello"

Hello()
Exit Sub
Case "AgentDL"

PippinAgent.Speak "You can avoid downloading the character each time you visit this web site by permanently installing it on your system through the Microsoft Agent download page. | If you can see me but can't hear my voice, then Windows XP users may also need to install the SAPI 4.0 runtime."
window.open "http://www.microsoft.com/msagent/", "AgentDL"
Exit Sub
Case "AgentHelp"

PippinAgent.Speak "This Web site will help you identify and solve problems that may be encountered with Microsoft Agent"
window.open "http://www.microsoft.com/msagent/support/", "AgentHelp"
Exit Sub
End Select
End If
End Sub
Sub BadAcceptanceRec 
TurnOffListeningMode
Select Case RecogError
Case 0 
RecogError = 1

Set SpeechInputRequest =PippinAgent.Speak ("¿Cómo?|¿Qué?|¿Qué pasa?")
Case 1
RecogError = 2

Set SpeechInputRequest =PippinAgent.Speak ("¿Puedes repetir?|Repite, por favor|¿Una vez más?")
Case 2
RecogError = 3

If OrderType = 0 Then
Set SpeechInputRequest =PippinAgent.Speak ("Di qué te gustaría hacer.")
Else
Set SpeechInputRequest =PippinAgent.Speak ("Di qué te gustaría hacer.")
End If
Case 3

Set SpeechInputRequest =PippinAgent.Speak ("Haz clic en las instrucciones si necesitas ayuda.")
End Select
End Sub
Sub TurnOnListeningMode
If AgentControl.SpeechInput.Enabled = True Then
'-- Check the character's listening state
CheckListeningState
If ListenOK = True Then

PippinAgent.Listen True
Else 
Exit Sub
End If
End If
End Sub
Sub TurnOffListeningMode
If AgentControl.SpeechInput.Enabled = True Then
If PippinAgent.Visible Then
If IsListening = True Then
PippinAgent.Listen False
End If
Else 
Window.Status = "El agente está escondido."
End If
Else '-- If speech input is not enabled, just exit
Exit Sub
End If
End Sub
Sub CheckListeningState
Select Case PippinAgent.SRStatus
Case 0 '-- Listening state is available
ListenOK = True
Exit Sub
Case 1 '-- Couldn't find an audio input device

PippinAgent.Speak "No puede usarse voz en tu ordenador."
ListenOK = False
Case 2 '-- Client/character is not input active
If NotPippinAgent.Visible Then
Window.Status = "El agente está escondido."
End If
ListenOK = False
Case 3 '-- The audio device is busy or unavailable

PippinAgent.Speak "Parece que otro programa está usando tu tarjeta de sonido."

PippinAgent.Speak "Usa el ratón para seleccionar."
ListenOK = False
Case 4 '-- Couldn't find speech engine support

If PippinAgent.SRModeID = "" Then
PippinAgent.Speak "I checked your computer and you don't currently have a compatible speech recognition engine installed."
End If
PippinAgent.Speak "So you won't be able to use speech input with this demo."
ListenOK = False
Case 5 '-- Speech input has been disabled

PippinAgent.Speak "I noticed that you currently have speech input disabled."
PippinAgent.Speak "So you won't be able to speak to me"

PippinAgent.Speak "If you want to re-enable speech input, right-click on me and then choose 'Advanced Character Options.'"
ListenOK = False
Case 6 '-- Unknown audio device error

PippinAgent.Speak "There is some problem with your sound card, but I can't determine what it is."
ListenOK = False
End Select
End Sub
Sub AgentControl_ListenStart (ByVal CharacterID)
IsListening = True
Window.Status = "Merlin's listening"
End Sub
Sub AgentControl_ListenComplete (ByVal CharacterID, ByVal Cause)
Window.Status = "Merlin's not listening"
If HeardSomething = False Then
If Cause = 2 Then 
If NoInput = 0 Then
NoInput = 1 

Set SpeechInputRequest =PippinAgent.Speak ("I'm sorry, I didn't hear your response. Please repeat your request.")
ElseIf NoInput = 1 Then
NoInput = 2
If OrderType = 0 Then
TurnOffListeningMode

Set SpeechInputRequest =PippinAgent.Speak ("Please say what you'd like to do.")
Else
TurnOffListeningMode
Set SpeechInputRequest =PippinAgent.Speak ("Please say what you'd like to do.")
End If
Else 

PippinAgent.Speak "It sounds like you need a little more time to decide."
Set StatusRequest =PippinAgent.Speak ("Just press the " + AgentControl.SpeechInput.HotKey + " key when you are ready to continue.")
End If
ElseIf Cause = 3 Then
If OrderType = 0 Then
BadAcceptanceRec
Else
Set StatusRequest =PippinAgent.Speak ("When you want to continue, press and hold the " + AgentControl.SpeechInput.HotKey + " key again.|When you are ready to continue with your order, press and hold the " + AgentControl.SpeechInput.Hotkey + " key.")
End If
End If
End If
End Sub
Sub AgentControl_RequestComplete(ByVal Request)
If Request = LoadRequestURL Then
If Request.Status = 1 Then
Msgbox "Merlin could not be loaded. Choose another character."
Exit Sub
ElseIf Request.Status = 0 Then
Set PippinAgent = AgentControl.Characters("Merlin")
Set GetShowAnimation =PippinAgent.Get ("state", "showing, speaking")
PippinAgent.Get "animation", "Blink, Greet, ReadContinued, Wave, Surprised, Pleased, Explain, RestPose, Think, Read, GestureLeft,Idle1_1,Idle2_2,Idle1_3,Idle2_4, Announce, Uncertain", False
End If
ElseIf Request = GetShowAnimation Then
If Request.Status = 1 Then
Msgbox "Request to load the Show animation failed.  Choose another character."
Exit Sub
ElseIf Request.Status = 0 Then
Play()
End If
End If
End Sub
Sub LoadCharacter
On Error Resume Next
AgentControl.Connected = TRUE
Set LoadRequestUNC = AgentControl.Characters.Load ("Merlin", "Merlin.acs")
If LoadRequestUNC.Status <> 0 Then
Set LoadRequestURL = AgentControl.Characters.Load ("Merlin", "http://www.microsoft.com/msagent/chars/Merlin/Merlin.acf") 
Else 
Set PippinAgent = AgentControl.Characters("Merlin")
Play()

End If
End Sub
Sub AgentControl_Click (ByVal CharacterID, ByVal Button, ByVal Shift, ByVal X, ByVal Y)
PippinAgent.Stop
PippinAgent.Balloon.Style = &H21C000F

PippinAgent.Speak "OK|Take it easy!|Hey, watch it with that pointer!|¿Qué pasa?|Me haces cosquillas!|\pit=170\Je je je!"

End Sub
Sub AgentControl_DragComplete (ByVal CharacterID, ByVal Button, ByVal Shift, ByVal X, ByVal Y)
PippinAgent.Stop
PippinAgent.Balloon.Style = &H21C000F

PippinAgent.Speak "Well, \emp\this gives me a new perspective!|OK!|What's Up?|I like it much better over here.|Now why did you move me?|Hey, be careful!|Take it easy!|Now, I feel a little dizzy."

End Sub
Sub NoAlerts()
window.open "http://www.pippin.us/en/menu2.asp?Agent=2&DoAlerts=2", "Menu"
End Sub
Sub DoAlerts()
window.open "http://www.pippin.us/en/menu2.asp?Agent=3&DoAlerts=3", "Menu"
End Sub
Sub GetLatest()
window.open "http://www.pippin.us/en/menu2.asp?Agent=1&DoAlerts=2", "Menu"
End Sub
Sub Change()
window.open "http://www.pippin.us/Choose-Agent.asp?page=1&gallery=1", "pippinwebsite"
End Sub
Sub Default()
window.open "http://www.pippin.us/Default.asp", "pippinwebsite"
End Sub
Sub HideAgent()
PippinAgent.Hide
End Sub
Sub Sing()
PippinAgent.Balloon.Style = &H21C000F
PippinAgent.Stop
'choose a random response
Randomize
randomreply = Int((2 - 1 + 1) * Rnd + 1)
Select Case randomreply
Case 1
PippinAgent.Speak "\chr="+chr(34)+"monotone"+chr(34)+"\\spd=60\\pit=120\Dai \pit=100\zee, \pit=80\Dai \pit=60\zee"
PippinAgent.Speak "\chr="+chr(34)+"monotone"+chr(34)+"\\spd=120\\pit=68\Give \pit=74\me \pit=80\your \pit=68\an, \pit=80\ser \pit=60\true."
PippinAgent.Speak "\chr="+chr(34)+"monotone"+chr(34)+"\\spd=50\\pit=92\I'm \pit=120\half\pit=100\cray \pit=80\zee,"
PippinAgent.Speak "\chr="+chr(34)+"monotone"+chr(34)+"\\spd=115\\pit=68\All \pit=74\for \pit=80\the \pit=80\love \pit=100\of \pit=92\you."
PippinAgent.Speak "\chr="+chr(34)+"monotone"+chr(34)+"\\spd=80\\pit=100\It \pit=112\won't \pit=110\be \pit=92\a \pit=120\sty-\pit=100\lish \pit=92\mare\pit=80\rege."
PippinAgent.Speak "\chr="+chr(34)+"monotone"+chr(34)+"\\spd=100\\pit=92\I \pit=100\can't \pit=80\a \pit=68\ford, \pit=80\a \pit=68\care- \pit=60\ridge."
PippinAgent.Speak "\chr="+chr(34)+"monotone"+chr(34)+"\\spd=100\\pit=60\But \pit=80\you'll \pit=100\look \pit=92\sweet,"
PippinAgent.Speak "\chr="+chr(34)+"monotone"+chr(34)+"\\spd=90\\pit=60\Up \pit=80\on \pit=100\the \pit=92\seat."
PippinAgent.Speak "\chr="+chr(34)+"monotone"+chr(34)+"\\spd=100\\pit=100\Of \pit=112\a \pit=120\by \pit=100\sic \pit=80\cull \pit=92\built, \pit=60\for \pit=80\two."

PippinAgent.Speak "Thank you, thank you, thank you very much."
Case 2
singingvoice = "\chr="+chr(34)+"monotone"+chr(34)
PippinAgent.Speak singingvoice+"\\spd=130\\pit=65\Hap-\pit=65\p \pit=73\birth-\pit=65\day \spd=55\\pit=87\to \pit=82\you."
PippinAgent.Speak singingvoice+"\\spd=130\\pit=65\Hap-\pit=65\p \pit=73\birth-\pit=65\day \spd=55\\pit=98\to \pit=87\you."
PippinAgent.Speak singingvoice+"\\spd=130\\pit=65\Hap-\pit=65\p \pit=131\birth-\pit=110\day, \spd=50\\pit=87\from \pit=87\tha\pit=73\Pippins."
PippinAgent.Speak singingvoice+"\\spd=130\\pit=117\Hap-\pit=117\p \pit=110\birth-\pit=87\day \spd=55\\pit=98\to \pit=87\you."

End Select
End Sub
Sub Joke()
PippinAgent.Balloon.Style = &H21C000F
PippinAgent.Stop
Randomize
randomreply = Int((5 - 1 + 1) * Rnd + 1)
PippinAgent.Speak "You'll \emp\really like this one.|You'll \emp\love this one.|OK, here's a favorite of mine.|Here's a little humor for you.|OK, here's a good one.|You're gonna love this one!"
Select Case randomreply
Case 1

PippinAgent.Speak "Have you heard about the PBS virus?"

PippinAgent.Speak "Your computer stops in the middle of your program and requests more money."
Case 2

PippinAgent.Speak "Did you hear the one about the guy who poured Cheerios into his PC?"

PippinAgent.Speak "He wanted a cereal interface! Ha ha ha!"
Case 3

PippinAgent.Speak "You know where a bird goes when it loses its tail?"

PippinAgent.Speak "Why a 'retail' store, of course!"
Case 4

PippinAgent.Speak "Know why I always avoid beta software?"

PippinAgent.Speak "Because 'beta' is Greek for 'still doesn't work'."
Case 5

PippinAgent.Speak "If debugging is the process of removing bugs..."

PippinAgent.Speak "Is \emp\programming the process of putting in bugs?"
End Select

PippinAgent.Speak "Oh, I just love \emp\that one.|I'm just a barrel of laffs! Ha! Ha!|I knocked them dead in Vegas with that one.|Sometimes I really crack myself up!|Ha! Ha! I got a million of them!|This joke was generated with 100% recycled electrons."

End Sub
Sub QOTD()
PippinAgent.Balloon.Style = &H21C000F
PippinAgent.Speak "Here's the quote of the day"

PippinAgent.Speak "Blessing on him that first invented sleep! Don Quixote"

End Sub
Sub Play()
'AgentControl.Connected = True
'AgentControl.PropertySheet.Visible = True
'AgentControl.CommandsWindow.Visible = True
PippinAgent.Balloon.Style = &H21C000F

PippinAgent.Balloon.FontName = "Arial"
PippinAgent.Balloon.FontSize = 10

PippinAgent.LanguageID = &H0409
If PippinAgent.SRModeID = "" Then
REM Msgbox "Either you have disabled speech input," + Chr(13)+ "- you don't have a compatible sound card," + Chr(13) + "- or you haven't installed a compatible speech recognition engine ." + Chr(13) + "(You can download it from the Microsoft Agent Downloads page for free.)"
End If
If PippinAgent.TTSModeId = "" Then
REM Msgbox "Either you have disabled speech output," + Chr(13) + "- you don't have a compatible sound card," + Chr(13) + "- or you haven't installed a compatible text-to-speech engine." + Chr(13) + "(You can download it from the Microsoft Agent Downloads page for free.)"
End If
PippinAgent.TTSModeId = "{CA141FD0-AC7F-11D1-97A3-006008273002}"
PippinAgent.Commands.Caption = "Pippin: Merlin"
PippinAgent.Commands.Voice = "Pippin: Merlin"
InitCommands

PippinAgent.MoveTo (screen.width/2),(screen.height/2)

PippinAgent.Show
if IntroStart <> "1" then
IntroStart = "1"
On Error Resume Next

'I removed this PippinAgent.Show

REM FINDIT
PippinAgent.Show

PippinAgent.Speak "Good " & GetTimeOfDay() & " Guest! | Good " & GetTimeOfDay() & " Guest! | Hello Guest! | Hello Guest!"

PippinAgent.Speak "I'm Merlin, a Microsoft Agent character programmed to be your virtual newscaster. | I'm Merlin, your virtual newscaster. | My name is Merlin.  Your virtual newscaster. | I'm a Microsoft Agent compatible character programmed as your virtual newscaster."

PippinAgent.Speak "Today is Tuesday, December 23, 2008"


Randomize
randomreply = Int((4 - 1 + 1) * Rnd + 1)
Select Case randomreply
Case 1

'PippinAgent.Speak "There are no events scheduled in today's calendar"

Case 2

PippinAgent.Speak "Unofficially, today is 'Emperor's Birthday (Tennou-tanjyou-bi)(JP) and Roots Day'."
Case 3

'PippinAgent.Speak "You can access my on-demand virtual newscast by clicking on 'Delta Seven' in the Information Category."
Case 4

'PippinAgent.Speak "The last update to this web site was the blog entry titled 'Microsoft Agent PowerToy 2008' on Tuesday, January 01, 2008."
End Select

PippinAgent.MoveTo (screen.width/2), (screen.height/2)

PippinAgent.Speak "Right-click on me to access my menu and choose your next activity this " & lcase(GetTimeOfDay()) & "."

end if





End Sub
Sub DeltaSeven()
DidMove = "0"
PippinAgent.Stop
PippinAgent.Show

PippinAgent.MoveTo (screen.width/2), (screen.height/2)

PippinAgent.Speak "Now, give me seven minutes and I'll give you the current national and world news, weather, market quotes and sports highlights!"
News()
Stocks()
'CurrencyEx()
Sports()
Weather()
Odd()

PippinAgent.Speak "That concludes your virtual newscast for this session.  Please return later for the latest changes in news and weather."

End Sub
Sub Hello()
Randomize
randomreply = Int((10 - 1 + 1) * Rnd + 1)
Select Case randomreply
Case 1
PippinAgent.Speak "For our Aklanon speaking visitors from the Philippines, 'Kumasta!'"
Case 2
PippinAgent.Speak "For our Albanian speaking visitors, 'Tungjatjeta!'"
Case 3
PippinAgent.Speak "For our Altai speaking visitors from Russia, 'Yakshi ba?'"
Case 4
PippinAgent.Speak "For our visitors from the Apache nation, 'Ya'atay!'"
Case 5
PippinAgent.Speak "For our Arabic speaking visitors, 'As-salaam-aleykum!'"
Case 6
PippinAgent.Speak "For our Arikara speaking visitors from the United States, 'Tashgasha!'"
Case 7
PippinAgent.Speak "For our Aymara speaking visitors from Bolivia, Peru and Chile, 'Kamisaraki?'"
Case 8
PippinAgent.Speak "For our Balinese speaking visitors, 'Om swastyastu!'"
Case 9
PippinAgent.Speak "For our Balti speaking visitors from India and Pakistan, 'Yang chi halyo?'"
Case 10
PippinAgent.Speak "For our Bellorussian speaking visitors, 'Pryvitani!'"
end Select
Randomize
randomreply = Int((11 - 1 + 1) * Rnd + 1)
Select Case randomreply
Case 1
PippinAgent.Speak "For our Bicol speaking visitors from the Philippines, 'Kumustas!'"
Case 2
PippinAgent.Speak "For our visitors from the Blackfoot nation in Alberta Canada and Montana, 'Oki!'"
Case 3
PippinAgent.Speak "For our Portuguese speaking visitors, 'Oi!'"
Case 4
PippinAgent.Speak "For our Russian speaking visitors, '" & GetRussianTimeOfDay() & "!'"
Case 5
PippinAgent.Speak "For our Catalan speaking visitors from Andorra, Spain and France, 'Hola!'"
Case 6
PippinAgent.Speak "For our visitors from the Cherokee nation in North Carolina and Oklahoma, 'O-si-yo!'"
Case 7
PippinAgent.Speak "For our visitors from the Cheyenne nation in Montana and Oklahoma, 'Haaah, epivah-wuh-ennah!'"
Case 8
PippinAgent.Speak "For our visitors from the Choctaw nation in Oklahoma, 'Halito!'"
Case 9
PippinAgent.Speak "For our visitors from the Comanche nation in Oklahoma, 'Maruawe, haitsi!'"
Case 10
PippinAgent.Speak "For our French speaking visitors, 'Salu!'"
Case 11
PippinAgent.Speak "For our Swahili speaking visitors, 'Jambo!'"
end Select
Randomize
randomreply = Int((10 - 1 + 1) * Rnd + 1)
Select Case randomreply
Case 1
PippinAgent.Speak "For our German speaking visitors, 'Guten Tag!'"
Case 2
PippinAgent.Speak "For our Hawaiian speaking visitors, 'Aloha!'"
Case 3
PippinAgent.Speak "For our Hebrew speaking visitors, 'Shalom!'"
Case 4
PippinAgent.Speak "For our Hindi speaking visitors from India and East Asia, 'Namaskaar!'"
Case 5
PippinAgent.Speak "For our Indonesian speaking visitors, 'Apa kabar!'"
Case 6
PippinAgent.Speak "For our Japanese speaking visitors, '" & GetJapaneseTimeOfDay() & "!'"
Case 7
PippinAgent.Speak "For our Khmer speaking visitors from Cambodia, 'Sok sabai jie te!'"
Case 8
PippinAgent.Speak "For our Korean speaking visitors, 'Ahn nyeong ha se yo!'"
Case 9
PippinAgent.Speak "For our Zulu speaking visitors from South Africa, 'Sawubona!'"
Case 10
PippinAgent.Speak "For our Miami Indian visitors, 'Aya Aya!'"
end Select
Randomize
randomreply = Int((10 - 1 + 1) * Rnd + 1)
Select Case randomreply
Case 1
PippinAgent.Speak "and for our Chinese Mandarin speaking visitors, 'Ni Hao!'"
Case 2
PippinAgent.Speak "and for our visitors from the Navajo nation in the Southwestern United States, 'Ya’at’ eeh!'"
Case 3
PippinAgent.Speak "and for our Polish speaking visitors, 'Dzien dobry!'"
Case 4
PippinAgent.Speak "and for our Tibetan speaking visitors, 'Kam sangbo dugay!'"
Case 5
PippinAgent.Speak "and for our Russian speaking visitors, 'Zdravstvuite!'"
Case 6
PippinAgent.Speak "and for our Sanskrit speaking visitors, 'Namo namah!'"
Case 7
PippinAgent.Speak "and for our Yiddish speaking visitors, 'Sholem aleykhem!'"
Case 8
PippinAgent.Speak "and for our Siswati speaking visitors, 'Sawubona!'"
Case 9
PippinAgent.Speak "and for our Spanish speaking visitors, '" & GetSpanishTimeOfDay() & "'"
Case 10
PippinAgent.Speak "and for our Swedish speaking visitors, 'Hej!'"
end Select
End Sub
Sub PIntro()
PippinAgent.Stop
DidMove = "0"
Play()
End Sub
Sub SpeakTitle(thistitle)
'AgentControl.Connected = True
'AgentControl.PropertySheet.Visible = True
'AgentControl.CommandsWindow.Visible = True
PippinAgent.Balloon.Style = &H21C000F

PippinAgent.Balloon.FontName = "Arial"
PippinAgent.Balloon.FontSize = 10

PippinAgent.LanguageID = &H0409
If PippinAgent.SRModeID = "" Then
REM Msgbox "Either you have disabled speech input," + Chr(13)+ "- you don't have a compatible sound card," + Chr(13) + "- or you haven't installed a compatible speech recognition engine ." + Chr(13) + "(You can download it from the Microsoft Agent Downloads page for free.)"
End If
If PippinAgent.TTSModeId = "" Then
REM Msgbox "Either you have disabled speech output," + Chr(13) + "- you don't have a compatible sound card," + Chr(13) + "- or you haven't installed a compatible text-to-speech engine." + Chr(13) + "(You can download it from the Microsoft Agent Downloads page for free.)"
End If
PippinAgent.TTSModeId = "{CA141FD0-AC7F-11D1-97A3-006008273002}"
PippinAgent.Commands.Caption = "Pippin: Merlin"
PippinAgent.Commands.Voice = "Pippin: Merlin"
InitCommands
PippinAgent.Stop

If DidMove = "" or DidMove = "0" then
Randomize
randommove = Int((4 - 1 + 1) * Rnd + 1)
Select Case randommove
Case 1

PippinAgent.MoveTo (screen.width/2), (screen.height/2)

RandomLeft = "1"
RandomRight = "0"
DidMove = "1"
Case 2

PippinAgent.MoveTo ((screen.width/2)-435), (screen.height-165)

RandomLeft = "1"
RandomRight = "0"
DidMove = "1"
Case 3

PippinAgent.MoveTo ((screen.width/2)+293), (screen.height/3)

RandomLeft = "0"
RandomRight = "1"
DidMove = "1"
Case 4

PippinAgent.MoveTo ((screen.width/2)+293), (screen.height-165)

RandomLeft = "0"
RandomRight = "1"
DidMove = "1"
Case 5

End Select
DidMove = "1"
else
Randomize
randommove = Int((4 - 1 + 1) * Rnd + 1)
Select Case randommove
Case 1

PippinAgent.MoveTo (screen.width/2), (screen.height/2)

RandomLeft = "1"
RandomRight = "0"
DidMove = "1"
Case 2

PippinAgent.MoveTo ((screen.width/2)-435), (screen.height-165)

RandomLeft = "1"
RandomRight = "0"
DidMove = "1"
Case 3

PippinAgent.MoveTo ((screen.width/2)+293), (screen.height/3)

RandomLeft = "0"
RandomRight = "1"
DidMove = "1"
Case 4

PippinAgent.MoveTo ((screen.width/2)+293), (screen.height-165)

RandomLeft = "0"
RandomRight = "1"
DidMove = "1"
Case 5

PippinAgent.MoveTo ((screen.width/2)-256),(screen.height-165)

RandomLeft = "1"
RandomRight = "0"
DidMove = "1"
Case 6
Case 7
End Select
PippinAgent.Show
PippinAgent.Balloon.Style = &H21C000F
'choose a random response
randomreply = Int((3 - 1 + 1) * Rnd + 1)
Select Case randomreply
Case 1

Case 2

Case 3

End Select
end if
PippinAgent.Show
PippinAgent.Speak thistitle
PippinAgent.Play "RestPose"
End Sub
Sub OurIntroduction()
answer = msgbox ("Would you like the Microsoft Agent to read the current news and weather?",4,"Bruce & Vira")
if answer = 6 then 
PippinAgent.Stop
Play()
end if
End Sub
Sub ReadThis(thispage)
PippinAgent.Show
PippinAgent.Stop
PippinAgent.Balloon.Style = &H21C0000
'choose a random response
randomreply = Int((2 - 1 + 1) * Rnd + 1)
Select Case randomreply
Case 1

Case 2

Case 3

End Select
'PippinAgent.Speak "Now, I will read this page. "
PippinAgent.Speak thispage
'PippinAgent.Balloon.Style = &H21C000F
End Sub
Sub RussianThis(thispage)
PippinAgent.LanguageID = &H0419
PippinAgent.Show
PippinAgent.Stop
PippinAgent.Balloon.Style = &H21C0000
'choose a random response
Randomize
randommove = Int((7 - 1 + 1) * Rnd + 1)
Select Case randommove
Case 1
PippinAgent.MoveTo (screen.width/16), (screen.height/3)
Case 2
PippinAgent.MoveTo (screen.width/16), (screen.height-165)
Case 3
PippinAgent.MoveTo (screen.width-((screen.width/16)*3)), (screen.height/3)
Case 4
PippinAgent.MoveTo (screen.width-((screen.width/16)*3)), (screen.height-165)
Case 5
REM Don't move
Case 6
REM Don't move
Case 7
REM Don't move
End Select
Select Case randomreply
Case 1

Case 2

Case 3

End Select
'PippinAgent.Speak "Now, I will read this page. "
PippinAgent.Speak thispage
'PippinAgent.Balloon.Style = &H21C000F
PippinAgent.LanguageID = &H0409
End Sub
Sub ReadBot(thispage)
PippinAgent.Show
PippinAgent.MoveTo (screen.width/16), (screen.height/3)
PippinAgent.Stop
PippinAgent.Balloon.Style = &H21C0000
PippinAgent.Speak thispage
End Sub
Sub Weather()
PippinAgent.Speak "and now Guest, here is your personal weather report"
PippinAgent.Balloon.Style = &H21C000F

PippinAgent.Speak "Currently in Fort Bragg, North Carolina  the temperature is \Map="+chr(34)+"23 degrees fahrenheit"+chr(34)+"="+chr(34)+"23"+chr(176)+"F"+chr(34)+"\."

PippinAgent.Speak "The barometric pressure is 30.63\Map="+chr(34)+" inches"+chr(34)+"="+chr(34)+chr(34)+chr(34)+"\ and rising."

PippinAgent.Speak "The wind is calm."

PippinAgent.Speak "The humidity is 76\Map="+chr(34)+" percent"+chr(34)+"="+chr(34)+"%"+chr(34)+"\. The dew point is \Map="+chr(34)+"17 degrees fahrenheit"+chr(34)+"="+chr(34)+"17"+chr(176)+"F"+chr(34)+"\."

PippinAgent.Speak "Outdoors it feels like \Map="+chr(34)+"23 degrees fahrenheit"+chr(34)+"="+chr(34)+"23"+chr(176)+"F"+chr(34)+"\"

PippinAgent.Speak "It's dangerous to be outdoors. You shouldn't be outdoors for more than 30 minutes at a time. It's very cold! hypothermia and frostbite is possible. Staying indoors is best but if you must go outdoors, dress warmly and stay dry."

PippinAgent.Speak "The forecast is for mostly cloudy skies."

PippinAgent.Speak "Visibility is 10.0 miles."

PippinAgent.Speak "Today, the sunrise is at 7:23 AM and sunset is at 5:10 PM."

PippinAgent.Speak "The moon is 25 days old and in the waning crescent phase."

End Sub
Sub News()
PippinAgent.Balloon.Style = &H21C000F

PippinAgent.Speak "Now, here's the latest top five news stories...| Next, the top five new stories | From the news desk | Here's the top news items | Now, here's the latest national and world news ..."

PippinAgent.Speak "U.S. sells record debt, China rate cut disappoints"

PippinAgent.Speak " The United States sold a record amount of debt to help fund its efforts to contain the financial crisis and Beijing's fifth rate cut since September failed to boost Chinese shares, as gloomy economic and corporate reports showed the world economy was stuck in a deep rut.    "

PippinAgent.Speak "In other news ... | In other national and world news | additionally | also"
PippinAgent.Speak "Housing crisis worsens as economy weakens"

PippinAgent.Speak " The desperate straits of many U.S. homeowners showed in new data released on Monday, suggesting efforts to help them are having limited success.    "

PippinAgent.Speak "Manufacturers cut jobs, pay amid downturn"

PippinAgent.Speak " Several U.S. manufacturers added their names to the growing list of companies making job or benefit cuts to weather the global financial crisis.    "

PippinAgent.Speak "Obama team primed to push climate change agenda"

PippinAgent.Speak " President-elect Barack Obama's new 'green dream team' is committed to battling climate change and ready to push for big policy reforms, in stark contrast with the Bush administration, environmental advocates said on Monday.    "

PippinAgent.Speak "and also...|and also in national and world news | lastly in national and world news ...| last but not least in national and world news"
PippinAgent.Speak "Two dead in Texas freeway shooting spree"

PippinAgent.Speak " A gunman was still at large on Monday after killing at least two people in a shooting spree on highways in and around Dallas, police and local media said.    "

End Sub

Sub Odd()

PippinAgent.Speak "Finally in the news.  Oddly enough ... | Finally, offbeat news! | Finally, news that's a little weird and wacky"
PippinAgent.Balloon.Style = &H21C000F

PippinAgent.Speak "Homeless get caviar for Christmas"

PippinAgent.Speak " Down-and-outs and hard up pensioners in Milan will enjoy a rare Christmas treat this year: choice beluga caviar confiscated from traffickers.    "

End Sub
Sub Sports()
PippinAgent.Balloon.Style = &H21C000F

PippinAgent.Speak "In sports news ... | Today in sports news ... | From the sports desk ... | Next, the sports highlights | Go team! Here's sports news"

PippinAgent.Speak "Gould keeps Bears' playoff hopes alive"

PippinAgent.Speak " The Chicago Bears kept their playoff run alive on Monday , beating rivals the Green Bay Packers 20-17 in overtime after a thrilling comeback at frigid Soldier Field.    "

PippinAgent.Speak "in other sports news | also sports news | additionally in sports news"
PippinAgent.Speak "Tiger's comeback the game's biggest talking point"

PippinAgent.Speak " While professional golf prepares to confront a bleak economic landscape in 2009, the biggest talking point in the game relates to the timing and immediate impact of Tiger Woods's comeback from injury.    "

PippinAgent.Speak "Yankees sign Wang as shopping spree continues"

PippinAgent.Speak " The New York Yankees continued to firm up their starting rotation by signing pitcher Wang Chien-Ming to a one-year $5 million deal, the Major League Baseball team said on Monday.    "

PippinAgent.Speak "Pau wins battle of Gasol brothers"

PippinAgent.Speak " Kobe Bryant scored 36 points to lead the Los Angeles Lakers to a 105-96 win over the Memphis Grizzlies on Monday in a game that marked the first NBA meeting between brothers Pau and Marc Gasol.    "

PippinAgent.Speak "and also in sports news | lastly in sports news | finally in sports news | last but not least in sports news"
PippinAgent.Speak "Hot Nelson leads Magic to fifth straight win"

PippinAgent.Speak " The Orlando Magic won their fifth straight game as Jameer Nelson's 22 points and seven assists led them to a 113-81 home rout of the Golden State Warriors on Monday.    "

End Sub
Sub Stocks()
PippinAgent.Balloon.Style = &H21C000F

PippinAgent.Speak "The stock exchange is currently closed"

PippinAgent.Speak "The stock exchange will open in approximately 5 hours and 50 minutes."

PippinAgent.Speak "When the stock market closed yesterday."

PippinAgent.Speak "The Dow Jones Industrial Average Index was at 8,519.69"

PippinAgent.Speak "The Nasdaq Composite was at 1,532.35"

PippinAgent.Speak "The S and P 500 Index was at 871.63"

PippinAgent.Speak "The 10-Year Treasury Note was at 2.14"

PippinAgent.Speak "The New York Stock Exchange Volume was at 4,973,955,500"

PippinAgent.Speak "The Nasdaq Volume was at 1,677,134,500"
PippinAgent.Speak "and now, five of Bruce and Vira's favorite stocks to watch ...| Here's five of our favorite stocks to watch | Next, stock quotes ..."

PippinAgent.Speak "L-3 Communications Corporation stock last traded at 71.83."

PippinAgent.Speak "Microsoft Corporation stock last traded at 19.18."

PippinAgent.Speak "Yahoo! Incorporated stock last traded at 12.35."

PippinAgent.Speak "Nortel Networks Limited stock last traded at 0.25."

PippinAgent.Speak "Unknown stock last traded at CSCO."

End Sub
Sub Information()
PippinAgent.Balloon.Style = &H21C000F


PippinAgent.Speak "Including you, there has been 350,247 visitors to these web pages."

PippinAgent.Speak "\Chr=""Whisper""\Tell your friends about this web site. When the counter hits one million, I get a bonus!"

End Sub
Function GetTimeOfDay()
' Purpose:Returns current time of day
Dim TimeOfDay
Dim h
h = Hour(Now())
If h < 12 Then
TimeOfDay = "Morning"
ElseIf h < 17 Then
TimeOfDay = "Afternoon"
Else
TimeOfDay = "Evening"
End If
GetTimeOfDay = TimeOfDay
End Function
Function GetRussianTimeOfDay()
' Purpose:Returns current time of day
Dim TimeOfDay
Dim h
h = Hour(Now())
If h < 12 Then
TimeOfDay = "DObroye Utro!"
ElseIf h < 17 Then
TimeOfDay = "DObriy den'!"
Else
TimeOfDay = "DObriy vEcher!"
End If
GetRussianTimeOfDay = TimeOfDay
End Function
Function GetSpanishTimeOfDay()
' Purpose:Returns current time of day
Dim TimeOfDay
Dim h
h = Hour(Now())
If h < 12 Then
TimeOfDay = "Buenos Dias!"
ElseIf h < 17 Then
TimeOfDay = "Buenas Tardes!'"
Else
TimeOfDay = "Buenas Noches!"
End If
GetSpanishTimeOfDay = TimeOfDay
End Function
Function GetJapaneseTimeOfDay()
' Purpose:Returns current time of day
Dim TimeOfDay
Dim h
h = Hour(Now())
If h < 12 Then
TimeOfDay = "O-ha-yoh go-za-ee-mas!"
ElseIf h < 17 Then
TimeOfDay = "Kohn-ni-chee-wa!'"
Else
TimeOfDay = "Kohn-bahn-wa!"
End If
GetJapaneseTimeOfDay = TimeOfDay
End Function
