items_control.txt and Mercenary Scrolls

This place is for Closed bug reports only. NOT for asking help!

Moderators: Moderators, Developers

kitoy
Noob
Noob
Posts: 4
Joined: 17 Jun 2010, 04:46
Noob?: Yes

items_control.txt and Mercenary Scrolls

#1 Post by kitoy »

Hi All,

I've been trying ways to use a bot and mercenary scroll and autostorage but I'm out of ideas. Every time my bot autostore items due to arrows lower than 100, the merce scroll creates problems. I tried using the items_control.txt with the code:

Code: Select all

Bowman Scroll 4 5 0 0
But I think this will not work as openkore interprets the "4" as the minimum and not the 5. I checked the items.txt and the scroll is already there as:

Code: Select all

12156#Bowman_Scroll_4#
Is there any way to use the ItemID instead of the ItemName on items_control.txt? I've been looking for examples but found none so far.
h4rry84
Moderators
Moderators
Posts: 234
Joined: 04 Apr 2008, 09:30
Noob?: Yes
Location: My House

Re: items_control.txt and Mercenary Scrolls

#2 Post by h4rry84 »

you could have simply edit the items.txt to the other name example 12156#BowScroll4#
kitoy
Noob
Noob
Posts: 4
Joined: 17 Jun 2010, 04:46
Noob?: Yes

Re: items_control.txt and Mercenary Scrolls

#3 Post by kitoy »

Yes its now working. Thanks :D
Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: items_control.txt and Mercenary Scrolls

#4 Post by Technology »

Maybe kore should also accept the name_with_underscores notation?
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!
User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: items_control.txt and Mercenary Scrolls

#5 Post by kLabMouse »

Technology wrote:Maybe kore should also accept the name_with_underscores notation?
Or may-be name in "..." or '...' like: "Bowman Scroll 4"
kitoy
Noob
Noob
Posts: 4
Joined: 17 Jun 2010, 04:46
Noob?: Yes

Re: items_control.txt and Mercenary Scrolls

#6 Post by kitoy »

or itemID?
EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: items_control.txt and Mercenary Scrolls

#7 Post by EternalHarvest »

It doesn't accept item IDs?
obietobi
Noob
Noob
Posts: 13
Joined: 16 Mar 2010, 11:48
Noob?: Yes

Re: items_control.txt and Mercenary Scrolls

#8 Post by obietobi »

right this..

Bowman Scroll4 0 0 0

Scroll and 4 without space
sampah001
Noob
Noob
Posts: 3
Joined: 29 Jun 2009, 10:27
Noob?: Yes

Re: items_control.txt and Mercenary Scrolls

#9 Post by sampah001 »

kLabMouse wrote:
Technology wrote:Maybe kore should also accept the name_with_underscores notation?
Or may-be name in "..." or '...' like: "Bowman Scroll 4"
how about using "itemname"
like this

Code: Select all

"Bowman Scroll 4" 5 0 0
change on script src/FileParsers.pm

Code: Select all

($key, $args) = lc($line) =~ /([\s\S]+?)[\s]+(\d+[\s\S]*)/;
change to

Code: Select all

if ($line =~ /"/) {
	($key, $args_text) = $line =~ /^"([\s\S]+?)" (\d+[\s\S]*)/i;
}
else {
	($key, $args_text) = $line =~ /^([\s\S]+?) (\d+[\s\S]*)/i;
}
FileParsers.pm

Code: Select all

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 =~ /"/) {
			($key, $args_text) = $line =~ /^"([\s\S]+?)" (\d+[\s\S]*)/i;
		}
		else {
			($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;
}
User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: items_control.txt and Mercenary Scrolls

#10 Post by kLabMouse »

Nice!. But this also need Input filter at first place, so any \" in item names are replaced with \'
that will guarantee that \" will indicate sentence start and end.