blob: f3293c04752e0fd890c25507d46cc981d8ea4b73 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 void call_out(string fun, int delay, mixed arg, ...)
3 void call_out(closure cl, int delay, mixed arg, ...)
4
Zesstra715ec202025-07-09 22:18:31 +02005DESCRIPTION
6 Set up a call to function fun in the current object, or to
7 closure cl. The call will take place after <delay> seconds, with the
8 remaining argument list provided.
9 <delay> can be a minimum time of 0 (negative values are implicitly
10 treated as 0), but the real delay will be something between <delay>
11 and <delay> + __ALARM_TIME__.
MG Mud User88f12472016-06-24 23:31:02 +020012
Zesstra715ec202025-07-09 22:18:31 +020013 call_out() saves and restores the current user. It is now
14 possible to use say() or write() which rely on a current
15 user to be something useful.
MG Mud User88f12472016-06-24 23:31:02 +020016
Zesstra715ec202025-07-09 22:18:31 +020017 call_out() can only call functions by name <fun> which are publicly
18 accessible, i.e. "public" and "static" functions. "private" and
19 "protected" functions can't be called.
MG Mud User88f12472016-06-24 23:31:02 +020020
Zesstra715ec202025-07-09 22:18:31 +020021 If <fun> does not define a publicly accessible function, the
22 efun will call the H_DEFAULT_METHOD hook if set.
23 Calls to the master object never use the H_DEFAULT_METHOD hook.
MG Mud User88f12472016-06-24 23:31:02 +020024
Zesstra715ec202025-07-09 22:18:31 +020025 The execution of the call_out()s implies a simple (not
26 exhaustive) measure against rabbits: the evaluation costs of
27 those call_outs() executing at the same time are summed up on
28 a per-UID base. If the summed-up costs exceed the given maximum,
29 a 'too long evaluation' error will occur and any remaining
30 call_outs() of this user scheduled for the same time are
31 discarded.
32
33 If two call_out()s were started with the same target time
34 the one that was issued first will be executed first.
35
36EXAMPLES
MG Mud User88f12472016-06-24 23:31:02 +020037 call_out("RefreshMe", 10);
38
Zesstra715ec202025-07-09 22:18:31 +020039 This will call the function RefreshMe() in 10 seconds without
40 any arguments. The function RefreshMe() can then call out
41 itself again which will result in a loop (not in a recursion)
42 which can be used to check or set up things in the object in
43 intervals. Be aware that callouts are stored in a linear
44 list, and so are somewhat expensive for the driver.
MG Mud User88f12472016-06-24 23:31:02 +020045
Zesstra715ec202025-07-09 22:18:31 +020046 And YES: self-replicating call_out()s, where each call_out()
47 creates two or more other call_out()s in a loop (so called
48 'rabbits') slow the mud down very fast, and are even able
49 to crash it. No need to try it yourself.
MG Mud User88f12472016-06-24 23:31:02 +020050
Zesstra715ec202025-07-09 22:18:31 +020051SEE ALSO
MG Mud User88f12472016-06-24 23:31:02 +020052 remove_call_out(E), call_out_info(E), find_call_out(E),
53 this_player(E), reset(A), heart_beat(A)