|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Fri Nov 19, 2010 1:45 am
Reading a text file |
Hey guys,
I want to test a script that I am writing and want read in a log file from the mud which contained has room names and room descriptions. I know the #READ command can read in the file as I typed it, but I want to read in the file like it is data displayed from the mud. How do I do that? I haven't played with files like this before. |
|
_________________ Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian) |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Nov 19, 2010 1:51 am |
I think there's a command for that (Zugg does this sort of thing all the time when bughunting), but it might not be documented. Beyond that, you can use a combination of %read() and #SAY/#ECHO/#SHOW (unlike #PRINT, these commands' output can be triggered on).
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Fri Nov 19, 2010 1:59 am |
#DEBUGFILE will create two files according to the names you specify. The raw-file should do what you want if I remember correctly.
|
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Nov 19, 2010 1:33 pm |
If you just want to use the log to create rooms in the mapper, I believe there is an option somewhere in the mapper window to do that.
|
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Fri Nov 19, 2010 3:11 pm |
Rahab wrote: |
If you just want to use the log to create rooms in the mapper, I believe there is an option somewhere in the mapper window to do that. |
Thanks Rahab, but that isn't what I need the command for. I information I am reading from the log is helping me create a color system for Armaggedon. I don't want to test online so I figure I'd create a log and then I can test the color scripts of line to see if they work. |
|
_________________ Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian) |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Fri Nov 19, 2010 5:21 pm |
Fizgar wrote: |
#DEBUGFILE will create two files according to the names you specify. The raw-file should do what you want if I remember correctly. |
I used the #DEBUGFILE to create the two output files according to the documentation, but when I tried to read the raw-file it would only read a little of the file and it even didn't send it to the window like it was coming from the mud.
Anybody else? Zugg how the heck do you do that? |
|
_________________ Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian) |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Fri Nov 19, 2010 5:25 pm |
darmir wrote: |
Fizgar wrote: |
#DEBUGFILE will create two files according to the names you specify. The raw-file should do what you want if I remember correctly. |
I used the #DEBUGFILE to create the two output files according to the documentation, but when I tried to read the raw-file it would only read a little of the file and it even didn't send it to the window like it was coming from the mud.
Anybody else? Zugg how the heck do you do that? |
Nevermind I figured it out. I wasn't putting the word raw after the file name when using the read command. |
|
_________________ Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Nov 19, 2010 5:40 pm |
There are two undocumented arguments for the #READ command:
"raw": Takes the entire file and stuffs it into the network buffer as if it was all received in a single packet. This can be used with the raw file generated via #DEBUGFILE, or with any other plain text file. However, since it treats the file as a single network packet, it doesn't work for reproducing packet boundary issues.
"debug": Takes the non-raw text file generated from #DEBUGFILE and replays it. Each packet is properly handled, as is any commands sent to the server. This option requires the specific log file format used by #DEBUGFILE with the in/out lines, etc. Strings like are replaced with their actual control code values.
These two options should only be used for debugging purposes and not used in production scripts. |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Fri Nov 19, 2010 5:54 pm |
Zugg wrote: |
There are two undocumented arguments for the #READ command:
"raw": Takes the entire file and stuffs it into the network buffer as if it was all received in a single packet. This can be used with the raw file generated via #DEBUGFILE, or with any other plain text file. However, since it treats the file as a single network packet, it doesn't work for reproducing packet boundary issues.
"debug": Takes the non-raw text file generated from #DEBUGFILE and replays it. Each packet is properly handled, as is any commands sent to the server. This option requires the specific log file format used by #DEBUGFILE with the in/out lines, etc. Strings like <ESC> are replaced with their actual control code values.
These two options should only be used for debugging purposes and not used in production scripts. |
Thanks Zugg. I figured out the raw argument but didn't see anything about the debug argument. Do you have a suggestion on how to read only part of the file in upto a certain line number? |
|
_________________ Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Nov 19, 2010 6:32 pm |
Nope, sorry. You'll need to load it into another editor like Notepad and get rid of the stuff you don't want.
|
|
|
|
|
|