Gammon Forum
Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
MUSHclient
General
rerouting output to other windows
rerouting output to other windows
|
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Feantur
(70 posts) bio
|
Date
| Mon 10 Jan 2005 11:17 PM (UTC) |
Message
| 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. | top |
|
Posted by
| Flannel
USA (1,230 posts) bio
|
Date
| Reply #1 on Tue 11 Jan 2005 12:58 AM (UTC) |
Message
| 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. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | top |
|
Posted by
| Feantur
(70 posts) bio
|
Date
| Reply #2 on Tue 11 Jan 2005 11:44 PM (UTC) |
Message
| Thanks, I'll play with these. :-) | top |
|
Posted by
| Feantur
(70 posts) bio
|
Date
| Reply #3 on Fri 21 Jan 2005 11:14 PM (UTC) |
Message
| Obviously it would be easier to use the send to notepad option. Is there a way I can specify _which_ notepad? | top |
|
Posted by
| Feantur
(70 posts) bio
|
Date
| Reply #4 on Fri 21 Jan 2005 11:18 PM (UTC) |
Message
| OK, got that. :) | top |
|
Posted by
| Feantur
(70 posts) bio
|
Date
| Reply #5 on Fri 21 Jan 2005 11:41 PM (UTC) |
Message
| 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). | top |
|
Posted by
| Feantur
(70 posts) bio
|
Date
| Reply #6 on Sat 22 Jan 2005 12:14 AM (UTC) |
Message
| I've tried various variations of \\n and \\r\\n, too, now. | top |
|
Posted by
| Feantur
(70 posts) bio
|
Date
| Reply #7 on Sat 22 Jan 2005 01:25 AM (UTC) |
Message
| 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)?
| top |
|
Posted by
| Faux
United Kingdom (77 posts) bio
|
Date
| Reply #8 on Sat 22 Jan 2005 03:00 AM (UTC) |
Message
| 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 |
Faux, from Discworld. Feel free to come talk to me =)
http://faux.servebeer.com/ | top |
|
Posted by
| Faux
United Kingdom (77 posts) bio
|
Date
| Reply #10 on Mon 24 Jan 2005 10:32 AM (UTC) Amended on Mon 24 Jan 2005 10:53 AM (UTC) by Faux
|
Message
| 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:
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")>4) then
AppendToNotepad("%1","[%2]:\\t %3" .. '\\r\\n')
else
AppendToNotepad("%1","[%2]:\\t\\t %3" .. '\\r\\n')
end</send>
</trigger>
</triggers>
|
Faux, from Discworld. Feel free to come talk to me =)
http://faux.servebeer.com/ | 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.
28,099 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
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.