Running Unformat
From AdamWiki
Running Unformat is simple. You can run it from the command line (your shell in UNIX or Linux or even Mac OS/X, or a DOS Command prompt in Windows). More useful, you can run it from TinyFugue or another mush client that supports file-quoting through a command filter.
Contents |
Running from the Command Line
Assuming you named the script unformat.pl and placed the script in a directory that is in your PATH, you should be able to enter unformat.pl <inputfile >outputfile. That means, "run Unformat and read inputfile, unformat it, and write it out to outputfile. If you leave off ">outputfile", Unformat will spew the output to your terminal. If you leave off "<inputfile", Unformat will prompt you to type in some code.
Theoretically, you can type unformat.pl inputfile (without the < character) and it should work. I seem to remember there's a bug I need to fix there, though, so stick with the earlier syntax.
You can unformat multiple files at a time, too, using the cat command. Enter cat file1 file2 file3 | unformat.pl >outputfile to create a new file called outputfile that contains the unformatted versions of file1, file2, and file3 (in that order). You can use wildcards, too. Try cat *.mush | unformat.pl | wc -l (that last character is a lower-case L) to unformat all files ending in ".mush" and count the total number of lines.
Generally, if you run Unformat from the command line, you'll save the output in an output file and then load that into your game somehow.
Running from TinyFugue
TinyFugue (TF) has a /quote command that will load the contents of a file into the game. You could @decompile an object and log it all to a file, then /quote the file back to recreate the object. By default, /quote assumes you're loading a file that contains commands that are all ready to be run by the game. Its basic syntax is /quote filename.
If you have a file containing formatted code, it won't run properly on the game that way. You need to unformat it first. Luckily, /quote supports "filters" using the ! character. The syntax is /quote !filter filename. In this case, our filter is unformat.pl.
By default, /quote will load one line per second. That's agonizing slow for most coders, so you'll want to add -0 (zero) to reduce the wait. Also, the -w option is useful; it tells TF to send all the file to the world you started in, even if you switch worlds while you wait for it to load. Otherwise, it'd switch worlds with you and your code would get split over two places.
The easiest way to use Unformat with TF is to create a macro (a new command) called /upload so that you can type /upload filename and it will run Unformat on filename and load it quickly into your current world. Add this command to your .tfrc or tiny.defs or whatever:
/def upload=/quote -0 -w !unformat.pl %*
Running from Other Clients
I don't know. MUSHclient already supports basic unformatting, so you probably don't need Unformat unless you want its advanced features. SimpleMU does not (yet) support unformatting.
File Tips
Naming Conventions
I strongly suggest you adopt a naming convention for your softcode files. If you have formatted softcode, give them each a name ending in .mush or .mux or something. If you store UNformatted softcode, give them each a name ending in .txt or .unf or something. As long as you're consistent, you won't have troubles.
Version Control
I also strongly suggest using a version control system to manage your softcode files. It only takes a few extra seconds to handle checkout and checkin, and you gain a number of useful benefits:
- backups of every version of your code — you can revert to an older version if you screw up or delete something
- easy to share code with other coders
- keeps a history of all of your changes; you can compare different revisions
Firan uses CVS for version control. It is Free Software.RCS is also Free Software but I like CVS better. Commercial revision control systems include Microsoft's Visual SourceSafe and also Version Manager (previously PVCS) from Serene (née Merant).
