View Single Post
  #1  
Old 10-15-2011, 01:36 PM
LordAdakos
Sarnak
 
Join Date: Dec 2007
Posts: 60
Default itemchecking difficulties

here's my custom pet summoning code. the problem is, if you hand the guy the gem he requests, he summons your pet, and then attempts to hand the gem back to you. However, if you hand him the wrong gem at the wrong level, he doesn't summon a pet and _STILL_ doesn't return the gem.

What am I doing wrong?

Code:
sub EVENT_SAY {
my $test = quest::saylink ("test",1);



if ($text =~/Hail/i)
{ 
quest::say("Hey, $name. I think I figured out how to enslave creatures to do my bidding, just like an enchanter. I need some help, would you be willing to [$test] it for me...? "); 
}


if(($text=~/test/i) && ($ulevel<8))
{
quest::say("I'm sorry, you are much too inexperienced to command such a servant. Come back when you are more experienced!");
}

if(($text=~/test/i) && ($ulevel>=8) && ($ulevel<16))
{
quest::say("I can attempt to create a servant for you, but it will require one piece of amber.");
}

if(($text=~/test/i) && ($ulevel>=16) && ($ulevel<23))
{
quest::say("I can attempt to create a servant for you, but it will require one peridot.");
}
if(($text=~/test/i) && ($ulevel>=23) && ($ulevel<30))
{
quest::say("I can attempt to create a servant for you, but it will require one fire opal.");
}
if(($text=~/test/i) && ($ulevel>=30) && ($ulevel<37))
{
quest::say("I can attempt to create a servant for you, but it will require one fire emerald.");
}
if(($text=~/test/i) && ($ulevel>=37) && ($ulevel<44))
{
quest::say("I can attempt to create a servant for you, but it will require one sapphire.");
}
if(($text=~/test/i) && ($ulevel>=44) && ($ulevel<51))
{
quest::say("I can attempt to create a servant for you, but it will require one ruby.");
}
if(($text=~/test/i) && ($ulevel>51))
{
quest::say("I can attempt to create a servant for you, but it will require one diamond...");
if($ulevel>=55){plugin::Whisper("Pssttt. Rumor has it that there may be a way to use a BLUE Diamond...");
}

}

 

}

sub EVENT_ITEM
{
#Hand in event AMBER & level check
if  ((plugin::check_handin(\%itemcount, 10022 => 1)) && ($ulevel>=8))
{
quest::say("Ah, $name, this is perfect! thanks.. now let me get to work");
quest::emote("cups the gem in his hands as he begins to chant...");
plugin::Whisper("There you go, $name. I think that's what you wanted, right? If not, You can dismiss that one and try again with another gem, Come back when you are a more experienced for a more powerful companion!");
quest::selfcast(quest::ChooseRandom(315,316,317)); #r2
}
#Hand in event PERIDOT & level check

if  ((plugin::check_handin(\%itemcount, 10028 => 1)) && ($ulevel>=16))
{
quest::say("Ah, $name, this is perfect! thanks.. now let me get to work");
quest::emote("cups the gem in his hands as he begins to chant...");
plugin::Whisper("There you go, $name. I think that's what you wanted, right? If not, You can dismiss that one and try again with another gem, Come back when you are a more experienced for a more powerful companion!");
quest::selfcast(quest::ChooseRandom(397,398,399,400)); #r3
}
#Hand in event fire opal & level check

if  ((plugin::check_handin(\%itemcount, 10031 => 1)) && ($ulevel>=23))
{
quest::say("Ah, $name, this is perfect! thanks.. now let me get to work");
quest::emote("cups the gem in his hands as he begins to chant...");
plugin::Whisper("There you go, $name. I think that's what you wanted, right? If not, You can dismiss that one and try again with another gem, Come back when you are a more experienced for a more powerful companion!");
quest::selfcast(quest::ChooseRandom(396,396)); #r5
}
#Hand in event fire emerald & level check

if  ((plugin::check_handin(\%itemcount, 10033 => 1)) && ($ulevel>=30))
{
quest::say("Ah, $name, this is perfect! thanks.. now let me get to work");
quest::emote("cups the gem in his hands as he begins to chant...");
plugin::Whisper("There you go, $name. I think that's what you wanted, right? If not, You can dismiss that one and try again with another gem, Come back when you are a more experienced for a more powerful companion!");
quest::selfcast(quest::ChooseRandom(570,571,572)); #r7
}
#Hand in event sapphire & level check

if  ((plugin::check_handin(\%itemcount, 10034 => 1)) && ($ulevel>=37))
{
quest::say("Ah, $name, this is perfect! thanks.. now let me get to work");
quest::emote("cups the gem in his hands as he begins to chant...");
plugin::Whisper("There you go, $name. I think that's what you wanted, right? If not, You can dismiss that one and try again with another gem, Come back when you are a more experienced for a more powerful companion!");
quest::selfcast(quest::ChooseRandom(573,574,575,576)); #r8
}
#Hand in event ruby & level check

if  ((plugin::check_handin(\%itemcount, 10035 => 1)) && ($ulevel>=44))
{
quest::say("Ah, $name, this is perfect! thanks.. now let me get to work");
quest::emote("cups the gem in his hands as he begins to chant...");
plugin::Whisper("There you go, $name. I think that's what you wanted, right? If not, You can dismiss that one and try again with another gem, Come back when you are a more experienced for a more powerful companion!");
quest::selfcast(quest::ChooseRandom(8184,8185)); #r9
}
#Hand in event diamond & level check

if ((plugin::check_handin(\%itemcount, 10037 => 1)) && ($ulevel>=51))
{
quest::say("Ah, $name, this is perfect! thanks.. now let me get to work");
quest::emote("cups the gem in his hands as he begins to chant...");
plugin::Whisper("There you go, $name. I think that's what you wanted, right? If not, You can dismiss that one and try again with another gem, Come back when you are a more experienced for a more powerful companion!");
quest::selfcast(quest::ChooseRandom(628,629,630,631)); #r11
}
#Hand in event blue diamond & level check

if  ((plugin::check_handin(\%itemcount, 22503 => 1)) && ($ulevel>=55))
{
quest::say("Ah, $name, this is perfect! thanks.. now let me get to work");
quest::emote("cups the gem in his hands as he begins to chant...");
plugin::Whisper("There you go, $name. I think that's what you wanted, right? If not, You can dismiss that one and try again with another gem. You have reached the most powerful companion I can summon.");
quest::selfcast(quest::ChooseRandom(632,633,634,635)); #r12
}

else {
quest::say("What Am I suppsoed to do with this...thing? This isn't what I need at all. Take it back!");
plugin::return_items(\%itemcount);
}


}
Reply With Quote