# # Patch name: langpat # Patch version: 1 # Author's name: Wadhah Al-Tailji # Author's email: altailji@nmt.edu # Version of PennMUSH: 1.6.6 p0 # Date patch made: 8/4/96 # Author is willing to support (yes/no): not really, but you can try to ask # Patch format: diff -c # # # This is a contributed PennMUSH patch. Its use is subject to the # same restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necessarily going # to work on your system, with any version of PennMUSH other than # the one above, etc. # # If the author given above was willing to support the patch, you # should write to the author if you have any questions or problems. Do # *NOT* send email messages to Javelin or any PennMUSH mailing list about # this patch! # # Below this line is the author's description of the patch, # followed by the patch itself. If the patch is in context diff # format, you'll probably apply it by typing: patch < patchfile # in your top-level MUSH directory, unless instructed otherwise # below. # Here is something that may be useful to those of you who run a MUSH that uses multiple languages. Keep in mind that a softcoded language systems can REALLY lag down a MUSH. Believe me, I've seen Wizards who temporarly shut down their globals some nights when lag gets really bad. Few people have embarked on making a hardcoded language system. To those of you Gods who don't know C very well and can't make your own, I offer you my very own hardcoded language system. It worked well for me when I was running a Star Wars themed MUSH, and it still proves useful since I've converted to an Earth theme. After you patch this, you are going to have to do some extra work. First of all, you have to add a player flag called PLAYER_IC. If you don't how to do this, then consult "Javelin's Guide for PennMUSH Gods". After that, you MUST do the following from within your MUSH somewhere in you code: Store all the player's known languages as a space-seperated list within the LANGS attribute. Make a command that will allow a player to choose their current default language (when they say something). You should call this command '+speak ' (because that's what the error message refers to when no default language is set). The player's current default language must be stored in the CURR_LANG attribute. Both these attributes should be locked so that only wizards can set them. Here is what a sample LANGS and CURR_LANG attribute should look like: LANGS [#3mw]: English Spanish French Arabic German CURR_LANG [#3mw]: English Now here's how this language system works. When a player is OOC (they don't have their PLAYER_IC, or IC as it should be designated, flag set), the speech is handled normally (e.g: Marlek says, "Hello"). When a player is set IC, and other players who understand a language a player is speaking, it shows 'Marlek says, "Hello" in English.'... otherwise it shows 'Marlek says something in English.' Anybody who is not IC will understand everything an IC player says (i.e.: wizards, judges... etc.) Good luck, and I hope this command proves useful to you. And if you MUST ask me a question, then email the address above. But don't ask questions like "How do I make the PLAYER_IC flag?" or questions about setting up the hardcode. I may, however, answer questions about setting it up from _within_ the MUSH. --- Marlek@Earth 1996 MUSH *** src/speech.old Sun Aug 4 07:38:52 1996 --- src/speech.c Fri Aug 2 06:36:55 1996 *************** *** 176,198 **** dbref player; const char *tbuf1; { ! dbref loc; ! ! loc = speech_loc(player); ! if (!GoodObject(loc)) ! return; ! ! #ifdef SPEECH_LOCK ! if (!Hasprivs(player) && !eval_lock(player, loc, Speech_Lock)) { ! notify(player, "You may not speak here!"); ! return; ! } ! #endif ! ! /* notify everybody */ ! notify_noecho(player, tprintf("You say, \"%s\"", tbuf1)); ! notify_except(db[loc].contents, player, ! tprintf("%s says, \"%s\"", spname(player), tbuf1)); } void --- 176,238 ---- dbref player; const char *tbuf1; { ! dbref loc; ! char *s; ! ATTR *a; ! char TBUF1[BUFFER_LEN]=""; ! char TBUF2[BUFFER_LEN]=""; ! int CHECK; ! char UNDERS; ! dbref e; ! ! loc = speech_loc(player); ! if (!GoodObject(loc)) ! return; ! ! #ifdef SPEECH_LOCK ! if (!Hasprivs(player) && !eval_lock(player, loc, Speech_Lock)) { ! notify(player, "You may not speak here!"); ! return; ! } ! #endif ! ! if (!IS(player, TYPE_PLAYER, PLAYER_IC)) { ! /* notify everybody */ ! notify_noecho(player, tprintf("You say, \"%s\"", tbuf1)); ! notify_except(db[loc].contents, player, ! tprintf("%s says, \"%s\"", spname(player), tbuf1)); ! } else { ! a = atr_get_noparent(player, "CURR_LANG"); ! if (!a) { ! notify(player, "You must choose a language with +speak before you can talk ICly."); ! } else { ! s = (char *) uncompress(a->value); ! strcpy(TBUF1, s); ! notify_noecho(player, tprintf("You say, \"%s\" in %s.", tbuf1, TBUF1)); ! DOLIST (e, db[loc].contents) { ! CHECK = 0; ! a = atr_get_noparent(e, "LANGS"); ! if (!a) { ! CHECK = 0; ! } else { ! s = (char *) uncompress(a->value); ! strcpy(TBUF2, s); ! if ((strstr(TBUF2, TBUF1)) == NULL) { ! CHECK = 0; ! } else { ! CHECK = 1; ! } ! } ! if (e != player) { ! if (CHECK == 1 || !IS(e, TYPE_PLAYER, PLAYER_IC)) { ! notify_noecho(e, tprintf("%s says, \"%s\" in %s.", spname(player), tbuf1, TBUF1)); ! } else { ! notify_noecho(e, tprintf("%s says something in %s.", spname(player), TBUF1)); ! } ! } ! } ! } ! } } void