&ISCARRIED


&ISCARRIED  ( char#   ID  . . . <number or position> )

Searches a character's inventory. The search is recursive. That is chests are searched and any monsters found in the chests are searched and any possessions of those monsters are searched, etc. The search includes the cursor if the leader is included in the search.

char#: 0-3 to choose one of the character, 4 for the leader, 5 for the whole party

Non-negative ID is the identifier for a particular object. For example, a particular apple....the one found in the northern corner of the supplies area. In this case the return value is -1 or the character number and the location on that character where the item is carried. These are encoded as 256*char + pos. If the object is found in the cursor then the position is 255. See BODY POSITIONS at ObjectTypeConstants.

If ID is negative then it represents an object type. For example any apple. In this case the return value is the number of items of type -ID being carried by that character.   The object types are those defined by the enumeration OBJECTTYPE at ObjectTypeConstants.  Two caveats:
  1. Some objects have more than one type number.  Torches are an example.  There are several types of torches, depending on the brightness of the torch.  Compass is another example haveing several directions.  In such cases only the 'Basic Object Type' (the first listed) is used.  &ISCARRIED will never find a 'torch-b'.  ALL TORCHES are of type torch_a for the purposes of &ISCARRIED.
  2. Notice that the 'basic object type' of a compass is zero!  Negative zero does not look very negative in twos-complement arithmetic.  THEREFORE . . . This si a special case.  You must use negative one to search for compases.