EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Why this doesn't work (https://www.eqemulator.org/forums/showthread.php?t=34447)

Rhodan 11-08-2011 05:32 PM

Why this doesn't work
 
From the Lief Faladim NPC in Kithicor. THere are three hand ins and two work. The one that requires money doesn't and I don't see anything wrong (comparing to other quests).

Perhaps the $gold doesn't work properly? I summoned the exact items specified and handed in 2000 gold pieces at the same time. I get back the items but not the gold.

Code:

sub EVENT_ITEM {
    if(plugin::check_handin(\%itemcount, 12321 => 1, 12320 => 1)) {
        quest::summonitem(3190);
    }
    if (plugin::check_handin(\%itemcount, 12305 => 1, 12306 => 1, $gold >= 2000)) {
    quest::say("Here are your boots.");
      quest::summonitem(3192);
    }
    if (plugin::check_handin(\%itemcount, 10059 => 1, 12328 => 1)) {
      quest::say("Here are your leggings.");
      quest::summonitem(3191);
    }
    else {
        plugin::return_items(\%itemcount);
        return 1;
    }


lerxst2112 11-08-2011 08:16 PM

I can't answer your gold question, but your script has the same problem that many others do. If you're checking for a series of items with the intent to return anything not used at the end you must use if/elsif/else, otherwise the last else only applies to the last if.

trevius 11-08-2011 08:22 PM

I didn't test this, but it should work:

Code:

sub EVENT_ITEM {

        if(plugin::check_handin(\%itemcount, 12321 => 1, 12320 => 1))
        {
                quest::summonitem(3190);
        }

        if ($gold >= 2000 && plugin::check_handin(\%itemcount, 12305 => 1, 12306 => 1))
        {
                quest::say("Here are your boots.");
                quest::summonitem(3192);

        }
        else
        {
                if($gold)
                {
                        $client->AddMoneyToPP(0, 0, $gold, 0, 1);
                        quest::say("That is not the required amount!");
                        $gold = undef;
                }
        }

        if (plugin::check_handin(\%itemcount, 10059 => 1, 12328 => 1))
        {
                quest::say("Here are your leggings.");
                quest::summonitem(3191);
        }

        plugin::return_items(\%itemcount);

}

Your main issue is that $gold >= 2000 can not be passed into the check_handin plugin.

trevius 11-08-2011 08:28 PM

Quote:

Originally Posted by lerxst2112 (Post 204595)
I can't answer your gold question, but your script has the same problem that many others do. If you're checking for a series of items with the intent to return anything not used at the end you must use if/elsif/else, otherwise the last else only applies to the last if.

I think most people misunderstand how to us the return_items plugin properly. Of course, it works in most cases as an else to the last if for most scenarios. The way I use it is out in the open at the end of the EVENT_ITEM sub (as shown in the example in my last post). Based on how the check_handin and return_items plugins work, you will only be returned items that weren't used by the check_handin plugin. So, leaving it out in the open at the end of the sub just makes sure any left over items will get returned.

One case where adding it as an else to the last if won't work is if someone turns in the needed item(s) for the last turn in, but also turns in an extra item. They will get the reward, but will not get their extra item back.

The main case in which you might need an if/elsif/else, is if you also want to give a return items say message if the turn in was incorrect.

Rhodan 11-09-2011 08:56 PM

I think I see. The original quest script has the $gold as an input to the plugin

if (plugin::check_handin(\%itemcount, 12305 => 1, 12306 => 1, $gold >= 2000)) {

And the plugin doesn't understand it so it returns false and hands back the items it understood without completing the transaction. The modified script by Trevius has the $gold conditional outside the plugin inputs so it's evaluated correctly. I'll make the changes and test it out.

Thanks muchly! I'll report any others in the quest bugs area. Seems not too many people are playing rangers, or perhaps just not doing class quests in the lower levels so these go unreported.

Rhodan 11-11-2011 08:57 AM

I can't seem to find a description for AddMoneyToPP() anywhere. Its not in the wiki or in the pearl lexicon that I could find. Is there anywhere it's described?

lerxst2112 11-11-2011 05:28 PM

http://www.eqemulator.net/wiki/wikka...uestCheatSheet

Rhodan 11-11-2011 05:52 PM

Awesome thanks! Lots to look at and experiment with.

trevius 11-12-2011 07:04 PM

That particular command is a Quest Object, which are on this page:

http://www.eqemulator.net/wiki/wikka...a=QuestObjects


All times are GMT -4. The time now is 06:11 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.