blob: ed4b3ec0c131e676527281616bcc5f45f4f12a4a [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstrab6ac9f62020-01-21 11:11:16 +01002 void say(string str)
3 void say(string str, object exclude)
4 void say(string str, object *excludes)
MG Mud User88f12472016-06-24 23:31:02 +02005
Zesstra5481d492021-04-08 20:07:06 +02006 void say(mixed *|mapping|struct|object|lwobject msg)
7 void say(mixed *|mapping|struct|object|lwobject msg, object exclude)
8 void say(mixed *|mapping|struct|object|lwobject msg, object *excludes)
MG Mud User88f12472016-06-24 23:31:02 +02009
Zesstra715ec202025-07-09 22:18:31 +020010DESCRIPTION
11 There are two major modes of calling:
MG Mud User88f12472016-06-24 23:31:02 +020012
Zesstra715ec202025-07-09 22:18:31 +020013 If the first argument is a string <str>, it will be send to
14 all livings in the current room except to the initiator.
MG Mud User88f12472016-06-24 23:31:02 +020015
Zesstra715ec202025-07-09 22:18:31 +020016 If the first argument is an array/mapping/struct/object <msg>, the
17 lfun catch_msg() of all living objects except the initiator will be
18 called.
19 This <msg> will be given as first argument to the lfun, and
20 the initiating object as the second.
21 CAVEAT: If the lfun catch_msg() modifies the content of <msg>, all
22 subsequent objects will receive the modified <msg>.
MG Mud User88f12472016-06-24 23:31:02 +020023
Zesstra715ec202025-07-09 22:18:31 +020024 By specifying a second argument to the efun one can exclude
25 more objects than just the initiator. If the second argument
26 is a single object <exclude>, both the given object and the
27 initiator are excluded from the call. If the second argument
28 is an array <excludes>, all objects and just the objects in
29 this array are excluded from the call.
MG Mud User88f12472016-06-24 23:31:02 +020030
Zesstra715ec202025-07-09 22:18:31 +020031 The 'initiator' is determined according to these rules:
32 - if the say() is called from within a living object, this
33 becomes the initiator
34 - if the say() is called from within a dead object as result
35 of a user action (i.e. this_player() is valid), this_player()
36 becomes the initiator.
37 - Else the object calling the say() becomes the initiator.
MG Mud User88f12472016-06-24 23:31:02 +020038
Zesstra715ec202025-07-09 22:18:31 +020039EXAMPLES
40 say("Hi!\n");
41 say("Hi!\n", this_player());
42 Both calls are equal when called by a not living object.
MG Mud User88f12472016-06-24 23:31:02 +020043
44 Object 1 (living):
Zesstra715ec202025-07-09 22:18:31 +020045 void catch_tell(string str) {
46 write("Received: "+str+"\n");
47 }
48 Object 2 (not living):
49 void func() {
50 ...
51 say("HiHo!\n");
52 ...
53 }
MG Mud User88f12472016-06-24 23:31:02 +020054
Zesstra715ec202025-07-09 22:18:31 +020055 This examples shows how say() together with catch_tell()
56 works. The 2nd object must not be living so the write() will
57 go to the current user.
MG Mud User88f12472016-06-24 23:31:02 +020058
MG Mud User88f12472016-06-24 23:31:02 +020059
Zesstra715ec202025-07-09 22:18:31 +020060 Object 1 (living):
61 void catch_msg(mixed *arr, object who) {
62 int i;
63 if(!arr) return;
64 for(i=0; i<sizeof(arr); i++)
65 tell_object(who, (stringp(arr[i]) ? arr[i] : "-/-")+"\n");
66 }
67 Object 2 (not living):
68 void func() {
69 ...
70 say( ({ "Hello", "there!" }) );
71 ...
72 }
Zesstrab6ac9f62020-01-21 11:11:16 +010073
Zesstra715ec202025-07-09 22:18:31 +020074 This is a bit complex example to demonstrate how say() and
75 catch_msg() works. Here we also use a non living object to
76 send the message so the who in catch_msg() will be the current
77 user.
78
79HISTORY
80 LDMud 3.3.686 added the use of a mapping/struct/object as second
81 argument.
82
83SEE ALSO
Zesstrab6ac9f62020-01-21 11:11:16 +010084 write(E), tell_object(E), tell_room(E)