[ Disclaimer, Create new user --- Wiki markup help, Install P99 ]
Difference between revisions of "Magelo Blue:Wiggon"
From Project 1999 Wiki
m |
m |
||
| Line 57: | Line 57: | ||
== Perl code == | == Perl code == | ||
| + | |||
| + | On Microsoft Windows I recommend http://strawberryperl.com/ | ||
I wrote a quick perl script to take the result of /outputfile inventory c:\temp\inventory.txt and dump out text that can be dumped into here. | I wrote a quick perl script to take the result of /outputfile inventory c:\temp\inventory.txt and dump out text that can be dumped into here. | ||
| − | It only does your equipped items, nothing in inventory. | + | It only does your equipped items, nothing in inventory. Copy and paste the below text into a file, like magelo.pl and then run it: |
<code>magelo.pl --input wiggon_inventory.pl</code> | <code>magelo.pl --input wiggon_inventory.pl</code> | ||
| Line 108: | Line 110: | ||
close $input_fh or croak qq{ERROR: $OS_ERROR}; | close $input_fh or croak qq{ERROR: $OS_ERROR}; | ||
</pre> | </pre> | ||
| + | |||
| + | Copy and paste the output into your Magelo wiki page in place of the equipped items area. | ||
Questions or comments, pm greppy on the forums. | Questions or comments, pm greppy on the forums. | ||
Revision as of 01:45, 8 September 2012
[edit] Extra
Thanks to Stagnasis for the Gem-Encrusted Scepter!
[edit] Perl code
On Microsoft Windows I recommend http://strawberryperl.com/
I wrote a quick perl script to take the result of /outputfile inventory c:\temp\inventory.txt and dump out text that can be dumped into here.
It only does your equipped items, nothing in inventory. Copy and paste the below text into a file, like magelo.pl and then run it:
magelo.pl --input wiggon_inventory.pl
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use English qw( -no_match_vars );
use Carp;
my $input_file;
my %seen;
my $options_ok = GetOptions(
'input=s' => \$input_file,
);
open my $input_fh, '<', $input_file or croak qq{ERROR: $OS_ERROR};
while ( my $line = <$input_fh> ) {
chomp $line;
my ( $location, $name, $id, $count, $slots ) = split /\t/, $line;
next if $location =~ m{\A(General|(Shared)?Bank|Location)}xms;
# add an s and a number to multislots
if ( $location =~ m{\A(Ear|Wrist|Finger)}xms ) {
if ( not defined $seen{$location} ) {
$seen{$location} = 1;
$location = qq{$location}.q{s1};
}
elsif ( $seen{$location} == 1 ) {
$location = qq{$location}.q{s2};
}
}
$location =~ s{ss}{s}g; # otherwise we have "Fingerss1"
$name =~ s{Empty}{}; # remove the "Empty" text.
print qq{* $location: $name\n};
};
close $input_fh or croak qq{ERROR: $OS_ERROR};
Copy and paste the output into your Magelo wiki page in place of the equipped items area.
Questions or comments, pm greppy on the forums.




