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 | |
| 5 | DESCRIPTION |
| 6 | Set up a call to function fun in the current object, or to |
| 7 | closure cl. The call will take place in delay seconds, with the |
| 8 | remaining argument list provided. delay can be 0, but be careful! |
| 9 | |
| 10 | call_out() saves and restores the current user. It is now |
| 11 | possible to use say() or write() which rely on a current |
| 12 | user to be something useful. |
| 13 | |
| 14 | call_out() can only call functions which are publicly accessible, |
| 15 | i.e. "public" and "static" functions. "private" and "protected" |
| 16 | functions can't be called. |
| 17 | |
| 18 | The execution of the call_out()s implies a simple (not |
| 19 | exhaustive) measure against rabbits: the evaluation costs of |
| 20 | those call_outs() executing at the same time are summed up on |
| 21 | a per-UID base. If the summed-up costs exceed the given maximum, |
| 22 | a 'too long evaluation' error will occur and any remaining |
| 23 | call_outs() of this user scheduled for the same time are |
| 24 | discarded. |
| 25 | |
| 26 | Callouts are executed every 2s, therefore your delay may be bigger |
| 27 | than the you specified. In fact, a Callout with delay==0 is |
| 28 | executed within 2s from the function call to call_out(). |
| 29 | |
| 30 | WARNING |
| 31 | Please never use call_out(...,0) in recursive Callouts and be at least |
| 32 | very careful in other cases. That Callout would be executed directly |
| 33 | after your current function and you really get 0 delay. |
| 34 | |
| 35 | EXAMPLE |
| 36 | call_out("RefreshMe", 10); |
| 37 | |
| 38 | This will call the function RefreshMe() in 10 seconds without |
| 39 | any arguments. The function RefreshMe() can then call out |
| 40 | itself again which will result in a loop (not in a recursion) |
| 41 | which can be used to check or set up things in the object in |
| 42 | intervals. Be aware that callouts are stored in a linear |
| 43 | list, and so are somewhat expensive for the driver. |
| 44 | |
| 45 | And YES: self-replicating call_out()s, where each call_out() |
| 46 | creates two or more other call_out()s in a loop (so called |
| 47 | 'rabbits') slow the mud down very fast, and are even able |
| 48 | to crash it. No need to try it yourself. |
| 49 | |
| 50 | SEE ALSO |
| 51 | remove_call_out(E), call_out_info(E), find_call_out(E), |
| 52 | this_player(E), reset(A), heart_beat(A) |
| 53 | |
| 54 | 05.11.06 Zesstra |