Quote:
Originally Posted by Aramid
Using the SAME item each time for each level seems to confuse the program.
|
That's because plugin::check_handin removes the items from the
%itemcount array. I believe this is why it only gets through the first check in the second set of code in the first post.
Then again, there looks to be a syntax error in the 1st set of code, which should do what you're trying to do:
Code:
if (plugin::check_handin(\%itemcount, 2835=>4) {
should be
Code:
if (plugin::check_handin(\%itemcount, 2835=>4)) {
Quote:
Originally Posted by Aramid
If there is a way to clear the items after handing them in and setting the new setglobal, before the next if statememt, then it may work.
|
I think this would do the trick:
Code:
sub EVENT_ITEM {
if ($itemcount{2835} == 4 && $qglobals{max_level} == undef) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 71, 5, "F");
quest::level(71);
$itemcount{2835} = undef;
}
if ($itemcount{2835} == 4 && $qglobals{max_level} == 71) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
$client->Message(6, "Maximus Serilious rewards you with a new level!" );
quest::exp(9999999);
quest::setglobal("max_level", 72, 5, "F");
quest::level(72);
$itemcount{2835} = undef;
}
Etc...
Etc...
Etc...
}
Something else you could do to really trim the code down:
Code:
sub EVENT_ITEM {
if (plugin::check_handin(\%itemcount, 2835 => 4)) {
quest::say("These are in excellent shape! They will be trophies in my collection!");
quest::exp(9999999);
if ($qglobals{max_level} == undef) {
quest::setglobal("max_level", 71, 0, "F");
quest::level(71);
} elsif ($qglobals{max_level} >= 75) {
plugin::return_items(%itemcount);
} else {
quest::setglobal("max_level", $qglobals{max_level}++, 0, "F"
quest::level($qglobals{max_level})
}
} else {plugin::return_items(%itemcount);}
}