i never see any item names with \"
some item names use \'
i think it will be no problem if we use \" to indicate item sentence start and end
items_control.txt and Mercenary Scrolls
Moderators: Moderators, Developers
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: items_control.txt and Mercenary Scrolls
So you just want to switch from one unusable in configuration character to another and not to solve the problem. Why not use something like Text::Balanced::extract_quotelike which supports escaped delimiters and other stuff?
Re: items_control.txt and Mercenary Scrolls
how about this?
Code: Select all
use Text::Balanced qw(extract_quotelike);
...
sub parseItemsControl {
my $file = shift;
my $r_hash = shift;
undef %{$r_hash};
my ($key, $args_text, %cache);
my $reader = new Utils::TextReader($file);
while (!$reader->eof()) {
my $line = $reader->readLine();
$line =~ s/\x{FEFF}//g;
next if ($line =~ /^#/);
$line =~ s/[\r\n]//g;
$line =~ s/\s+$//g;
if ($line =~ tr/"// eq 2) {
$key = extract_quotelike($line);
$args_text = $line;
$args_text =~ s/$key//gs;
$args_text =~ s/^\s//gs;
$key =~ s/"//g;
}
else {
$line =~ s/"//g;
($key, $args_text) = $line =~ /^([\s\S]+?) (\d+[\s\S]*)/i;
}
next if ($key eq "");
if ($cache{$args_text}) {
$r_hash->{$key} = $cache{$args_text};
} else {
my @args = split / /, $args_text;
my %item = (
keep => $args[0],
storage => $args[1],
sell => $args[2],
cart_add => $args[3],
cart_get => $args[4]
);
# Cache similar entries to save memory.
$r_hash->{$key} = $cache{$args_text} = \%item;
}
}
return 1;
}
...
Re: items_control.txt and Mercenary Scrolls
Patch accepted.
moved to Fixed bug's.
moved to Fixed bug's.
Re: items_control.txt and Mercenary Scrolls
Unfortunately, a new bug emerges after this fix.
Seems like all items in items_control.txt that has spaces, has to be put inside quotation marks.
Should it be this way from now on?
Seems like all items in items_control.txt that has spaces, has to be put inside quotation marks.
Should it be this way from now on?
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: items_control.txt and Mercenary Scrolls
That was fixed in r7519.
Seems like item IDs are not supported here, but that's independent issue.
Seems like item IDs are not supported here, but that's independent issue.