PDA

View Full Version : Armor quest script


EliteSting
07-25-2007, 09:32 PM
Ok , I'm a newbie at Perl , but I'm slowly figuring it out. This quest script is for a PC to hand in an armor pattern , and get in return an armor piece based on what class they are. The quest text works , but when I hand a pattern in it doesn't give me anything in return. Would anyone please tell me what I'm doing wrong ? Thank you !

sub EVENT_SAY
{ if($text=~/Hail/i){quest::say("Hello hello, traveler. What brings you here, into this horrible place, the god's are kind to you ! Are you lost ? Perhaps you came by to [assist] me ?"); } if($text=~/assist/i){quest::say("Well, it would certainly help me. See I'm trying to become a worthwhile armor smith , but without the [cooperation from the god's] it's just not possible."); }
if($text=~/cooperation from the god's/i){quest::say("Long time ago, this place used to be peaceful, until the god's came and [vanquished] almost all of it.");} if($text=~/vanquished/i){quest::say("Havent you heard the story ? Well I'm not going to bother you with that [tale], perhaps some other time I will tell you.");}
if($text=~/tale/i){quest::say("Well ... no I shouldn't. What you could do for me is bring back to me [ornate armor patterns] so that I may practice my trade. .");}
if($text=~/ornate armor patterns/i){quest::say("That would be most helpful. However , these patterns are [not easy to come by].");}
if($text=~/not easy to come by/i){quest::say("Must you repeat everything I say? Are you daft of mind? Were you dropped as a child? No more questions! Now go forth , and bring me those patterns!");}
}

sub EVENT_ITEM
{
if ($itemcount{16290})
{
if ($class == 'Shaman'); quest::summonitem(9829); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Ranger'); quest::summonitem(9820); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Rogue'); quest::summonitem(9805); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
}
{
if ($itemcount{16291})
{
if ($class == 'Shaman'); quest::summonitem(15773); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Ranger'); quest::summonitem(15764); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Rogue'); quest::summonitem(15474); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
}
{
if ($itemcount{16292})
{
if ($class == 'Shaman'); quest::summonitem(11518); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Ranger'); quest::summonitem(11446); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Rogue'); quest::summonitem(11431); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
}
{
if ($itemcount{16293})
{
if ($class == 'Shaman'); quest::summonitem(11273); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Ranger'); quest::summonitem(11180); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Rogue'); quest::summonitem(11140); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
}
{
if ($itemcount{16294})
{
if ($class == 'Shaman'); quest::summonitem(13569); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Ranger'); quest::summonitem(12666); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Rogue'); quest::summonitem(12597); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
}
{
if ($itemcount{16295})
{
if ($class == 'Shaman'); quest::summonitem(16801); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Ranger'); quest::summonitem(16775); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Rogue'); quest::summonitem(16711); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
}
{
if ($itemcount{16296})
{
if ($class == 'Shaman'); quest::summonitem(20077); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Ranger'); quest::summonitem(19837); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Rogue'); quest::summonitem(19442); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
}
{
if ($itemcount{16347})
{
if ($class == 'Monk'); quest::summonitem(9808); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Beastlord'); quest::summonitem(9823); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Druid'); quest::summonitem(9832); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
{
if ($class == 'Berzerker'); quest::summonitem(55505); quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");}
}
}

Blakine
07-26-2007, 02:45 AM
Try enclosing the item to be summoned in double quotes, for example:

quest::summonitem("15773");

sfisque
07-26-2007, 02:51 AM
if in doubt, always run your quest script against the PERL interpreter natively from command line. if it exits quietly, the quest at least is syntactically correct.

if you get output like, say:

sfisque@cthulhu:~/lab$ perl quest.pl
syntax error at quest.pl line 13, near ");"
syntax error at quest.pl line 15, near ");"
syntax error at quest.pl line 17, near ");"
syntax error at quest.pl line 22, near ");"
syntax error at quest.pl line 24, near ");"
syntax error at quest.pl line 26, near ");"
syntax error at quest.pl line 31, near ");"
syntax error at quest.pl line 33, near ");"
syntax error at quest.pl line 35, near ");"
syntax error at quest.pl line 40, near ");"
quest.pl has too many errors.

then you need to fix the script first.

== sfisque

ps: free hint, double check your IF syntax

Blakine
07-26-2007, 03:04 AM
Excellent tip sfisque, thanks!

EliteSting
07-26-2007, 07:44 AM
Awsome ! Thanks for the info !

Striat
07-26-2007, 09:09 AM
You could write it this way using your syntax to fix it:

*NOTE -- I've omitted sub EVENT_SAY for thread length reasons


sub EVENT_ITEM {
if ($itemcount{16290}) {
if ($class == 'Shaman') {
quest::summonitem(9829);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Ranger') {
quest::summonitem(9820);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Rogue') {
quest::summonitem(9805);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
}

if ($itemcount{16291}) {
if ($class == 'Shaman') {
quest::summonitem(15773);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}

if ($class == 'Ranger') {
quest::summonitem(15764);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Rogue') {
quest::summonitem(15474);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
}
if ($itemcount{16292}) {
if ($class == 'Shaman') {
quest::summonitem(11518);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Ranger') {
quest::summonitem(11446);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Rogue') {
quest::summonitem(11431);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
}
if ($itemcount{16293}) {
if ($class == 'Shaman') {
quest::summonitem(11273);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Ranger') {
quest::summonitem(11180);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Rogue') {
quest::summonitem(11140);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
}
if ($itemcount{16294}) {
if ($class == 'Shaman') {
quest::summonitem(13569);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Ranger') {
quest::summonitem(12666);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Rogue') {
quest::summonitem(12597);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
}
if ($itemcount{16295}) {
if ($class == 'Shaman') {
quest::summonitem(16801);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Ranger') {
quest::summonitem(16775);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Rogue') {
quest::summonitem(16711);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
}
if ($itemcount{16296}) {
if ($class == 'Shaman') {
quest::summonitem(20077);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Ranger') {
quest::summonitem(19837);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Rogue') {
quest::summonitem(19442);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
}
if ($itemcount{16347}) {
if ($class == 'Monk') {
quest::summonitem(9808);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Beastlord') {
quest::summonitem(9823);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Druid') {
quest::summonitem(9832);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
if ($class == 'Berserker') {
quest::summonitem(55505);
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
}
}

While that would work, I strongly recommend the following script:


sub EVENT_ITEM {
if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
if (plugin::check_handin(\%itemcount, 16290 => 1)) {
my %rewards = (
"Shaman" => 9829, "Ranger" => 9820, "Rogue" => 9805
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
else {
plugin::return_items(\%itemcount);
quest::say("I did not ask for this from you, $name.");
}
}
}
if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
if (plugin::check_handin(\%itemcount, 16291 => 1)) {
my %rewards = (
"Shaman" => 15773, "Ranger" => 15764, "Rogue" => 15474
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
else {
plugin::return_items(\%itemcount);
quest::say("I did not ask for this from you, $name.");
}
}
}

if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
if (plugin::check_handin(\%itemcount, 16292 => 1)) {
my %rewards = (
"Shaman" => 11518, "Ranger" => 11446, "Rogue" => 11431
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
else {
plugin::return_items(\%itemcount);
quest::say("I did not ask for this from you, $name.");
}
}
}

if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
if (plugin::check_handin(\%itemcount, 16293 => 1)) {
my %rewards = (
"Shaman" => 11273, "Ranger" => 11180, "Rogue" => 11140
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
else {
quest::summonitem(16293);
quest::say("I did not ask for this from you, $name.");
}
}
}
if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
if (plugin::check_handin(\%itemcount, 16294 => 1)) {
my %rewards = (
"Shaman" => 13569, "Ranger" => 12666, "Rogue" => 12597
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
else {
quest::summonitem(16294);
quest::say("I did not ask for this from you, $name.");
}
}
}

if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
if (plugin::check_handin(\%itemcount, 16295 => 1)) {
my %rewards = (
"Shaman" => 16801, "Ranger" => 16775, "Rogue" => 16711
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
else {
quest::summonitem(16295);
quest::say("I did not ask for this from you, $name.");
}
}
}

if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
if (plugin::check_handin(\%itemcount, 16296 => 1)) {
my %rewards = (
"Shaman" => 20077, "Ranger" => 19837, "Rogue" => 19442
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
else {
quest::summonitem(16296);
quest::say("I did not ask for this from you, $name.");
}
}
}

if ($class == 'Monk' || $class == 'Beastlord' || $class == 'Druid' || $class == 'Berserker') {
if (plugin::check_handin(\%itemcount, 16347 => 1)) {
my %rewards = (
"Monk" => 9808, "Beastlord" => 9823, "Druid" => 9832, "Berserker" => 55505
);

if(defined($rewards{$class})) {
quest::summonitem($rewards{$class});
quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
}
else {
quest::say("I did not ask for this from you, $name.");
quest::summonitem(16347);
}
}
}
plugin::return_items(\%itemcount);
}

Now, you could still do some clean up with this script and make the return_items at the end a little prettier. However, it does its job: Accepts turn ins from the appropriate class only. Otherwise, items are returned. Furthermore, inappropriate items are returned everytime.

EliteSting
07-27-2007, 04:55 AM
wow yeah thats alot better then mine , thanks !~