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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  Redirecting Output from Commands

Redirecting Output from Commands

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


Posted by Hammerstein   (1 post)  [Biography] bio
Date Wed 12 May 2004 03:07 AM (UTC)
Message
I suspect there might be a way to do this, but I'm not sure, so I thought I'd post it here. I was thinking that it would be great if MUSHclient supported a method of, upon the entry of a certain command, displaying the output from that command in a separate window that could be moved around the screen. That would be helpful for certain info commands that are best left always available.

Thank you for your time and effort.
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #1 on Wed 12 May 2004 03:53 AM (UTC)

Amended on Wed 12 May 2004 03:54 AM (UTC) by Ked

Message
One way to do this would be to pipe those commands through a single function that would send the command text to a notepad window. An example would be:


sub CommandLogger(comText)
     world.AppendToNotepad "Commands", comText & vbCRLF
end sub


Then you could use this function either directly from an alias via send to scripting, or from another scripting function called by an alias. But it would be easier to just have a protocol of calling scripts immediately from aliases and prepending the call to CommandLogger before any other scripts in the aliases that you want logged.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Wed 12 May 2004 10:20 PM (UTC)

Amended on Wed 12 May 2004 10:21 PM (UTC) by Nick Gammon

Message
I think he wants the output in a separate window, not the command.

The problem with what you want to do is there is normally a lag between entering the command and receiving the results.

For example, you might type "inventory" but get back:


Lightning crackles in the sky above!
Boris chats 'where is the shop where I can buy swords?'

You are carrying:
     a magic mushroom
     a torch
     a dragonskin
     a bag
     recall scroll
     a braided leather belt
     heavy mail leggings



In this case I have a couple of extra lines that are not really part of the inventory.

Now, if you don't mind that, then you could make an alias for (say) "inventory", that enables an trigger. This trigger would match "*" (everything), and send to "append to notepad", and also "omit from output".

That effectively moves everything that is received afterwards from the main window to the notepad (each notepad has a separate title based on the trigger name).

However your problem is stopping it. If you don't do anything else, then the entire following session will be in the notepad window and not the main window.

You need a "stopper" - in the case above a totally blank line is the end of the inventory. Another trigger could detect that and turn the first trigger off (disable it).

However in my example above there is also a blank line *before* the inventory. So, the simplest thing might be:



  1. Trigger "a" detects "You are carrying:" and enables trigger "b"

  2. Trigger "b" detects "*" (everything) and moves it to the notepad

  3. Trigger "c" detects a blank line and disables trigger "b"




- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


10,594 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]