Difference between revisions of "MUDL:Timer"
From SlothMUD Wiki
(→Global Variables) |
|||
Line 27: | Line 27: | ||
| The mobile that the MUDL script is attached to. If the script is attached to a room, this value is NULL. | | The mobile that the MUDL script is attached to. If the script is attached to a room, this value is NULL. | ||
|- | |- | ||
− | | %r | + | | %r / %room |
| Room | | Room | ||
− | | The room that the MUDL script is attached to. | + | | 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 or %room. | ||
+ | |- | ||
+ | | %procedure_index | ||
+ | | Integer | ||
+ | | The index of the current MUDL procedure on the %parent variable. | ||
|} | |} | ||
− | |||
= Return Values = | = Return Values = |
Revision as of 20:54, 16 May 2017
Contents
Overview
This MUDL function gets called each time the room or mobile timer goes off. This is guaranteed to be at a regular interval - currently every 10 seconds.
Command Syntax
addproc <room|mobile> mudl setproc <room|mobile> ## timer_#
Note that the # sign after the timer indicates how frequently the function is called. A value of 1 indicates the function should be called every time the timer fires. A value of N indicates the function should be called every Nth time the timer fires.
Global Variables
The following global variables are available:
Name | Type | Description |
---|---|---|
%c | Character | The mobile that the MUDL script is attached to. If the script is attached to a room, this value is NULL. |
%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 or %room. |
%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 at a regular interval regardless if the mobile is idle, fighting, or otherwise engaged.
Example
addproc <mobile> mudl setproc <mobile> 0 timer_1 cmd(%c, 'say The timer is firing now!'), return(true) @ setproc <mobile> 0 PROC_ENABLED 1 compile