View Single Post
  #2  
Old 10-01-2018, 12:07 AM
Almusious
Fire Beetle
 
Join Date: Sep 2012
Posts: 25
Default

Code:
sub EVENT_SAY {
	if ($text=~/armorset/i) {
		# head armor ids   147587 = leather, 147580 = plate, 147573 = chain, 147566 = cloth
		# chest armor ids  147588 = leather, 147581 = plate, 147574 = chain, 147567 = cloth
		# leg  armor ids   147591 = leather, 147584 = plate, 147577 = chain, 147570 = cloth
		my $headid = $client->GetItemIDAt(2);
		my $chestid = $client->GetItemIDAt(17);
		my $legid = $client->GetItemIDAt(18);
		if ($headid ~~ [147587,147580,147573,147566] and $chestid ~~ [147588,147581,147574,147567 and $legid ~~ [147591,147584,147577,147570])
		{
			$client->Message(15,"3 pieces of armor equipped, $headid, $chestid, $legid.");
		}
		elsif ($headid ~~ [147587,147580,147573,147566] and $legid ~~ [147591,147584,147577,147570])
		{
			$client->Message(15,"2 pieces of armor equipped, $headid, $legid.");
		}
	}
}
Use smart matching against an array, much easier to do and look at. Would also consider a hash if you go with any more items fwiw.
Reply With Quote