PDA

View Full Version : Perl quest problem


moydock
05-07-2006, 05:56 PM
I am learning a lot about perl quests but I seem to be stuck on making multiple items turn in for a reward. Does anyone see something wrong with this coding? When I turn in these 4 items I get no response from the npc.


sub EVENT_ITEM
{
if(
($itemcount{5018} ==1) &&
($itemcount{5019} ==1) &&
($itemcount{5020} ==1) &&
($itemcount{1179} ==1)
)
{
quest::summonitem(5021);
}
}

RangerDown
05-08-2006, 03:06 PM
Are those really & 's or did something about your paste or the forum mangle those?

saladbowl1
05-08-2006, 05:11 PM
something along these lines


sub EVENT_ITEM {
if($item1=="5018" && $item2=="5019" && $item3=="5020" && $item4=="1179"){
quest::summonitem(5021);}
}

with the code above they'll have to turn them in in order...

sub EVENT_ITEM {
if($itemcount{5018} == 1);
($itemcount{5019} == 1);
($itemcount{5020} == 1);
($itemcount{1179} == 1);{
quest::summonitem(5021);}
}

The one above is what you were aiming at, you only had a few minor mistakes.

Cripp
05-08-2006, 05:23 PM
sub EVENT_ITEM {
if($itemcount{5018} == 1);
($itemcount{5019} == 1);
($itemcount{5020} == 1);
($itemcount{1179} == 1);{
quest::summonitem(5021);}
}
should be...
sub EVENT_ITEM
{
if(($itemcount{5018} == 1) && ($itemcount{5019} == 1) && ($itemcount{5020} == 1) && ($itemcount{1179} == 1)) {
quest::summonitem(5021); }
}

yea, think that should work atleast... give it a try.


edit:
sub EVENT_ITEM {
if($item1=="5018" && $item2=="5019" && $item3=="5020" && $item4=="1179"){
quest::summonitem(5021);}
}
...
sub EVNET_ITEM
{
if(($item1 == 5018) && ($item2 == 5019) && ($item3 == 5020) && ($item4 == 1179)) {
quest::summonitem(5021); }
}
...better :)

saladbowl1
05-08-2006, 05:45 PM
bah knew i was missing something in that first code but tiredness kicked in :P.

moydock
05-08-2006, 05:52 PM
sub EVENT_ITEM
{
if(($itemcount{5018} == 1) &&
($itemcount{5019} == 1) &&
($itemcount{5020} == 1) &&
($itemcount{1179} == 1))
{quest::summonitem(5021); }

if($item1=="5018" &&
$item2=="5019" &&
$item3=="5020" &&
$item4=="1179")
{quest::summonitem(5022);}

if(($item1 == 5018) &&
($item2 == 5019) &&
($item3 == 5020) &&
($item4 == 1179))
{quest::summonitem(5023); }

}


All three of these seem to work, thanks so much, I was losing my mind with combinations lol...

moydock
05-08-2006, 06:15 PM
If I turn in item 5019 with 5020 in this situation I get my reward 5030, but I also get 5022 ,as I have satisfied that first condition as well. Is there any easy way to tell it ONLY to reward the first when a single 5019 is turned in with nothing else?

sub EVENT_ITEM
{
if(($itemcount{5019} == 1))
{quest::summonitem(5022); }

if(($itemcount{5019} == 1) &&
($itemcount{5020} == 1))
{quest::summonitem(5030); }

if(($itemcount{5018} == 1) &&
($itemcount{5019} == 1) &&
($itemcount{5020} == 1) &&
($itemcount{1179} == 1))
{quest::summonitem(5021); }

}

jimbabwe
05-08-2006, 07:46 PM
This may work. can give it a try.


sub EVENT_ITEM
{

if(($itemcount{5018} == 1) &&
($itemcount{5019} == 1) &&
($itemcount{5020} == 1) &&
($itemcount{1179} == 1))
{quest::summonitem(5021); }
elsif(($itemcount{5019} == 1) &&
($itemcount{5020} == 1))
{quest::summonitem(5030); }
elsif(($itemcount{5019} == 1))
{quest::summonitem(5022); }

}

moydock
05-09-2006, 04:46 AM
Ah yeah that works great. That is exactly what I tried but I did it in reverse order :)

Much appreciated.

moydock
05-11-2006, 07:21 PM
I'm stuck with two quests, I've tried like 10 different things and can't seem to get multiple "if" conditions to work. Im a perl noob so pardon me if what I am doing makes little sense. Tried to copy the format we used above to get two if conditions to trigger a result...

1st:
sub EVENT_SAY{
if(($class == 8) &&
($text=~/hail/i))
{quest::say("xxx"); }

elsif(($class != 8) &&
($text=~/hail/i))
{quest::say("xxx");}

}


**** and this one

sub EVENT_ITEM{
if(($item1 == 5) &&
($ulevel < 4))
{
quest::say("xxx");
quest::summonitem(6);
quest::say("xxx");
}

if($item1 == 6)
{
quest::setallskill(0);
quest::permaclass(8);
}
}

In the first one it triggers the second (elsif) condition regardless of my class. In the second it seems to be broken period, so I guess something is tripping it up in the format. Any have an idea?

ylosh
05-11-2006, 11:11 PM
change the item id #'s to what you want to use and change the level check to whatever you wanted. all i saw was <


sub EVENT_SAY {
if ($text=~/hail/i) {
if ($class eq "Bard") {
quest::say("you're a bard");
}
else {
quest::say("you're not a bard");
}
}
}

sub EVENT_ITEM {
if ($itemcount{1001} == 1 && $ulevel < 4) { # 1 id #1001 item and level less than 4
quest::say("blah blah");
quest::summonitem(1002);
}
elsif ($itemcount{1002} == 1) { # 1 id #1002 item
quest::setallskill(0);
quest::permaclass(8);
}
}

moydock
05-12-2006, 06:18 AM
Thank you very much

moydock
05-12-2006, 11:42 AM
What is the difference?

sub EVENT_SAY {
if ($text=~/hail/i) {
if ($class eq "Bard") {
quest::say("you're a bard");
}
else {
quest::say("you're not a bard");
}
}
}

######

sub EVENT_SAY {
if ($text=~/hail/i && $class eq "Bard")
{
quest::say("you're a bard");
}
else {
quest::say("you're not a bard");
}
}

The second one's else is a little vague?

Also where did you find the format for - $class eq "Bard"