View Single Post
  #6  
Old 03-12-2008, 12:58 PM
Kagehi
Sarnak
 
Join Date: Feb 2008
Location: Arizona, USA
Posts: 33
Default

I was pretty sure that Live did, at some point, fix it so that stacked items where treated as though they where handed in separately... I even remember people talking about the change, while I played. I suppose I could be wrong, but I am pretty sure it was a major deal at the time it happened.

As for the plugin. That is the code I have. The problem is, you **can** tell it to look for more than one item, and you *can* try to pass a stack to it, and it will work.

For example, if you use that code, and you do:

Code:
%itemcount = (59954 => 1, 86010 => 2, 13068 => 1);
if (check_handin(\%itemcount, 59954 => 1, 86010 => 2, 13068 => 1)) {
  $world->note("Great!");}
else{
  $world->note("Fail!");
}
It will return true and display "Great!".

NOTE: $world->note is the function in the text client I am using as a test bed to figure it out which prints to the output stream. Normally you would, of course, use print.

So, obviously, the code *is* checking stacks, but its comparing the literal stack you ask for "two of item 86010" to the literal stack of "I gave you two of item 86010". If you substitute any other value, in either the request list, or the items given hash, it fails.

I.e., if the intent is to not allow stacks, which I still say they changed in live in one of the more recent updates (I was on a progressive, so things changed all the time from patch to patch), then its **still** wrong, since it accepts them, just *only* if its an exact match to the request, as above. If you don't want stacks, then you need an additional check, which says:

If hashref->{$req} > 1 {return 0;}

*Before* you check for it. Otherwise, if someone takes existing code, like from Vahlara in the tutorialb area, and rewrites it to say, well, the above example, which is taken from that code, then there "lookfor" is going to be wanting a stack, and will fail *every time*, since people will be giving it:

$item1 = 59954
$item2 = 86010
$item3 = 86010
$item4 = 13068

But its expecting:

$item1 = 59954
$item2 = 86010 x 2
$item3 = 13068


See what I am saying?
Reply With Quote