MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
| 2 | void call_out(string fun, int delay, mixed arg, ...) |
| 3 | void call_out(closure cl, int delay, mixed arg, ...) |
| 4 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 5 | DESCRIPTION |
| 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 12 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 13 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 16 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 17 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 20 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 21 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 24 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 25 | 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 | |
| 36 | EXAMPLES |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 37 | call_out("RefreshMe", 10); |
| 38 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 39 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 45 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 46 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 50 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 51 | SEE ALSO |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 52 | remove_call_out(E), call_out_info(E), find_call_out(E), |
| 53 | this_player(E), reset(A), heart_beat(A) |