Difference between revisions of "Manual:DIL Manual/on activation()"
Jump to navigation
Jump to search
(XML import) |
(XML import) |
||
| Line 1: | Line 1: | ||
| + | <span id="bpona"></span> | ||
| + | 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); | ||
| + | |||
| + | ---~---~---~---~---~---~---~---~--- | ||
<span id="bpona"></span> | <span id="bpona"></span> | ||
integer on_activation ( dilexp , label ) | integer on_activation ( dilexp , label ) | ||
Latest revision as of 22:35, 4 December 2025
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);
---~---~---~---~---~---~---~---~---
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);
---~---~---~---~---~---~---~---~---