THere appears to be a lot of confusion in your
example.
&ISCARRIED needs two parameters. You provided
none. Perhaps you meant to put the 'L5' before
the '&ISCARRIED'.
L5 &ISCARRIED L-50002 L0 L1 L0||1
The '5' is to search the entire party.
Now we are only one parameter short.
You meant the 'L-50002' to be the type
so let us move that before the '&ISCARRIED'.
L5 L-50002 &ISCARRIED L0 L1 L0||1
You mention torches. If you look at the
'enum OBJECTTYPE' in the documentation
as noted above, you will see that torches
have types:
Code: Select all
obj_Torch_a, //4 4
obj_Torch_b, //5 5
obj_Torch_c, //6 6
obj_Torch_d, //7 7
What the documentation does not say is that
when there are several options (such as for
torches) only the first is useful. It is what the
code refers to as the 'basic object type'. All
others are converted to this 'basic' type' for the
purposes of '&ISCARRIED'. So you can only
determine if a torch is carried, not whether a
particular type of torch is carried. So let us use
'torch' as the object type in your example.
L5 L-4 &ISCARRIED L0 L1 L0||1
Of course, th 'L-4' will not work. But we
can put a positiv number there and negate it.
L5 L4 &NEG &ISCARRIED L0 L1 L0||1
After the '&ISCARRIED' The stack will contain
the number of torches carried by the party.
It appears that you wanted to determine whether
the torches were in the hands of the characters
rather than in, for example, the backpacks. But,
as the discussion above reveals, when you ask
about a general class of objects (torches, screamer
slices, daggers, etc., for example), the function
returns the number of such objects. It does not
provide the location of those objects. And, if you
think about it, how could it -- since there could be
dozens of the objects in various locations. So, whatever
your code was intended to accomplish, it cannot
determine if the torches were in the character's
hands by using this method.
I think you had better simply look in each
character's two hands to see if there is a torch
there. That is only 8 very quick operations
every couple of seconds and will not contribute
much overhead.
Another problem that you may have overlooked:
What if the torch is in a chest and the chest is
in the character's hand. '&ISCARRIED' will report
the position of the torch as the character's hand.