John Lam's post about controlling Microsoft Agents in Python reminded me of some code I wrote years ago.
(defmethod sa:move-event ((self demo-agent) character-id x y cause) (when (eql cause 1) (let ((phrase (case (floor (/ (random 3) (+ (random 3) 1))) (0 nil) (1 "Hey!") (2 "If only I had a mouse, then you'd be the one dancing.")))) (when phrase (sa:speak self (parse-integer character-id) phrase))))) (defparameter *a* (make-instance 'demo-agent)) (sa:load-character *a* "p1" "peedy.acs") (sa:show *a* "p1") (sa:speak *a* "p1" "Hi, my name is Peedy.") (sa:play *a* "p1" "greet") (sa:speak *a* "p1" "I'm very entertaining.")
The Python code is a little nicer looking.
agent = win32com.client.Dispatch("Agent.Control.2") agent.Connected = -1 agent.Characters.Load("Peedy", "Peedy.acs") peedy = agent.Characters("Peedy") peedy.LanguageID = 0x409 peedy.Show() peedy.Speak("Hello, World!") peedy.Play("Blink")Posted by jjwiseman at September 27, 2004 10:57 PM
In Perl, too: http://larsen.perlmonk.org/blog/archives/000050.html
Posted by: larsen on September 28, 2004 02:13 AMJust a little note on the python,you need to add
import win32com.client
before the first line to get this to actually execute.
Posted by: Gordon Weakliem on August 8, 2006 09:02 AM