|
128 Bit Converters [by T-Rex] |
|
|
|
Posted Wednesday, August 12th @ 11:23:20 PM, by George Greer in the Utils dept.
Added May 30, 1997. Click the link below to read it or download it.
From: Søren Peter Skou <serces@mud.dk>
Subject: 128 bits converter perl scripts
Hi all.. Just thought I'd share this with you, a converter for the 128
bits.. mob/wld/obj files, It *SHOULD* work, but just in case, take a
backup.. (And no, I'm not responsible for any errors this may do to
your world files!)
I only encountered one error with this one, and it was pretty easy to
fix.
It is for perl on a linux, so :)
------------ mobfilt -----
#!/usr/bin/perl -i
# Usage : ./mobfilt #.mob
$lastt = 0;
while (<>) {
chop;
if ($lastt && /^([0-9A-Za-z]+) ([0-9A-Za-z]+) (-?\d+)
([A-Za-z]+)\s*$/)
{
print $1, " 0 0 0 ", $2, " 0 0 0 ", $3, " ", $4, "\n";
}
else
{
if (/~$/) {
$lastt = 1;
} else {
$lastt = 0;
}
print;
print "\n";
}
}
------------wldfilt
#!/usr/bin/perl -i
# Usage : ./wldfilt #.wld
$found = 0;
while (<>)
{
chop;
if (!$found && /^(-?[0-9A-Za-z]+) (-?[0-9A-Za-z]+)
(-?[0-9A-Za-z]+)\s*$/)
{
print $1, " ", $2, " 0 0 0 ", $3, " \n";
$found = 1;
}
else
{
if (/^#/)
{
$found = 0;
}
print;
print "\n";
}
}
---------objfilt
#!/usr/bin/perl -i
# Usage : ./objfilt
$lastt = 0;
while (<>) {
chop;
if ($lastt && /^([0-9A-Za-z]+) ([0-9A-Za-z]+)
([0-9A-Za-z]+)\s*$/)
{
print $1, " ", $2, " 0 0 0 ", $3, " 0 0 0\n";
}
else
{
if (/~$/) {
$lastt = 1;
} else {
$lastt = 0;
}
print;
print "\n";
}
}
-------- End snip!
That should do it..
/T-Rex is outta here..
<< 128 Bitvector code [by Niese-Petersen] | Reply | View as text | Threaded | 128 Bit Converters (again) [by The Count] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|