blob: 9876b035d7bb2531a7d04982708f7b88b5eadd97 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 void heart_beat()
3
4DESCRIPTION
5 This function will be called automatically every
6 __HEART_BEAT_INTERVAL__ seconds. The driver will call the function
7 directly in the object, even if the function is being shadowed.
8
9 The start and stop of heart beat is controlled by the efun
10 set_heart_beat(). Be careful not to have objects with heart
11 beat running all the time, as it uses a lot of driver
12 resources. If there is an error in the heart beat routine, the
13 heart beat will be turned off for this object and the
14 master function heart_beat_error() is called. If the call
15 to the master function returns a non-zero value, the heart beat
16 will be turned back on again.
17
18 The function this_player() will return this object, but only if
19 it is living. Otherwise, this_player() will return 0.
20
21 The function will be called only if there is at least one interactive
22 user in the game.
23
24 Note that error messages will be given to the current user
25 which will be the object itself or nobody.
26
27EXAMPLE
28 object owner;
29 void create() {
30 ...
31 owner=this_player();
32 set_heart_beat(1);
33 }
34 void heart_beat() {
35 tell_object(owner, "Your heart goes: BUM BUM\n");
36 }
37
38 We have to use tell_object() because write goes to the current
39 user and this can only be the object itself or nobody.
40
41HISTORY
42 LDMud 3.3.687 made the interval time configurable at driver compile
43 time (used to be 2 seconds fixed).
44
45SEE ALSO
46 set_heart_beat(E), call_out(E), enable_commands(E),
47 heart_beat_error(M)