View Single Post
  #7  
Old 06-27-2008, 04:00 PM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default

Quote:
Originally Posted by ccody1025 View Post
Hey Trev, Tried out this code tonight, making a server for me and a few friends to play on...I know the code works on your server, cause i have multiple toons 70+ on there, and never had any trouble. I tried editing the code to add in my own stuff, gear rewards and whatnot, but the guy just eats the turn ins. I am using Prathun in gloomingdeep as my armor guy. Here is a snippet of the code...


Code:
sub EVENT_ITEM {
if ($class == 'Warrior' || $class == 'Rogue' || $class == 'Monk' || $class == 'Berserker' || $class == 'Shadowkight' || $class == 'Paladin' || $class == 'Ranger' || $class == 'Bard' || $class == 'Beastlord' || $class == 'Cleric' || $class == 'Druid' || $class == 'Shaman' || $class == 'Wizard' || $class == 'Mage' || $class == 'Enchanter' || $class == 'Necromancer') {
  if (plugin::check_handin(\%itemcount, 1319 => 1)) {
    my $rewards = (
"Warrior" => 31084, "Rogue" => 31028, "Monk" => 24440, "Berserker" => 55317, "Shadowknight" => 44113, "Paladin" => 31119, "Ranger" => 25363, "Bard" => 31133, "Beastlord" => 5353, "Cleric" => 31042, "Druid" => 31147, "Shaman" => 31105, "Wizard" => 25405, "Mage" => 25419, "Enchanter" => 25426, "Necromancer" => 31063
    );

    if(defined($rewards{$class})) {
      quest::summonitem($rewards{$class});
      quest::emote("Works to make a piece of armor from the instructions you provided to him." );
      quest::say ("Here you go $name.");
    }
}
Any advice ya can give would be greatly appreciated.
couple things...some is just semantics...

Code:
$class == 'Shadowknight'
should really be
Code:
$class eq "Shadowknight"
Perl is nice and lets you get away with it, but the top one is an array of characters, while the bottom one is a string. Most of the time it won't matter as long as you do consistent types of conditionals along the way, but sometimes it does matter.

Next, you must use

Code:
my %rewards = ( "blah" => blah );
$rewards is scalar context, and using it this way will basically give you the count of the items in the array.

Just looking at your code though, if the above was % to start with, I don't see anything that sticks out as a problem and I'm not anywhere where I can test it right now. But you should stick this:

Code:
else {
 	    plugin::return_items(\%itemcount);
    	quest::say("I have no use for this item, $name.  Take it back.");
	}
at the bottom of any of your sub EVENT_ITEM subroutines for any quest to keep them from eating items they were not meant to be given.

I would check your quest logs to see if they are any help. Try putting some debugging print steps in there to help you narrow down the issue. If you still haven't resolved it later I'll try it on my server.
Reply With Quote