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

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="bfcancarry"></span>
+
= cancarry() =
 +
'''Obsolete.''' DIL has no function <code>cancarry()</code>; vmc doesn't know the name.
  
−
integer can_carry(ch : unitptr, u : unitptr, n : integer)
+
The function is <code>can_carry(ch, u, n)</code>, with an underscore: whether the character <code>ch</code> can carry <code>n</code> copies of the unit <code>u</code>. See [[Manual:DIL Manual/can carry()|can_carry()]].
−
    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>
 
−
 
 
−
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);
 
−
 
 
−
---~---~---~---~---~---~---~---~---
 

Latest revision as of 23:25, 14 November 2026

cancarry()

Obsolete. DIL has no function cancarry(); vmc doesn't know the name.

The function is can_carry(ch, u, n), with an underscore: whether the character ch can carry n copies of the unit u. See can_carry().