Manual:DIL Manual/on activation()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 13:06, 27 May 2020 by Nove (talk | contribs) (XML import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


integer on_activation ( dilexp , label )
   dilexp  : A boolean DIL expression.
   label   : Label to jump to - OR the reserved keyword SKIP.
   returns : The index to the interrupt handing the on_activation.
   result: Sets up an interrupt that is executed before every activation
           of the DIL program. This is for example useful to catch
           situations where your NPC has fallen asleep or is injured.
           If 'dilexp' evaluates to TRUE then the program jumps to 'label'.
           If 'label' is 'skip' then the program is simply not activated.
           When the on_activation evaluates to true, and jumps to a label
           other than skip, the condition is automatically cleared. If the
           dilexp evaluates to false, or if the label is skip, the activation
           remains active. Use the clear() to remove the on_activation.
   Example:
           on_activation(self.position <= POSITION_SLEEPING, skip);
             or
           on_activation(self.position > POSITION_SLEEPING, let_me_sleep);
---~---~---~---~---~---~---~---~---