comm.doc
1 /* ************************************************************************ 2 * Copyright (C) 1990, 1991 - see 'license.doc' for complete information. * 3 ************************************************************************* */ 4 5 Descriptions of the message-to-character routines of comm.c 6 7 8 9 void send_to_char(char *messg, struct char_data *ch) 10 Places messg in the output queue for ch, for later sending. 11 12 void send_to_all(char *messg) 13 Sends a message to all players. 14 15 void send_to_except(char *messg, struct char_data *ch) 16 Sends to all players, except the one pointed to by ch. 17 18 void send_to_room(char *messg, int room) 19 Sends messg to all players in the room. 20 21 void send_to_room_except(char *messg, int room, struct char_data *ch) 22 Send to all in room, with the exception of ch. 23 24 25 The following routine takes the place of all the old perform-routines. It is 26 to gradually replace these in the old code, and is to be used exclusively in 27 all additions. 28 29 30 FUNCTION ACT --- Process and send string to characters in a room. 31 32 SYNOPSIS 33 34 #include "comm.h" 35 36 act(string, hide_invisible, ch, obj, vict_obj, type) 37 38 char *string; /* the string to send */ 39 int hide_invisible, /* hide the action if vict can't see us? */ 40 type; /* who gets the string */ 41 struct char_data *ch; /* the 'performing' character */ 42 struct obj_data *obj; /* an object */ 43 void *vict_obj; /* an object OR a char OR an ascii string */ 44 45 46 DESCRIPTION 47 48 This function is used to send a string to one or more characters in a room. The 49 string may contain certain control characters which are expanded before the 50 string is sent. 51 52 Obj and vict_obj are ignored if no reference is made to them (via CONTROL 53 CHARACTERS), and if type (see below) is set to TO_ROOM. Thus, null-pointers 54 may be supplied in this case. Ch should always be defined. If String is a 55 null-pointer or if string points to a null-character, nothing will be sent. 56 57 When the string has been parsed, it is capitalized and a newline is added. 58 59 CONTROL CHARACTERS 60 61 Each control character is preceded by a '$'. 62 63 $n - Write name, short description, or "someone", for ch, depending on 64 whether ch is a PC, a NPC, or an invisible PC/NPC. 65 66 $N - Like $n, except insert the text for vict_obj. NOTE: vict_obj must 67 point to an object of type struct char_data. 68 69 $m - "him", "her", or "it", depending on the gender of ch. 70 71 $M - Like $m, for vict_obj. NOTE: vict_obj must be a pointer of type 72 struct char_data. 73 74 $s - "his", "her", or "it", depending on the gender of ch. 75 76 $S - Like $s, for vict_obj. 77 78 $e - "he", "she", "it", depending on the gender of ch. 79 80 $E - Like $e, for vict_obj. 81 82 $o - Name or "something" for obj, depending on visibility. 83 84 $O - Like $o, for vict_obj. NOTE: vict_obj must be a pointer of type 85 struct obj_data. 86 87 $p - Short description or "something" for obj. 88 89 $P - Like $p for vict_obj. 90 91 $a - "an" or "a", depending on the first character of obj's name. 92 93 $A - Like $a, for vict_obj. 94 95 $T - Prints the string pointed to by vict_obj. 96 97 $F - Processes the string pointed to by vict_obj with fname() prior to 98 printing. 99 100 $u - Processes the buffer and uppercases the first letter of the previous 101 word (the word immediately prior to the control code). If there is 102 no previous word, no action is taken. -- CircleMUD addition (09/18/00) 103 104 $U - Processes the buffer and uppercases the first letter of the following 105 word (the word immediately after to the control code). If there is 106 no following word, no action is taken. -- CircleMUD addition (09/18/00) 107 108 $$ - Print the character '$'. 109 110 HIDE_INVISIBLE 111 112 If this parameter is nonzero, the action will be hidden to those who are 113 unable to see ch. 114 115 TYPE 116 117 This value determines who the string is sent to. It may take one of four 118 values (the macros are defined in comm.h). 119 120 TO_ROOM - Send the string to everybody in the room, except ch. 121 TO_VICT - Send the string to the character (!) pointed to by vict_obj. 122 TO_NOTVICT - Send the string to everybody in the room except ch and vict_obj. 123 TO_CHAR - Send the string to the ch. 124 125 126 EXAMPLES 127 128 act("$n smiles happily.", TRUE, ch, 0, 0, TO_ROOM); 129 130 (eg: Rainbird smiles happily.) 131 132 act("You kiss $M.", FALSE, ch, 0, vict, TO_CHAR); 133 134 (eg: You kiss her.) 135 136 act("$n gives $p to $N.", TRUE, ch, obj, vict, TO_NOTVICT); 137 138 (eg: Dave gives a small sword to the giant.) 139 140 act("$n gives you $p.", FALSE, ch, obj, vict, TO_VICT); 141 142 (eg: Dave gives you a small sword.) 143 144 act("$n puts $p in $s $O.", TRUE, ch, obj1, obj2, TO_ROOM); 145 146 (eg: Jones puts a small sword in his sack.)