PDA

View Full Version : MSAgent with LuaCOM ???


RizlaUK
03-09-2008, 07:50 PM
anyone had any luck useing MSAgent with LuaCOM ???

iv been asked to work on a educational project for my daughters school that will use some MSAgent characters, i can make this work in PB but i want to use AMS and i dont want to have to wrap every command i sent to MSAgent in a dll as there could be 1000's

heres what i have
AgentObj = luacom.CreateObject("Agent.Control.2")
if AgentObj then
if AgentObj then
AgentObj.Connected=true
AgentObj.Characters.Load("Max", "Max.acf")
AgentObj.Characters.Show("Max")
AgentObj.Characters.Play("Max","Greet")
AgentObj.Characters.Speak("Max","Hello. ")
end
else
Dialog.Message("Error", "Could not create luacom object.")
end

it gets past the "AgentObj.Connected" but then errors on "AgentObj.Characters.Load" saying "Characters is a nil value" but it should be there,

heres what MS has to say.....but it dident really help me :(
http://msdn2.microsoft.com/en-us/library/ms695962.aspx

what am i doing wrong ?

stickck
03-09-2008, 08:25 PM
Its been a while, but here you go. Worm started this thread. i used it in a project also.

http://www.indigorose.com/forums/showthread.php?t=12571&highlight=MSAGENT

http://www.indigorose.com/forums/showthread.php?t=14363

Hope that helps some

Chris

RizlaUK
03-09-2008, 09:40 PM
Thats Perfect, how did i miss that one

got just what i need to get started now :yes

AgentObjEvents={}
AgentObj = luacom.CreateObject("Agent.Control")
if AgentObj then
if AgentObj then
AgentObj.Connected = 1
AgentObj.Characters:Load("Max", "C:\\WINDOWS\\Msagent\\chars\\Max.acs")
if AgentObj.Characters("Max") ~= nil then
luacom.Connect(AgentObj, AgentObjEvents)
AgentObj.Characters("Max"):MoveTo(0,0)
AgentObj.Characters("Max"):Show(nil)
AgentObj.Characters("Max"):Play("Greet")
AgentObj.Characters("Max"):Speak("Hello. ")
else

end
end
else
Dialog.Message("Error", "Could not create luacom object.")
end

funny enough, "AgentObjEvents" would have been my next milestone so that solves 2 problems in one,

thanks for pointing me in the right direction

stickck
03-10-2008, 04:58 AM
No Problem:yes But in all reality... WORM's the MAN!

RizlaUK
03-10-2008, 08:06 AM
WORM's the MAN!

lol, very true....i think everyone at this forum has been helped by worm at some point...and i think me more than most, lol

Cheers worm:yes

rexzooly
03-10-2008, 04:06 PM
i really like this i have just downloaded all 4 on the ms site going to see if i can do something with them.

:yes

stickck
03-10-2008, 06:28 PM
there was a complete web circle out there somewhere that had even more characters.

chris

Intrigued
03-16-2008, 05:28 PM
I went ahead and created an example (.apz - exported AMS 7 project) so folks can download and get to testing, trying out such code.

Note: You will need to reference (click on the check box for such) the LuaCOM plugin. Project > Plugins > LuaCOM (Thanks to Brett, who was the previous lead developer for the I.R. team, for donating this free plug-in!)

SAPI (computer speaks) example:

www.amsuser.com/ams/examples/SAPI-Speaking-AMS7-Intrigued.apz