rerouting output to other windows

Posted by Feantur on Mon 10 Jan 2005 11:17 PM — 11 posts, 41,742 views.

#0
I'd like to reroute specific lines from the MUD's output to other windows. Also, it should log each of the windows' contents to a different log file.

This could be done via a trigger, I suppose. I've played around a bit but couldn't get it to work like I want.
USA #1
You obviously need a trigger to match on your line, whatever that might be. And then you'd use SendToNotepad to send the contents to a notepad window.

If you want to have multiple logs at the same time, you have a few options. You can either save your notepad windows (SaveNotepad), open a log (OpenLog), write to it (WriteLog), and then close it again (CloseLog) per write. Or you can use FSO to write to each file.
With FSO, you can have multiple logs 'open' at the same time, simply with multiple FSO objects.

Some links:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1979
Points you to the FSO help file online, there is also an entry in the Windows Scripting help file (the VBScript/Jscript help file that Nick points to on the downloads page).

I cant seem to find the post in the forums that is an explination of FSO, but if you search for FSO (or FileSystemObject) youll return a few hits.

Obviously you can also search the forums for any of those script commands and get examples.
#2
Thanks, I'll play with these. :-)
#3
Obviously it would be easier to use the send to notepad option. Is there a way I can specify _which_ notepad?
#4
OK, got that. :)
#5
If I want to add a line to notepad and then skip to the next line, how would I do this?

(JScript)
world.AppendToNotepad("title","%1\n"); doesn't work (with %1 being supplied by a trigger, obviously).
#6
I've tried various variations of \\n and \\r\\n, too, now.
#7
Ok, new problem:

I have a notepad open. It gets sent the data correctly, and it saves.

OnWorldClose closes all notepad windows without problems.

However, when I reopen the world, I would like to continue writing to the same notepad file I have used previously.

Is this possible without FSO functions (if so, how)?
United Kingdom #8
http://www.juicystudio.com/tutorial/asp/files.asp

The FSO TextStream Object

The FSO TextStream object is used to read and write to sequential text files.
Writing to Text Files

When writing to a file, you can either create a new file, overwrite an existing file or append text to the end of an existing file. The CreateTextFile method is used to create a text file and return a reference to a TextStream object. The FSO File object's OpenAsTextStream method may be used to open a TextStream in append mode (ForAppending), reading mode (ForReading) or write mode (ForWriting). The Write method is used to write a string, the WriteBlankLine method is used to write blank lines, and the WriteLine method is used to write a line of text ending with a newline character.

objTextStream.Write "First line in the text file"
objTextStream.WriteBlankLines 2
objTextStream.WriteLine "Another line."




http://www.google.com/search?q=fso+append&sourceid=opera&num=100&ie=utf-8&oe=utf-8
#9
Thanks!
United Kingdom #10
My attempt, should you still be playing with this. ;p

Matches on things like:

(Wizards) Faux wisps: Whine!
> (Wizards) Faux wisps: Downgrape!
(Speed Mafia) Faux Ubersurname: VOTE FEANTUR


etc. (:P)

Each channel goes to a seperate window.

You might want to Omit from Output.

Also, the regex trims the names so the tabbing looks right.
ie.

(Wizards) Spongebob wisps: Monkey!!!!

will log:

[Spongebo]:	 Monkey!!!!


You might want to take that out.


<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="^.? ?\((.*?)\) ([a-zA-Z]{0,8})[a-zA-Z]*?.*?: (.*)$"
   regexp="y"
   send_to="12"
   sequence="89"
  >
  <send>if (string.len("%2")&gt;4) then
AppendToNotepad("%1","[%2]:\\t %3" .. '\\r\\n')
else
AppendToNotepad("%1","[%2]:\\t\\t %3" .. '\\r\\n')

end</send>
  </trigger>
</triggers>