Difference between revisions of "MUDL:Timer"
From SlothMUD Wiki
					
										
					
					 (Created page with " __TOC__  = Overview =  This MUDL function gets called each timer the mobile timer goes off.  This is guaranteed to be at a regular interval - currently every 10 seconds.   =...")  | 
				|||
| Line 4: | Line 4: | ||
= Overview =  | = Overview =  | ||
| − | This MUDL function gets called each   | + | 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.  | 
| Line 10: | Line 10: | ||
<pre>  | <pre>  | ||
| − | addproc <room|mobile  | + | addproc <room|mobile> mudl  | 
| − | setproc <room|mobile  | + | setproc <room|mobile> ## timer_#  | 
</pre>  | </pre>  | ||
| Line 25: | Line 25: | ||
| %c  | | %c  | ||
| Character  | | Character  | ||
| − | | The mobile that the MUDL script is attached to.  | + | | The mobile that the MUDL script is attached to.  If the script is attached to a room, this value is NULL.  | 
| + | |-  | ||
| + | | %r  | ||
| + | | Room  | ||
| + | | The room that the MUDL script is attached to.  If the script is attached to a mobile, this value is NULL.  | ||
|}  | |}  | ||
Revision as of 18:10, 11 March 2016
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 | The room that the MUDL script is attached to. If the script is attached to a mobile, this value is NULL. | 
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