Microsoft Agent

Posted by Confuse on Fri 04 Jan 2002 02:13 AM — 5 posts, 23,869 views.

#0
I'm trying to use Micresoft Agent to work with in my scripts... like reading names or passages.. but i'm not able to call it. I used WScript to call the agent, and i think this may be the problem...

Could you guys help me??
Australia Forum Administrator #1
Can you post an example of what you are doing?
#2
Ok.. This is the file for the agent script........

***************Script begins**************
Dim AgentControl
Dim ScriptComplete
ScriptComplete = False

Set AgentControl = WScript.CreateObject("Agent.Control.2", "AgentControl_")
AgentControl.Characters.Load "Peedy", "C:\WINDOWS\MSAGENT\CHARS\Peedy.acs"
Set Peedy = AgentControl.Characters("Peedy")


Sub AgentControl_RequestComplete(ByVal RequestObject)
' Purpose: Take action on completion or failure of requests
On Error Resume Next

If RequestObject <> EndReq Then
Else
If Not Peedy.Visible Then
' Trigger the Script to Close
ScriptComplete = True
Else
'lets me exit
End If
End If

If RequestObject <> HideReq Then
Else
AgentControl.Characters.Unload "Peedy"
ScriptComplete = True
End If
End Sub

Sub Tells(name, message)
Peedy.Commands.Caption = "My Menu"
Peedy.Commands.Add "Exit", "Exit", "Exit"
Peedy.Show
Peedy.Speak name
Peedy.Speak message
End Sub


Sub AgentControl_Command(ByVal UserInput)
If UserInput.Name = "Exit" Then
AgentControl.Characters.Unload "Peedy"
ScriptComplete = True
End If
End Sub


Do
WScript.Sleep 1000
Loop Until ScriptComplete

*******************Script Ends***************

And this is the script i have the Client access.........

*****************Script Begins********************

Sub ags
Dim Fso
Dim f
Dim str

Set Fso = CreateObject("Scripting.FileSystemObject")
Set f = Fso.OpenTextFile("agenttest.vbs", 1)
str = f.ReadAll
f.Close
ExecuteGlobal str

End Sub

Sub OnWorldConnect

Dim FileName

FileName = Replace (World.Worldname, " ", "") ' Remove spaces from file name

' Add other editing here if you have weird characters in your mud names.

FileName = FileName & ".txt"
if World.OpenLog (FileName, True) = eOK then ' true means append to any existing log file
World.WriteLog "--- Log Opened " & Now () & " ---" ' make note in log file
World.Note "Opened log file" & FileName ' make note in world window
end if
World.SendToNotepad "Tells you received", " " & vbcrlf
World.Activate

Call ags
End Sub


Sub OnTell (trname, trline, wildcards)
name = wildcards (1)
message = wildcards (2)

World.AppendToNotepad "Tells you received", "Time: " & Now() & ">>" & " Name: " & name & " Message: " & message & vbcrlf
Call Tells(name, message)

World.Activate
End Sub

********************Script Ends******************

ok, this is the script i'm working on right now....

Amended on Fri 04 Jan 2002 06:57 AM by Confuse
Australia Forum Administrator #3

Have you seen this post: Does MUSHclient use DDE?

That shows an example of using CreateObject.

Amended on Fri 04 Jan 2002 10:31 PM by Nick Gammon
#4
The link was pretty helpful... i appreciate the help...
Now i probably will be able to get it....

Thanks a lot for the help..