Promixis, LLC Forums  

Go Back   Promixis, LLC Forums > Old software > Girder 3.3

Reply
 
Thread Tools Display Modes
  #1  
Old December 15th, 2003, 03:31 PM
Promixis's Avatar
Promixis Promixis is offline
Senior Member
Promixis Team
 
Join Date: Dec 2001
Posts: 11,560
Default Microsoft Agent COM Example

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 ()
Mike
Reply With Quote
  #2  
Old June 3rd, 2004, 08:42 PM
Hesse Hesse is offline
Member
Experienced User
 
Join Date: Nov 2003
Posts: 71
Default

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
Reply With Quote
  #3  
Old June 3rd, 2004, 08:55 PM
Promixis's Avatar
Promixis Promixis is offline
Senior Member
Promixis Team
 
Join Date: Dec 2001
Posts: 11,560
Default

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)...
Reply With Quote
  #4  
Old June 3rd, 2004, 09:10 PM
Hesse Hesse is offline
Member
Experienced User
 
Join Date: Nov 2003
Posts: 71
Default

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
Reply With Quote
  #5  
Old June 3rd, 2004, 09:50 PM
Hesse Hesse is offline
Member
Experienced User
 
Join Date: Nov 2003
Posts: 71
Default

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}"
But it didn't compile. What is the proper way to do this? Also, there is a way to get the available voices and save them into a variable. Then you could just select the index of the one you want. I'm not a great programmer, and I don't know Lua that well, so I will probably need some help doing this. I'm going to keep looking for the command to get the available TTS voices installed.

Thanks,

Jesse
Reply With Quote
  #6  
Old June 4th, 2004, 07:57 AM
Promixis's Avatar
Promixis Promixis is offline
Senior Member
Promixis Team
 
Join Date: Dec 2001
Posts: 11,560
Default

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}"
Reply With Quote
  #7  
Old June 4th, 2004, 11:23 AM
BoomSmurf BoomSmurf is offline
Senior Member
Experienced User
 
Join Date: Apr 2004
Posts: 100
Default

Quote:
Originally Posted by Mike C
2 quick pointers for using luacom....

Properties, ie values, are accessed using object.property.

Methods, ie. functons, are accessed using object:method.
I wonder why this is. Really can't think of any reason why to make this distinction. At least not one that has more pro's than con's :-?
__________________
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!
Reply With Quote
  #8  
Old June 4th, 2004, 02:44 PM
Hesse Hesse is offline
Member
Experienced User
 
Join Date: Nov 2003
Posts: 71
Default

Quote:
Originally Posted by Mike C
2 quick pointers for using luacom....

So

MyAgent:Characters("Merlin"):TTSModeID = "{a101db41-5b7c-4513-9E58-7D00767313FE}"

should be

MyAgent.Characters("Merlin").TTSModeID = "{a101db41-5b7c-4513-9E58-7D00767313FE}"
Ok, I saw the distinction between those two and played with it some last night. However, I get this error when trying the second implementation.

Code:
14:43:38	Friday, June 04, 2004	ALERT:	error: COM error:(.\src\library\tLuaCOM.cpp,362):Invalid number of parameters.
So I must not have the syntax right. Have you found any documentation on the methods for interacting with the agent via COM (besides basic things). I didn't get what I needed from the MSDN website.

Jesse
Reply With Quote
  #9  
Old June 4th, 2004, 05:47 PM
Hesse Hesse is offline
Member
Experienced User
 
Join Date: Nov 2003
Posts: 71
Default

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}"
Now, I just need to figure out how the other programs get the list of voices installed on the computer.

Jesse
Reply With Quote
  #10  
Old June 4th, 2004, 06:19 PM
Hesse Hesse is offline
Member
Experienced User
 
Join Date: Nov 2003
Posts: 71
Default

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
Mike,

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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:36 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright (c) Promixis, LLC