[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Office Assistant sniplet

Office Assistant sniplet

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Storm Dragon   Denmark  (45 posts)  [Biography] bio
Date Sat 11 May 2002 02:02 AM (UTC)

Amended on Sat 11 May 2002 02:11 AM (UTC) by Storm Dragon

Message

'--------------------------- START AGENT STUFF -------------------------------------

Dim Agent
Dim Cat

Set Agent = CreateObject("Agent.Control.2")
Agent.Connected = True
Agent.Characters.Load "Cat", "D:\Dokume~1\lensmoor\agent\offcat.acs"
'                       Load up the character.
'                       This is where I have my assistant located, might be diffrent with you.
Set Cat = agent.Characters("Cat")
'                       Make it a bit shorter by assigning actions to "Cat"
Cat.Balloon.FontName = "FixedSys"
'                       Set font to FixedSys, same as muds usually use
Cat.Balloon.FontSize = 8
'                       Set the size to 8 (thats my config in any case)
'------------Microsoft being asses about configuring their software-----------------
'            in a most complex way so noone can fiddle without doing
'            something wrong, hence making it take hours to do this stuff
Cat.Balloon.Style = (Cat.Balloon.Style AND auto-pace) + 1
'                       Above line removes timer on the text sent to the assistant
'                       making it blurt it out at once instead of a word at the time
Cat.Balloon.Style = (Cat.Balloon.Style AND &H00FFFFFF) + (4*(2^24))
'                       This one sets the amounts of lines displayed to 4
Cat.Balloon.Style = (Cat.Balloon.Style AND &HFF00FFFF) + (80*(2^16))
'                       this one sets the line length to 80 characters
'--------------------------- End ass stuff -----------------------------------------

sub AgentHide() '       I use this for world.disconnects (in the script window)
  Cat.Hide      '       assistant is spooked and hides
end sub

sub AgentShow() '       I use this for world.connects (in the script window)
  Cat.Show      '       Show my assistant
end sub

sub AgentSpeak(sentence)
  Cat.Think sentence '  This can be Think or Speak
  world.deletetimer "BubbleTimer"
  world.addtimer "BubbleTimer", 0, 0, 20, "", 5, "AgentHideBubble"  
'                       Make the bubble with text stay for 20 seconds before hiding it
end sub

sub AgentHideBubble (strTriggerName)
  Cat.Balloon.Visible = FALSE
'                       Hide bubble (this erases the text in the bubble as well)
end sub

'--------------------------------- END AGENT STUFF --------------------------------------

sub RelayTell (strTriggerName, trig_line, arrWildCards)
 AgentSpeak(trig_line) 'This relays the trigger line to the assistant
'                       (good for tells and other messages from a mud :))
end sub
[Go to top] top

Posted by Storm Dragon   Denmark  (45 posts)  [Biography] bio
Date Reply #1 on Sat 11 May 2002 02:06 AM (UTC)

Amended on Sat 11 May 2002 02:36 AM (UTC) by Storm Dragon

Message
I hope you people enjoy it as much as I did making it ;)
have fun..

Addition.. if you use my script please post your comments on it here, what you think of the idea and such..
[Go to top] top

Posted by Jcet   USA  (25 posts)  [Biography] bio
Date Reply #2 on Sun 12 May 2002 08:48 AM (UTC)
Message
One question, whats it do?

-Jcet
See no good, hear no good, be no good, kill all good!
[Go to top] top

Posted by Storm Dragon   Denmark  (45 posts)  [Biography] bio
Date Reply #3 on Sun 12 May 2002 05:48 PM (UTC)
Message
Heh.. Well its a com interface to the MS office assistant
(that pesky little thing popping up with help)

with this script you can work in another window and when something from the world is sent to it
it will display it in a nice little bubble on top of everything
I can see it useful in some aspects, but feel free to experiment.. there is more
helpfiles on www.msdn.microsoft.com
on how to program the little bugger.. my script is just a bit that does the initial stuff to it.
[Go to top] top

Posted by StefanWulph   USA  (35 posts)  [Biography] bio
Date Reply #4 on Mon 13 May 2002 10:49 PM (UTC)
Message
Hello..
Uhmm dumb Q.. How do you get it working? I'm guessing you have to have some triggers setup for it.. Yes/No? If yes, what are they? If no then how? Thanks for the more info and nifty script Storm Dragon..

Stefan Wulph
Proud Winfur and FADHD
[Go to top] top

Posted by Storm Dragon   Denmark  (45 posts)  [Biography] bio
Date Reply #5 on Thu 16 May 2002 10:49 PM (UTC)
Message
I included a "sub" for the assistant called RelayTell
you specify that as script in the trigger and it
will send the line that triggered the trigger to the
assistant.. of course there is more information about
what you can do with it.. right now I just use it to relay messages from the world.
[Go to top] top

Posted by Ishnaf   Australia  (17 posts)  [Biography] bio
Date Reply #6 on Thu 18 Jul 2002 02:51 PM (UTC)
Message
just thought i'd say:

good work, its wicked dude :)
i always thought mushclient needed a cat :P

egads!
[Go to top] top

Posted by Bluedeer   (2 posts)  [Biography] bio
Date Reply #7 on Wed 30 Jun 2004 04:24 AM (UTC)
Message
I tried the Office Assistant sniplet script and everything went in without a hitch as far as I can tell, but when I close the Mushclient control panel, nothing happens. Typing /cat.show makes the cat pop up, but he doesn't do anything except his normal animations...he doesn't say anything, doesn't read anything, doesn't -do- anything even if something happens on the muck.

