Page 1 of 1 1
Topic Options
#85079 - 2002-02-03 11:46 PM MS Agent in KIX (again)
mmantei Offline
Fresh Scripter

Registered: 2002-01-28
Posts: 25
I tried thhis question over in the SCRIPTS forum and never got it resolved. This might be a more appropriate location for it. I am attempting to use the Microsoft Agent in a logon script.

This is how it looks in VBScript:

Set Figure1 = Activate("Genie")
Figure1.Show
figure1.MoveTo(400,300)
set Request=figure1.speak("Welcome to the new network")
Do Until request.Status = Complete
Wscript.Sleep 100
Loop

The VBScript code work just fine. I've converted it into KIX 4.01 and it looks like this:

$AgentName="Genie"
$AgentPath = "%WinDir%\MSAgent\Chars\Genie.ACS"
$Agent = CreateObject ("Agent.Control.2")
$Agent.Connected = "1"
$=$Agent.Characters.Load($AgentName,$AgentPath)
$Char = $Agent.Characters.Character($AgentName)
$=$Char.Show()
$=$Char.MoveTo(400, 300)
$request=$Char.Speak("Hello. Thank you for logging on to the network")
while $request.status and not @error
sleep(1)
loop

This code does not work. In VBScript the value for "request.status" changes when the agent stops speaking. In the KIX code, the value for "$request.status" is 2 and never changes. Any idea how to get his to work properly in KIX?

_________________________
Mike

Top
#85080 - 2002-02-04 06:11 AM Re: MS Agent in KIX (again)
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well, no luck with $request.status, but did have some success with $Agent.AudioOutput.Status check FWIW. Did notice however, that short sleeps were needed after $Char.Show and $Char.MoveTo as they too generate audio.
code:

Break on

$AgentName="Genie"
$AgentPath = "%WinDir%\MSAgent\Chars\Genie.ACS"
$Agent = CreateObject ("Agent.Control.2")
$Agent.Connected = "1"
$=$Agent.Characters.Load($AgentName,$AgentPath)
$Char = $Agent.Characters.Character($AgentName)
$=$Char.Show()
sleep 1
$=$Char.MoveTo(400, 300)
sleep 1
$request=$Char.Speak("Hello. Thank you for logging on to the network")
While ($Agent.AudioOutput.Status) <> 0
sleep 1
Loop
$Agent.AudioOutput.Status ?

get $_


[ 04 February 2002: Message edited by: LLigetfa ]

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#85081 - 2002-02-04 01:40 PM Re: MS Agent in KIX (again)
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
Les,
Do you have the original script ?
Maybe something is missing

Also, what do you want to do with
$Agent.AudioOutput.Status ?
????
i don't get a look to how this thing is working, but it seems to me that there is a mistake in the line

_________________________
? getobject(Kixtart.org.Signature)

Top
#85082 - 2002-02-04 02:20 PM Re: MS Agent in KIX (again)
mmantei Offline
Fresh Scripter

Registered: 2002-01-28
Posts: 25
I will be using the script as part of the logon script. When working with the agent, the commands are run from a queue. Therefore, if you submit 5 or 6 commands, the script will continue processing, as the agent performs the commands that are in it's queue. I am trying to determine when those actions are done, so I can close the agent, without having to use sleep statements (which would potentially be different for speed of computer and connection type). The VB Script does what it is supposed to, the KIX script doesn't. I don't know if it's the code or KIX.
_________________________
Mike

Top
#85083 - 2002-02-04 02:42 PM Re: MS Agent in KIX (again)
mmantei Offline
Fresh Scripter

Registered: 2002-01-28
Posts: 25
By using this statement "While ($Agent.AudioOutput.Status) <> 0" you are querying the agent itself for the status of something. How would i determine what other properties I could query from the agent? The code I posted was supposed have a "request" which would have a return value that I could query. That way I could just batch up the commands in the queue and only check the last item.

As an example of the problems I'm seeing, your code didn't work for me until I threw in a few more sleep statements because it just ran too fast for the animation to keep up.

_________________________
Mike

Top
#85084 - 2002-02-04 04:23 PM Re: MS Agent in KIX (again)
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Ahhh, now your in the right forum. Try this variation on a theme:


break on


$merlin_path = "%windir%\msagent\chars\merlin.acs"


$agent = createobject ("agent.control.2")


$agent.connected = "1"


$= $agent.characters.load("merlin","$merlin_path")


$merlin = $agent.characters.character("merlin")


$= $merlin.moveto(400,200)


$= $merlin.show()


$wait = $merlin.play("announce" )


do sleep 1 until $merlin.wait($wait) <> 0


$wait = $merlin.speak("I'm done blowing my own horn" )


do sleep 1 until $merlin.wait($wait) <> 0


?"script done..."


exit 1


-Shawn

[ 04 February 2002: Message edited by: Shawn ]

Top
#85085 - 2002-02-04 04:43 PM Re: MS Agent in KIX (again)
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Thanks Shawn, much better than my $Agent.AudioOutput.Status. I sorta had your wait($wait) in mind, but was stuck on having a second character wait for the first (per the other thread).

Once again, you're the better man.

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#85086 - 2002-02-04 04:56 PM Re: MS Agent in KIX (again)
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Les,

No worries mate. Normally, $merlin.wait($wait) doesn't work because an agent can't wait on it's on request object. I just applied a few kix trix to make it work. Actually, this is probably a better expression to use in a logon script - it's a bit more bullet proof because we want to insure a valid request object before we wait in a loop:


if $wait do sleep 1 until $merlin.wait($wait) <> 0 endif

Anyways, lets see what mmantei thinks of our solution.

-Shawn

Top
#85087 - 2002-02-05 01:31 AM Re: MS Agent in KIX (again)
mmantei Offline
Fresh Scripter

Registered: 2002-01-28
Posts: 25
You know, you guys are amazing. I've only been following the stuff on the board here for a couple weeks and have picked up so much. I would have never even thought of some of the stuff I'm working on right now. The script from Shawn does exactly what I was looking for. I appreciate all of the help you guys have provided.
_________________________
Mike

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1003 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.059 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org