Difference between revisions of "Manual:DIL Manual/SFB TICK"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(fix links to mudday/mudhour/mudmonth/mudyear/skip)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
−
<span id="sfbtick"></span>
+
= SFB_TICK =
 +
'''Constant''' (integer, vme.h: 0x0008).
  
−
  SFB_TICK           Timer message
+
  wait(SFB_TICK, condition)
  
−
  When this flag is set, the routine gets activated by a "clock". The clock
+
The timer event. A program waiting with <code>SFB_TICK</code> wakes every time its own timer runs out; the timer is the program's <code>heartbeat</code>, counted in pulses of a quarter second (<code>PULSE_SEC</code> is 4 pulses). <code>pause</code> is <code>wait(SFB_TICK | SFB_RANTIME, TRUE)</code>, defined in wmacros.h.
−
  ticks (in 1/4th of a second) are determined by the 'heartbeat' variable.
 
  
−
      'activator'... is null.
+
== What the event holds ==
−
      'argument'.... will be empty.
+
{| class="wikitable"
 +
! Variable !! Value
 +
|-
 +
| activator, medium, target || null
 +
|-
 +
| argument || empty
 +
|-
 +
| command(CMD_AUTO_TICK) || TRUE
 +
|}
  
−
      command(CMD_AUTO_TICK) will evaluate to TRUE.
+
== Notes ==
−
---~---~---~---~---~---~---~---~---
+
* Each program has its own timer; a tick goes only to the program it belongs to, not to the room.
−
<span id="sfbtick"></span>
+
* The shortest heartbeat is one second (<code>PULSE_SEC</code>): a smaller value is raised to that when the program goes back to waiting.
 +
* With <code>SFB_RANTIME</code> added, each wait lasts a random time between half and one and a half heartbeats.
 +
* A changed heartbeat starts a new timer when the program goes back to waiting. Otherwise an event of another kind doesn't reset the timer.
 +
* When an earlier program on the same unit holds <code>priority</code>, the tick is skipped.
 +
* Under a god's <code>wtimewarp</code> (and <code>vme -w</code>) the ticks come as fast as the server can run them.
  
−
SFB_TICK          Timer message
+
== Example ==
 +
<pre>
 +
dilbegin chime();
 +
code
 +
{
 +
  heartbeat := PULSE_SEC * 60;
  
−
   When this flag is set, the routine gets activated by a "clock". The clock
+
   :start:
−
   ticks (in 1/4th of a second) are determined by the 'heartbeat' variable.
+
   wait(SFB_TICK, TRUE);
  
−
       'activator'... is null.
+
  if (mudhour == 12)
−
      'argument'.... will be empty.
+
       act("The bell chimes noon.", A_ALWAYS, self, null, null, TO_ROOM);
 +
  goto start;
 +
}
 +
dilend
 +
</pre>
 +
A bell (an object in a room) that looks at the mud clock once a minute and chimes at noon.
  
−
      command(CMD_AUTO_TICK) will evaluate to TRUE.
+
== See also ==
−
---~---~---~---~---~---~---~---~---
+
* [[Manual:DIL Manual/heartbeat|heartbeat]]
 +
* [[Manual:DIL Manual/wait()|wait()]]
 +
* [[Manual:DIL Manual/priority|priority]]
 +
* [[Manual:DIL Manual/mudhour|mudhour]]

Latest revision as of 23:28, 14 November 2026

SFB_TICK

Constant (integer, vme.h: 0x0008).

wait(SFB_TICK, condition)

The timer event. A program waiting with SFB_TICK wakes every time its own timer runs out; the timer is the program's heartbeat, counted in pulses of a quarter second (PULSE_SEC is 4 pulses). pause is wait(SFB_TICK | SFB_RANTIME, TRUE), defined in wmacros.h.

What the event holds

Variable Value
activator, medium, target null
argument empty
command(CMD_AUTO_TICK) TRUE

Notes

  • Each program has its own timer; a tick goes only to the program it belongs to, not to the room.
  • The shortest heartbeat is one second (PULSE_SEC): a smaller value is raised to that when the program goes back to waiting.
  • With SFB_RANTIME added, each wait lasts a random time between half and one and a half heartbeats.
  • A changed heartbeat starts a new timer when the program goes back to waiting. Otherwise an event of another kind doesn't reset the timer.
  • When an earlier program on the same unit holds priority, the tick is skipped.
  • Under a god's wtimewarp (and vme -w) the ticks come as fast as the server can run them.

Example

dilbegin chime();
code
{
   heartbeat := PULSE_SEC * 60;

   :start:
   wait(SFB_TICK, TRUE);

   if (mudhour == 12)
      act("The bell chimes noon.", A_ALWAYS, self, null, null, TO_ROOM);
   goto start;
}
dilend

A bell (an object in a room) that looks at the mud clock once a minute and chimes at noon.

See also