Difference between revisions of "MUDL:Every round"

From SlothMUD Wiki
Jump to: navigation, search
(Global Variables)
m (Global Variables)
Line 26: Line 26:
 
| %r / %room
 
| %r / %room
 
| Room
 
| Room
| The room in the game where the script is being run.  This value may be null if the script is attached to an area and the entry point does not involve a command or player action.
+
| The room in the game where the script is being run.
 
|-
 
|-
 
| %area
 
| %area

Revision as of 20:49, 16 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.
 %r / %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