View Single Post
  #11  
Old 06-17-2019, 10:34 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 905
Default

Quote:
Originally Posted by Almusious View Post
I -believe- this is what you're looking for (i.e. how to access/use a key in a hash of a hash):

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
  );
  
{
	foreach my $key (sort keys %combine_1)
	## could be shortened: foreach (sort keys $combine_1)
	{
		if ($combine_1{$key}->{type} == 1)
		## if above shortened: if ($combine_1{$_}->{type} == 1)
		{
			my $itemlink = quest::varlink($combine_1{$key}->{reward});
			## my $itemlink = quest::varlink($combine_1{$_}->{reward});
			$client->Message(15, $itemlink);
		}
	}
}
?
^ this method is working great for what I'm trying to do. This should get my dialog responses down to 6-10 depending on the category, which is much better and I can filter further if needed.
__________________
Clumsy's World: Resurgence
Clumsy's World [2006-2012]
Reply With Quote