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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 06-17-2019, 12:06 PM
Almusious
Fire Beetle
 
Join Date: Sep 2012
Posts: 25
Default

Quote:
Originally Posted by chrsschb View Post
I appreciate both responses, I simply have not yet had a chance to test anything. My response to Nate is based on research I had already done in the past. I'll let you know after I get a chance to test out your recommendations.

Just to clarify, in the dialogue, similar to what Nate posted, the user can choose what "type" of jewelry they are interested in and I want to pull those out of the hash so the dialogue response isn't a mile long.
Fair enough. How many items (total) do you suspect will be in the hash?

With the example I posted using your existing hash, so long as you utilize conditionals, it will "pull" the types requested, then display a link for the reward item.

The modified hash I posted is how I would roll myself, perhaps even making the moneyrequired and itemrequired keys hold array values (for flexibility), though it would of course require more code you're currently not comfortable with (though I suspect you will be in time).

Code:
%combines = (
	"Rings" => 
	[
        {
			rewarditem => 7171,
			itemrequired1 => 1111,
			itemrequired2 => 2222,
			itemrequired3 => 3333,
			itemrequired4 => 4444,
			moneyrequiredplatinum => 2,
			moneyrequiredgold => 0,
            moneyrequiredsilver => 0,
            moneyrequiredcopper => 0
        },
        {
			rewarditem => 7171,
			itemrequired1 => 1111,
			itemrequired2 => 2222,
			itemrequired3 => 3333,
			itemrequired4 => 4444,
			moneyrequiredplatinum => 2,
			moneyrequiredgold => 0,
            moneyrequiredsilver => 0,
            moneyrequiredcopper => 0
		},
	],
    "Veils" => 
	[
        {
			rewarditem => 7171,
			itemrequired1 => 1111,
			itemrequired2 => 2222,
			itemrequired3 => 3333,
			itemrequired4 => 4444,
			moneyrequiredplatinum => 2,
			moneyrequiredgold => 0,
            moneyrequiredsilver => 0,
            moneyrequiredcopper => 0
		},
	],
    "Shoulders" => 
	[
        {
			rewarditem => 7171,
			itemrequired1 => 1111,
			itemrequired2 => 2222,
			itemrequired3 => 3333,
			itemrequired4 => 4444,
			moneyrequiredplatinum => 2,
			moneyrequiredgold => 0,
            moneyrequiredsilver => 0,
            moneyrequiredcopper => 0
		},
	],
);

sub EVENT_SAY
{
	if ($text=~/Hail/i)
	{
		my @itemtypes_available = (sort keys %combines);
		my $itemtypes_string = "";
		my $n = 0;
		foreach (@itemtypes_available)
		{
			if ($n < $#itemtypes_available)
			{
				if ($n == ($#itemtypes_available - 1))
				{
					$itemtypes_string .= quest::saylink($_, 1, "[".$_."]");
				} else {
					$itemtypes_string .= quest::saylink($_, 1, "[".$_."]") . ", ";
				}
			} else {
				$itemtypes_string .= " and " . quest::saylink($_, 1, "[".$_."]");
			}
			$n++;
		}
		plugin::Whisper ("I have ".$itemtypes_string." to offer via quests!");
	}
}
Not the prettiest method of concatenation, but, save for using pop, last, etc. in a loop, I believe the above way of going about it is the easier way for most folks to look at it (to see what is going on).

I'm heading out of town, so I cannot see my assistance through, but, you've got Nate's ears/eyes, you'll get it all worked out I have no doubt.
Reply With Quote
  #2  
Old 06-17-2019, 12:16 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 905
Default

Quote:
Originally Posted by Almusious View Post
Fair enough. How many items (total) do you suspect will be in the hash?
At least a hundred. This method will grow, evolve and be used for other npcs with similar functionalities.
__________________
Clumsy's World: Resurgence [2019-Present]
Clumsy's World 2.0 [2014-2016]
Clumsy's World [2006-2012]
Reply With Quote
  #3  
Old 06-17-2019, 12:28 PM
Almusious
Fire Beetle
 
Join Date: Sep 2012
Posts: 25
Default

Quote:
Originally Posted by chrsschb View Post
At least a hundred. This method will grow, evolve and be used for other npcs with similar functionalities.
And will there be multiple/different methods of obtaining the same reward item? What I mean is for example:

1111 x 1,
2222 x 1,
3333 x 1,
4444 x 1,
2pp,0gp,0sp,0cp
Results in: 9999

But...

1111 x 1,
2222 x 1,
5555 x 1
20pp,0gp,0sp,0cp
Also results in: 9999

If not, then having arrays as the itemrequired and moneyrequired values wouldn't be necessary (which is where I imagined you going). Also with that, then you could just roll with a formatted array like in Nate's script. Im out, I look forward to revisiting this when I get back, have a good one.
Reply With Quote
Reply

Thread Tools
Display Modes

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 08:38 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3