Difference between revisions of "Manual:DIL Manual/SFB TICK"
Jump to navigation
Jump to search
(XML import) |
(fix links to mudday/mudhour/mudmonth/mudyear/skip) |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| + | = SFB_TICK = | ||
| + | '''Constant''' (integer, vme.h: 0x0008). | ||
| + | wait(SFB_TICK, condition) | ||
| − | < | + | 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. |
| − | + | == What the event holds == | |
| + | {| class="wikitable" | ||
| + | ! 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 (<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. | ||
| − | + | == Example == | |
| − | + | <pre> | |
| + | 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 | ||
| + | </pre> | ||
| + | A bell (an object in a room) that looks at the mud clock once a minute and chimes at noon. | ||
| + | |||
| + | == 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_RANTIMEadded, 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(andvme -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.