I have made a few minor changes to the spoken language snippet credited to Frollo (mudaholic@aol.com). Props to anyone else who helped with this code but is not credited. The main change in my snippet is that the garble function gets passed the actual spoken language, which is used to determine the garble letters. Why would you want that? So that different languages look differently spoken. I also had a particular need for my MUD to have a binary language, so the garble letters could only be 0 and 1. Code follows. Please give me props in your credits file (and Frollo too!) Note: This code has been updated so it works in the bpl21+ world! Also, it has been updated to correct a nasty bug where mortals could crash your game at will! Additional big ups to: Brian (borlick@mines.edu) Frollo (mudaholic@aol.com) Izham Syah Mahrome (doomvoid@hotmail.com) Zizazat Lazuras (zizazat@hotmail.com) --Ziz ---act.comm.c--- char *languages[] = { "common", "elven", "demon", "binary", "\n" }; void list_languages(struct char_data *ch) { int a = 0, i; if (SPEAKING(ch) <= MIN_LANGUAGES) { SET_SKILL(ch, MIN_LANGUAGES, 100); SPEAKING(ch) = MIN_LANGUAGES; } /* Slight hack to avoid core dumping cause no one speaks the * language after implementation. */ sprintf(buf, "Languages:\r\n"); for (i = MIN_LANGUAGES; i < MAX_LANGUAGES; i++) { if (GET_SKILL(ch, i) > 60) { sprintf( buf, "%s%s", buf, a++ != 0 ? "&n, " : "[ " ); strcat( buf, SPEAKING(ch) == i ? "&r" : "&n" ); strcat( buf, languages[i-MIN_LANGUAGES]); } } sprintf(buf, "%s &w]&n\r\n", buf); send_to_char(ch, buf); } ACMD(do_languages) { int i, found = FALSE; one_argument(argument, arg); if (!*arg) list_languages(ch); else { for (i = MIN_LANGUAGES; i < MAX_LANGUAGES; i++) { if (search_block(arg, languages, FALSE) == i-MIN_LANGUAGES) && GET_SKILL(ch, i) > 60) { SPEAKING(ch) = i; send_to_char(ch, "You now speak %s.\r\n", languages[i-MIN_LANGUAGES]); found = TRUE; break; } } if (!found) { send_to_char(ch, "You do not know of any such language.\r\n"); return; } } } void garble_text(char *string, int percent, int lang) { char letters[12] = ""; /* Always up letters[12] to the largest size for letters you wish to * use below. */ int i,s; switch (lang) { case SKILL_LANG_BINARY: strcpy (letters, "01"); s=1; break; case SKILL_LANG_DEMON: strcpy (letters, "hprstwxyz"); s=8; break; default: strcpy (letters, "aeiousthpwxyz"); s=12; break; } for (i = 0; i < strlen(string); ++i) if (isalpha(string[i]) && (number(0, 100) > percent)) string[i] = letters[number(0, s)]; } /* Replace original do_say with this */ ACMD(do_say) { char ibuf[MAX_INPUT_LENGTH]; char obuf[MAX_INPUT_LENGTH]; struct char_data *tch; skip_spaces(&argument); if(!*argument) { send_to_char(ch, "Yes, but WHAT do you want to say?\r\n"); return; } strcpy(ibuf, argument); /* preserve original text */ if (!IS_NPC(ch)) garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)), SPEAKING(ch)); for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) { if (tch != ch && AWAKE(tch) && tch->desc) { strcpy(obuf, ibuf); /* preserve the first garble */ if (!IS_NPC(ch) && !IS_NPC(tch)) garble_text(obuf, GET_SKILL(tch, SPEAKING(ch)), SPEAKING(ch)); if (GET_SKILL(tch, SPEAKING(ch)) < 1) sprintf(buf, "$n says, in an unfamiliar tongue, '%s'", obuf); else sprintf(buf, "$n says '%s'", obuf); act(buf, TRUE, ch, 0, tch, TO_VICT); } } sprintf(buf, "&cYou say, '%s&c'&n", argument); act(buf, TRUE, ch, 0, 0, TO_CHAR); } ---spells.h--- #define SKILL_LANG_COMMON 141 #define SKILL_LANG_ELVEN 142 #define SKILL_LANG_DEMON 143 #define SKILL_LANG_BINARY 144 /* Stock Circle 141 is the next open skill, season to taste. */ #define MIN_LANGUAGES 141 #define MAX_LANGUAGES 145 /* Min must be same value as 1st Language. Max should be one more than * the last lang. */ ---utils.h--- #define SPEAKING(ch) ((ch)->player_specials->saved.speaking) ---structs.h--- You'll need to add speaking to the player_specials->saved. int spare8; is a good place replace with int speaking; If you are using ascii player files, it might also be a good idea to make mods to db.c and pfdefaults.h so you can save and load the value of speaking.