Thread: Charm Stats?
View Single Post
  #16  
Old 01-08-2016, 09:16 PM
tearinall
Fire Beetle
 
Join Date: Oct 2012
Posts: 9
Default

Mace, it doesn't always "take hold" instantaneously from what I remember.

I get what you're after, which is why I only check the main inventory (worn, and consequently cursor rather than all slots). I also put the item numbers you want to check for in a declared array so that you may add to it in perhaps a more easier to understand method. I also have it check how many elements are in the array as a "total number of armor to check for", so it's easier to scale (as in grow, increase, etc.).

Try this debugging version:

Code:
sub EVENT_SCALE_CALC {
	my @checkarray = (1804..1810);  ## denotes a range between 1804 to 1810 - could also have (1804,1805,1806,etc.) to as many as you want
									## since we check how many are in the array later
	my $worn = 0;
	foreach my $itemtocheck (@checkarray) {
		if (CheckForItem($itemtocheck) {
			$worn++
			quest::say ("".$worn." total worn items at this time.");
		}
	}
	$questitem->SetScale($worn/(scalar @checkarray));
}

sub CheckForItem {
	## Check only main inventory/cursor (we want these pieces to be worn to count right?
	for ($slot1=0; $slot1<=30; $slot1++) {
		$itemid1=$client->GetItemIDAt($slot1);
		if ($itemid1==$_[0]) {
			quest::say ("Found item: ".$_[0]."");
			return 1;
		} else {
			quest::say ("Did not find item: ".$_[0]."");
			return 0;
		}
	}
}
Reply With Quote