![]() |
|
#1
|
||||
|
||||
|
This is a quick example of using MS Agent with Girder. Allows asyncronous events and speech.
Code:
-- Quick MS Agent LuaCOM demo
-- example of using the speech component and asyncronous events!
-- See MSDN for agent programming details
--http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msagent/pacontrol_6lyk.asp
MyAgentEvents = {}
function MyAgentEvents:Click (CharacterID,Button,Shift,X,Y)
print (CharacterID,Button,Shift,X,Y)
MyAgent:Characters(CharacterID):Speak ("You Clicked on Me at "..X.." "..Y)
end
function MyAgentInitialize ()
LoadLuaCom ()
if not MyAgent then
MyAgent = luacom.CreateObject ("Agent.Control")
luacom_Connect(MyAgent,MyAgentEvents)
MyAgent.Connected = 1
MyAgent.Characters:Load ("Genie","Genie.acs")
end
end
function MyAgentClose ()
MyAgent = nil
collectgarbage ()
end
function MyAgentAppear ()
MyAgent:Characters("Genie"):Show ()
MyAgent:Characters("Genie"):Speak ("Hello")
end
MyAgentInitialize ()
MyAgentAppear ()
|
|
#2
|
|||
|
|||
|
Mike,
How can I select different voices using MS Agent? I've got it up and running, but it is using the default voice. I have ATT True Voices installed. Can you give the subfunction that controls it and maybe an example too. ![]() Thanks, Jessse |
|
#3
|
||||
|
||||
|
Jesse,
You need to change the character that you load. (At least as far as I know!). The documentation on MSDN is actually fairly good so its worth reading. Please post you work here for others to look at (me as well)... |
|
#4
|
|||
|
|||
|
I read that MS Agent can use different speech engines, including ATT True voices. I assumed that I could change it for any of the different characters. I could be wrong.
I will look for the MSDN documentation. Thanks for the tip, I totally missed the website. Maybe I'll post a link here to make it more visible. http://msdn.microsoft.com/library/de...ntrol_6lyk.asp Jesse |
|
#5
|
|||
|
|||
|
Mike,
I found out how to change the voices, but don't quite know how to implement it. I found a nice script editing/creating program for MS Agent characters. It is called Microsoft Agent Scripting Software and is available at: http://www.abhisoft.net/mass/ In that program, if you go to Actions->Set TTS Mode it shows a list of available voices on your computer. Then you can change the characters voice. For example, to change to Adult Male #1, American English (TruVoice), the script it outputs is: Code:
Merlin.TTSModeID = "{ca141fd0-ac7f-11d1-97A3-006008273000}"
for the Merlin character. I tried in Girder to do: Code:
MyAgent:Characters("Merlin"):TTSModeID = "{a101db41-5b7c-4513-9E58-7D00767313FE}"
Thanks, Jesse |
|
#6
|
||||
|
||||
|
2 quick pointers for using luacom....
Properties, ie values, are accessed using object.property. Methods, ie. functons, are accessed using object:method. So MyAgent:Characters("Merlin"):TTSModeID = "{a101db41-5b7c-4513-9E58-7D00767313FE}" should be MyAgent.Characters("Merlin").TTSModeID = "{a101db41-5b7c-4513-9E58-7D00767313FE}" |
|
#7
|
|||
|
|||
|
Quote:
__________________
Delphi Guru - That\'s TreeSmurf in English - the tree-hugging hippy smurf Building his own HTPC software - none of the other ones fit my needs :) MP3 player (w/r.gain) finished - Movie player to go! |
|
#8
|
|||
|
|||
|
Quote:
Code:
14:43:38 Friday, June 04, 2004 ALERT: error: COM error:(.\src\library\tLuaCOM.cpp,362):Invalid number of parameters. Jesse |
|
#9
|
|||
|
|||
|
Ok, boy, what a struggle. I finally figured out how to change the voice. It was in my Lua syntax problems. It should be:
Code:
MyAgent:Characters("Merlin").TTSModeID = "{a101db41-5b7c-4513-9E58-7D00767313FE}"
Jesse |
|
#10
|
|||
|
|||
|
Ok, here are some other tips for showing and hiding the character, as well as idling:
Code:
MyAgent:Characters("Genie"):Show("1") --Show the character quickly (w/o sound effects)
MyAgent:Characters("Genie"):Hide("1") --Hides the character quickly (w/o sound effects)
MyAgent:Characters("Genie").IdleOn = "0" --Turns of idle mode animation so it doesn't go to sleep
Is there a way to make the character speak while it is hidden? I don't really want to see the character at all, I just want to use it for speech. Maybe if I move him way off of the screen, I'll try that. Jesse Edit Ok, this seems to work. It disables the balloon and shrinks the character down to one pixel. Code:
MyAgent:Characters("Genie").Balloon.Style = "0"
MyAgent:Characters("Genie").Height = "1" --Default is 128
MyAgent:Characters("Genie").Width = "1" --Default is 128
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|