PDA

View Full Version : Multiple Turn-Ins working?


srarcade
10-05-2004, 07:15 PM
Are multiple turn ins working in 5.9DR2 release? Here is what I'm trying to do:

sub EVENT_ITEM
{
if ($itemcount{13006} == 1 && $itemcount{10503} == 1 && $itemcount{10300} == 1 && $itemcount{12038} == 1)
{
quest::say("Well what do we have here? Ah, one moment while I smith you up some of me finest armors.");
quest::exp(250);
quest::spawnitem(3053);
quest::say("There ye go, a fancy banded helm for ya. Come back soon!");
}
else
{
quest::say("What'ya givin me gifts for? Well I'll take it anyway..thanks.");
}
}

Thanks

The_Horrid
10-05-2004, 11:26 PM
Use

if (($itemcount{123456} == 1) && ($itemcount{78910} ==1) && ($itemcount{23456} == 1))

etc.. enclose each $itemcount{} == X in it's own set of parenthesis, AND enclosed them all in one () as well...

And I am not too sure Else is part of Perl's else statements, may try 'elsif' instead, not sure though. GL.


The_Horrid

srarcade
10-06-2004, 12:14 AM
I've tried that too. Else works fine, if you hand him any item he'll give you the else stuff. If i shorten the script to require 1 item, it works fine too. If i require multiple items, he just eats them, but the script works because you can talk to him.

The_Horrid
10-06-2004, 01:24 AM
The Ifs (()) works.

Remove the Else parts, and check the turn-in then, if it works, then there is some syntax your not following with If/Else

The_Horrid

The_Horrid
10-06-2004, 01:27 AM
Caught this just now,

quest::spawnitem();

use:

quest::summonitem();

see if that works

The_Horrid

cofruben
10-06-2004, 04:39 AM
why not just use $item1,$item2,etc...

srarcade
10-06-2004, 04:45 AM
Got it to work. Not sure why but the else makes it break. I tried it without the else before and it didnt work but I probably had a syntax error somewhere.

Working example of multiple item hand in:

sub EVENT_ITEM
{
if(($itemcount{120003} == 1) && ($itemcount{10503} == 1) && ($itemcount{10300} ==1 ) && ($itemcount{12038} ==1))
{
quest::say("Well what do we have here? Ah, one moment while I smith you up some of me finest armors.");
quest::exp(2500);
quest::summonitem(3053);
quest::say("There ye go, a fancy banded helm for ya. Come back soon!");
}
}

m0oni9
10-06-2004, 07:26 AM
If you minimize the code does it still break? I am not sure how the exp/spawnitem commands would affect the other block, but I am curious. Example:

if ($itemcount{a} == 1 &&
$itemcount{b} == 1)
{
quest::say("items handed in");
}
else
{
quest::say("got different items");
}

srarcade
10-06-2004, 10:44 AM
You know thats what I thought too, so I wrote alot of quests that way. Then when I went to try them, none of them work. So I added the else in there as a test to see if just the multi line was the bad one, and sure enough, the npcs would react to the else statement. Now, even if you 'properly' code the multi line and include an else, it still breaks. So i ended up removing the else line of all my hand in quests for now. I would like to have it because it shows the player that they didnt just eat items but were handed the wrong thing.

Its kind of wierd the perl parser is that picky, i mean geeze. Thats like saying (1)+(1) != 1+1

m0oni9
10-07-2004, 01:41 AM
It's more likely that there is some sort of bug in the implementation. Would you be able to create a script that calls multiple functions, but makes them the same function? For instance, on turn-in use four separate quest::say calls, with varying input, then try quest::summonitem:

if ($itemcount{a} == 1)
{
quest::say("if test");
quest::say("if test");
quest::say("if test");
quest::say("if test");
}
else
{
quest::say("else test");
}
There was/is a bug that causes one function call to interfere with another in some situations. It doesn't look like my fix for this was ever commited. I don't see how that problem would affect this, but you might want to give it a try and see what happens. Here is the thread with instruction. I think it should still work with the latest release: http://www.eqemulator.net/forums/viewtopic.php?t=13906.

mystic414
12-16-2004, 06:42 PM
Sorry to post to a 2-month-old thread, but I just realized this, and thought it might be helpful for others to know:

why not just use $item1,$item2,etc...

If you use the ($item1==x) && ($item2==x) syntax like you suggest, then the player has to hand the items in to the NPC in that exact order.

If you use the ($itemcount{x} == 1) && ($itemcount{x} == 1) syntax, it doesn't matter what order the items are handed in.

Basically, using $itemcount is more player-friendly. The only time I can think of to use $item1, etc would be if you were designing some evil quest where you wanted to penalize the player for not handing in the items in the specified order...

Cisyouc
12-17-2004, 07:51 AM
Sorry to post to a 2-month-old thread, but I just realized this, and thought it might be helpful for others to know:

why not just use $item1,$item2,etc...

If you use the ($item1==x) && ($item2==x) syntax like you suggest, then the player has to hand the items in to the NPC in that exact order.

If you use the ($itemcount{x} == 1) && ($itemcount{x} == 1) syntax, it doesn't matter what order the items are handed in.

Basically, using $itemcount is more player-friendly. The only time I can think of to use $item1, etc would be if you were designing some evil quest where you wanted to penalize the player for not handing in the items in the specified order...Also, if you use itemcount{} you can stack items and it will recognize it. So you arent restricted to collections of 4 items.

Scorpx725
12-17-2004, 08:12 AM
So.... perl > sonys quest system! Stacking works ^_^

typenamehere
11-05-2009, 05:50 PM
hm for some reason my npc is just eating my items, was wondering if anyone could spot my error

sub EVENT_SAY
{


if ($text =~/Hail/i){
quest::say ("Give me all four of their heads, and I shall reward you."); }
}

sub EVENT_ITEM
{
if(($itemcount{2432} == 1) && ($itemcount{2433} == 1) && ($itemcount{2434} ==1 ) && ($itemcount{2435} ==1))
{
quest::say("Well what do we have here? A job well done indeed!");
quest::spawn2(1247,0,0,$x-20,$y+1,$z,$h);
}
}

ChaosSlayerZ
11-05-2009, 06:35 PM
for turn in, try this instead


sub EVENT_ITEM
{
if (plugin::check_handin(\%itemcount, 2432=>1, 2433=>1, 2434=>1, 2435=>1))
{
quest::say("Well what do we have here? A job well done indeed!");
quest::spawn2(1247,0,0,$x-20,$y+1,$z,$h);

}


else
{
plugin::return_items(\%itemcount);
}
}

typenamehere
11-05-2009, 06:55 PM
wow, works like a charm, much thanks