blob: 59ecd299a282d34e594bbb4940a815df0db0c4a6 [file] [log] [blame]
Zesstra715ec202025-07-09 22:18:31 +02001PRELIMINARY
MG Mud User88f12472016-06-24 23:31:02 +02002SYNOPSIS
Zesstrad59c3892019-11-28 20:53:39 +01003 object present_clone(string str)
4 object present_clone(string str, int n)
5 object present_clone(string str, object env)
6 object present_clone(string str, object env, int n)
7
8 object present_clone(object obj)
9 object present_clone(object obj, int n)
10 object present_clone(object obj, object env)
11 object present_clone(object obj, object env, int n)
MG Mud User88f12472016-06-24 23:31:02 +020012
MG Mud User88f12472016-06-24 23:31:02 +020013
Zesstra715ec202025-07-09 22:18:31 +020014DESCRIPTION
15 This efun searches the inventory of object <env> (default is
16 this_object()) for an object with a specific blueprint.
17 The blueprint can be specified either by name <str>, or as the same
18 blueprint as of object <obj>. The matching criteria in both cases is
19 the load_name().
20 If <n> is given, the <n>th object in <env> is returned (if present),
21 otherwise the first object matching <str> or <obj>.
22 If no object in <env> matches the criteria, 0 is returned.
MG Mud User88f12472016-06-24 23:31:02 +020023
Zesstra715ec202025-07-09 22:18:31 +020024 For plain driver this name starts with a '/', for COMPAT mode
25 drivers it doesn't.
26
27EXAMPLES
28 Assume that object 'env' contains the objects /obj/money#8,
29 /std/weapon#9, /std/weapon#12 and /obj/key in the given order.
MG Mud User88f12472016-06-24 23:31:02 +020030
31 +--------------------------------------------------+---------------+
Zesstra715ec202025-07-09 22:18:31 +020032 | Function call | returns |
MG Mud User88f12472016-06-24 23:31:02 +020033 +--------------------------------------------------+---------------+
Zesstrad59c3892019-11-28 20:53:39 +010034 | present_clone("/obj/money", env) | /obj/money#8 |
MG Mud User88f12472016-06-24 23:31:02 +020035 | present_clone("/std/weapon#12", env) | /std/weapon#9 |
Zesstrad59c3892019-11-28 20:53:39 +010036 | present_clone(find_object("/obj/money#14"), env) | /obj/money#8 |
MG Mud User88f12472016-06-24 23:31:02 +020037 | present_clone("/obj/key#18", env) | /obj/key |
Zesstrad59c3892019-11-28 20:53:39 +010038 | present_clone("/std/weapon#12", env, 2) | /std/weapon#12|
39 | present_clone("/std/weapon#12", env, 3) | 0 |
MG Mud User88f12472016-06-24 23:31:02 +020040 +--------------------------------------------------+---------------+
41
Zesstra715ec202025-07-09 22:18:31 +020042REMARKS
43 Note that in contrast to present(), this efun never searches
44 in the environment of <env>.
MG Mud User88f12472016-06-24 23:31:02 +020045
Zesstra715ec202025-07-09 22:18:31 +020046HISTORY
47 Introduced in 3.2.7.
48 Searching for the <n>th object was added in 3.3.718.
MG Mud User88f12472016-06-24 23:31:02 +020049
Zesstra715ec202025-07-09 22:18:31 +020050SEE ALSO
MG Mud User88f12472016-06-24 23:31:02 +020051 load_name(E), present(E)