Difference between revisions of "Manual:DIL Manual/cancarry()"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
(XML import)
 
Line 1: Line 1:
 +
<span id="bfcancarry"></span>
  
 +
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);
 +
 +
---~---~---~---~---~---~---~---~---
 
<span id="bfcancarry"></span>
 
<span id="bfcancarry"></span>
  

Latest revision as of 22:37, 4 December 2025

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);
---~---~---~---~---~---~---~---~---

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);
---~---~---~---~---~---~---~---~---