Manual:DIL Manual/cancarry()

From DikuMUD Wiki
Jump to navigation Jump to search


integer can_carry(ch : unitptr, u : unitptr, n : integer)
   ch : The character to check
   u  : The unit to check if he can carry.
   n  : How many copies of that unit.
   Returns: 0 if 'ch' can carry 'n' times 'u'.
            1 if 'n' items are too many (his hands are full)
            2 if 'n' times 'u' are too heavy
   Example:
      i := can_carry(activator, item, 1);
      if (i == 1)
        exec("say Your hands are full!", self);
      else if (i == 2)
        exec("say You cant carry that much weight.", self);
      else
        exec("give "+item.name+" to "+activator.name, self);
---~---~---~---~---~---~---~---~---