Difference between revisions of "MUDL:Every round"

From WikiName
Jump to: navigation, search
(Created page with " __TOC__ = Overview = This MUDL function gets called each combat round for mobiles in combat. = Command Syntax = <pre> addproc <room|mobile|object> mudl setproc &...")
 
m (Global Variables)
 
(4 intermediate revisions by the same user not shown)
Line 10: Line 10:
  
 
<pre>
 
<pre>
addproc &lt;room|mobile|object&gt; mudl
+
addproc &lt;mobile&gt; mudl
setproc &lt;room|mobile|object&gt; ## every_round
+
setproc &lt;mobile&gt; ## every_round
 
</pre>
 
</pre>
 
  
 
= Global Variables =
 
= Global Variables =
Line 24: Line 23:
 
| Character
 
| Character
 
| The mobile that the MUDL script is attached to.
 
| The mobile that the MUDL script is attached to.
 +
|-
 +
| %room
 +
| Room
 +
| The room in the game where the script is being run.
 +
|-
 +
| %area
 +
| Area
 +
| The area (zone) in the game where the script is being run.
 +
|-
 +
| %parent
 +
| Character or Object or Room or Area
 +
| The in-game element that the MUDL script is attached to.  It will be identical to %c.
 +
|-
 +
| %procedure_index
 +
| Integer
 +
| The index of the current MUDL procedure on the %parent variable.
 
|}
 
|}
 
  
 
= Return Values =
 
= Return Values =
Line 68: Line 82:
  
 
[[Category:Building]]
 
[[Category:Building]]
[[Category:MUDL|On_command]]
+
[[Category:MUDL|Every_round]]

Latest revision as of 16:56, 18 May 2017

Overview

This MUDL function gets called each combat round for mobiles in combat.


Command Syntax

addproc <mobile> mudl
setproc <mobile> ## every_round

Global Variables

The following global variables are available:

Name Type Description
 %c Character The mobile that the MUDL script is attached to.
 %room Room The room in the game where the script is being run.
 %area Area The area (zone) in the game where the script is being run.
 %parent Character or Object or Room or Area The in-game element that the MUDL script is attached to. It will be identical to %c.
 %procedure_index Integer The index of the current MUDL procedure on the %parent variable.

Return Values

The return value from this function is ignored.


Triggered Scripts

Only mobile scripts are triggered by this event. They are triggered after the mobile has made its normal attacks for the round.


Example

addproc <mobile> mudl
setproc <mobile> 0 every_round

foreach(pc_in_room(room(%c)), %1,
    if(position(%c) = 'fighting' AND 1d100 < 35),
    (
        msg_character(%1, ''+short(%c)+' growls and scratches you with its claws!'),
        msg_character(%1, 'You feel unlucky.'),
        msg_everyone_else(%1, ''+short(%c)+' growls and scratches '+short(%1)+' with its claws!'),
        affect(%1,'curse','level=42 location=hitroll modifier=-2 duration=2'),
        affect(%1,'curse','level=42 location=dex modifier=-1 duration=2'),

        if(affected_by_spell(%1, 'disease'),(),
            affect(%1,'disease','level=42 location=disease_clumsy duration=10')),
            set(hp(%1), hp(%1) - 3d3 + 25)
        )
    )
)
@


setproc <mobile> 0 PROC_ENABLED 1
compile