Am I doing something wrong?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #8 on Wed 30 Jun 2004 05:53 AM (UTC)

Amended on Wed 30 Jun 2004 05:55 AM (UTC) by Flannel

Message
I believe that snippet only has a subroutine to say things, you still need to set up triggers/aliases/timers/whatever to make the character say anything.

sub RelayTell (strTriggerName, trig_line, arrWildCards)
AgentSpeak(trig_line) 'This relays the trigger line to the assistant
' (good for tells and other messages from a mud :))
end sub

That. If you have a trigger match, and send to that script file, it will say the line. You could easily change it to say whatever youd like.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Norbert   USA  (61 posts)  [Biography] bio
Date Reply #9 on Wed 30 Jun 2004 09:22 AM (UTC)
Message
a trigger like this would work

  <trigger
   enabled="y"
   group="Cat"
   match="* tells you: *"
   name="tells"
   script="RelayTell"
   sequence="100"
   other_text_colour="black"
   other_back_colour="black"
  >
  </trigger>


Norbert

-Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens
It's a dumb question... skip it.
[Go to top] top

Posted by Bluedeer   (2 posts)  [Biography] bio
Date Reply #10 on Sat 03 Jul 2004 01:33 AM (UTC)
Message
I did figure the relaytell part out after a while. However, here's the problems I have with the script...


I can't change how fast the agent reads. It reads fast and its pitch is a little high. I'd like to be able to slow it down and drop the pitch a little bit. I'm fine with the voice.

Also, it only reads so many words. I often have lines that are often multiple lines in length, like a paragraph, but the character only reads so many words at a time, completely omitting the rest of the sentence when it reaches a certain point. Changing some of the line length options didn't help...in fact, at one point, it completely broke.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #11 on Sat 03 Jul 2004 02:08 AM (UTC)
Message
Cat.Balloon.Style = (Cat.Balloon.Style AND auto-pace) + 1
' Above line removes timer on the text sent to the assistant
' making it blurt it out at once instead of a word at the time


The Autopace thing is your initial problem. It makes the agent talk faster when theyre is a lot of words (and faster makes a higher pitch), umm, there are other options. You can actually set all the values, timing, pitch, (and that cut off). Ill... poke around for it, but the autopace is the first thing you need to get rid of I believe.

mIRC lets you set some of these things, if you poke around there you can get a feel for what you can do with the agents with regards to timing, pitch, et al.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #12 on Sat 03 Jul 2004 02:43 AM (UTC)
Message
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/ODC_MSAgent-I.asp
Talks about speed, pauses (inline stuff, search for spd and pau)
http://www.microsoft.com/msagent/dev/default.asp
is some basic stuff, with examples etc. Its a microsoft page though, so dont expect it to give you anything you can really work with...

http://www.codeproject.com/tips/msagentctrl.asp

That ones a bit more helpful.

Just google "MS Agent" Office Or whatnot. Maybe VBS.
Ive actually seen some pretty decent stuff, but it was a while ago, dont have the links.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by MattMc   USA  (54 posts)  [Biography] bio
Date Reply #13 on Wed 21 Sep 2005 04:09 AM (UTC)
Message
Has anyone figured out how to establish two-way communication between the MSAgent and the user? I want to be able to, for example, click on the agent and have it world.sendnoecho, or right click and select something from the menu (I was able to add commands to the menu, but clicking does nothing).

I added the proper subroutines to the script, but it isn't being triggered.

Any advice?

Matt
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #14 on Wed 21 Sep 2005 06:28 PM (UTC)

Amended on Wed 21 Sep 2005 06:30 PM (UTC) by Shadowfyr

Message
Try a different language, like Python or Lua. The reason is pretty simple. MS decided that VBScript shouldn't have a way to expose events to the script, unless the object is created in a different way, since the script system was designed for IE. When you use CreateObject is links to all the outgoing commands, but not events, since it has no internal event handler. In something like IE the object are created 'by' IE, then you use a script command to tell IE to tie the event 'DoSomething' to 'sub DoIt'. in the script itself. This is a limitation of JScript, VBScript and possibly PHP.

The solution is to instead use one of the tools in Python or Lua to generate what is called a 'wrapper'. This is basically just a set of definitions, which tell Python or Lua what the internals of the object look like, including events, much the same way that Nick provides a .TLB file you can import into compilers, so they know how to talk to Mushclient. Once you have such a wrapper, you can then create the object and use the internal event system of the script engine. VBScript doesn't even let you define such external links, for security reasons, or you could do things like:

Private Declare Function InternetAttemptConnect Lib "wininet" (ByVal dwReserved As Long) As Long
Private Sub Form_Load()
    If InternetAttemptConnect(ByVal 0&) = 0 Then
        MsgBox "You can connect to the Internet", vbInformation
    Else
        MsgBox "You cannot connect to the Internet", vbInformation
    End If
End Sub

The critical 'Lib "wininet"' part of the above is not allowed in any MS scripting system, since it would let people bypass security features to talk directly to Windows. Others do support it, which is why they can also tie events, like your added menu items, to the scripts.

Now, in theory, if someone could figure out how to mimic the way IE handles such objects, then you might be able to do it anyway, by ignoring CreateObject and having Mushclient handle the object creation, etc. But since no one really knows how it does what it does (or more specifically can reproduce it), there is no way to do it in the Microsoft based scripts, like VBScript.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


42,007 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]