socials.doc
1 /* ************************************************************************ 2 * Copyright (C) 1990, 1991 - see 'license.doc' for complete information. * 3 ************************************************************************* */ 4 5 6 HANDLING 'SOCIALS' IN CIRCLEMUD 7 8 9 A general system exists to handle the 'social' commands -- those which 10 generally have no game-related purpose other than to convey emotions 11 between players. Socials are also useful for creating advanced DikuMUD 12 adventures and quests through the use of speical procedures; for example, 13 you could add a 'detonate' social which, within your quest, is handled by 14 a special procedure to cause something to explode. 15 16 Socials are all handled through the generalized command do_action. The 17 text file lib/text/socials contains information on the game's socials. 18 New socials can be added by 1) adding the name and level of the social 19 to the master command list in interpreter.c (giving do_action as the 20 function pointer), and 2) adding information for the new social to the 21 lib/text/socials file. 22 23 In Circle 3.0, socials in the file are specified by name (instead of by 24 command number, as was true of the original Diku and versions of Circle 25 before 3.0.). In the standard Circle distribution, the socials appear 26 in alphabetical order in the file, but they can appear in any order and 27 can be rearranged if necessary. 28 29 30 The file is formatted as follows: 31 32 -------------------------------------------- 33 <command name> <hide-flag> <minimum position of victim> 34 <messg to character if no argument> 35 <messg to others if no argument> 36 <messg to char if victim found> <---If this field is empty, 37 <messg to others if victim found> <- 38 <messg to victim> | then these fields must be 39 <messg to char if victim not found> | skipped, and the action will 40 <messg to char if vict is char> | ignore arguments. 41 <messg to others if vict is char> <- 42 43 <command name> <hide-flag> <minimum position of victim> 44 . 45 . 46 . 47 . 48 . 49 50 51 $~ 52 ------------------------------------------------- 53 54 Each social must contain either 1) only the first two messages (if the social 55 ignores arguments), or 2) all eight messages (if the social takes an argument). 56 Each message must be contained in one line. 57 58 The command-name indicates which social is being specified. The hide-flag 59 can be either 0 or 1; if 1, the social is hidden from OTHERS if they cannot 60 see the character performing the social. The action is not hidden from the 61 VICTIM, even if s/he cannot see the character performing the social, although 62 in such cases the character's name will, of course, be replaced with "someone". 63 64 Where it makes sense to do so, text fields may be left empty. This is done by 65 putting a '#' in the first column on the line. Doing so is legal in the 66 following fields: 67 68 a: messg to others if no arg 69 b: messg to others if victim found 70 c: messg to others if vict is char 71 72 Note again that if the field _messg to char if victim found_ is empty, then 73 the following fields must be omitted entirely (not even the '~'), and the 74 action will ignore any arguments supplied. 75 76 The procedure sends the text strings through act(), and they may contain 77 control codes (see the documentation for the act() function for details.) 78 Note that not all of act()'s control codes may be used; for example, codes 79 which refer to objects such as $p. 80 81 For the sake of efficiency, no tests or sanity checks are made on the 82 consistency or logic of the act() codes found in the social messages. 83 Hence, grave disorder may result if, say, the code '$N' occurs in a text 84 field that doesn't refer to a victim; like _messg to others if no arg_. 85 In previous versions of Circle, such grave disorder often manifested itself 86 in the form of crashes. However, the act() function itself in Circle 3.0 87 and above does sanity checks to make sure it's not dereferencing null 88 pointers, hopefully with the result of avoiding crashes. Nevertheless, 89 great care should be taken in making sure that the $ codes of socials are 90 used consistently and correctly.