Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-14-2019, 10:46 AM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 905
Default Is it possible to filter on a hash/array?

I'm trying to see if instead of building multiple hashes for different types of turnins, if I can build a single large hash and filter results based on data in that hash. I'm not super savvy with these so kinda learning as I go, any help is appreciated.

Code:
%combine_1 = (
  1 => { "item1" => 1234, "item2" => 1111, "type" => 1,  "reward" => 11111 }, # Ring
  2 => { "item1" => 1234, "item2" => 2222, "type" => 4,  "reward" => 22222 }, # Veil
  3 => { "item1" => 1234, "item2" => 3333, "type" => 3,  "reward" => 33333 }, # Earring
  4 => { "item1" => 1234, "item2" => 4444, "type" => 1,  "reward" => 44444 }, # Ring
  5 => { "item1" => 1234, "item2" => 5555, "type" => 2,  "reward" => 55555 }, # Necklace
  );
For instance in this example I have 5 combines, I want to present these to the player and filter based on the type field. So if they respond to the NPC with [$type1] cause they want to see rings the npc should only respond with type 1 combines.

Dialogue I have right now:
Code:
    foreach $id (sort keys %combine_1) {
      my $item1_link = quest::varlink($turnin_1{$id}{"item1"});
      my $item2_link = quest::varlink($turnin_1{$id}{"item2"});
      my $reward_link = quest::varlink($turnin_1{$id}{"reward"});
      my $scost = $scomm . '' . pp;
      $client->Message($whisper_color, "$item1_link + $item2_link + $scost = $reward_link");
    }
Turnin:
Code:
  foreach $id (sort keys %combine_1) {
    $item1 = $turnin_1{$item_id}{"item1"};
    $item2 = $turnin_1{$item_id}{"item2"};
    $reward = $turnin_1{$item_id}{"reward"};

    if (plugin::takeItemsCoin(0, 0, 0, $scomm, $item1 => 1, $item2 => 1)) {
      quest::summonitem($reward);
      quest::ding;
    }
  }
I'm sure I'm missing something simple with this.
__________________
Clumsy's World: Resurgence
Clumsy's World [2006-2012]
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 02:25 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3