MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 2 | object * clones() |
| 3 | object * clones(int what) |
| 4 | object * clones(string|object obj [, int what]) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 5 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 6 | DESCRIPTION |
| 7 | The efuns returns an array with all clones of a certain blueprint. |
| 8 | The array is subject to the usual runtime limits. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 9 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 10 | If <obj> is given, all clones of the blueprint of <obj> (which |
| 11 | may be <obj> itself) are returned, otherwise all clones of the |
| 12 | current object resp. of the current object's blueprint. If <obj> |
| 13 | is given as string, it must name an existing object. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 14 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 15 | <what> selects how to treat clones made from earlier versions |
| 16 | of the blueprint: |
| 17 | == 0: (default) return the clones of the current blueprint only. |
| 18 | == 1: return the clones of the previous blueprints only. |
| 19 | == 2: return all clones of the blueprint. |
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 | Note: this efun is computationally expensive. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 22 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 23 | If the driver is compiled with DYNAMIC_COSTS, the cost of this |
| 24 | efun is proportional to the number of objects in the game. |
| 25 | |
| 26 | EXAMPLES |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 27 | object o, p; |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 28 | o = clone_object("/std/thing"); /* or "std/thing" in COMPAT mode */ |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 29 | destruct(find_object("/std/thing")); |
| 30 | p = clone_object("/std/thing"); |
| 31 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 32 | clones("/std/thing") --> returns ({ p }) |
| 33 | clones("/std/thing", 0) --> returns ({ p }) |
| 34 | clones("/std/thing", 1) --> returns ({ o }) |
| 35 | clones("/std/thing", 2) --> returns ({ o, p }) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 36 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 37 | HISTORY |
| 38 | Introduced in LDMud 3.2.8. |
| 39 | LDMud 3.2.9 added the dynamic cost. |
| 40 | |
| 41 | SEE ALSO |
| 42 | blueprint(E), clone_object(E), clonep(E) |