Re: [coding] [newbie] languages [long]

From: Invincibill (
Date: 01/25/99

Dan Egli wrote:
> I recently downloaded the language patch for circle, but it's not quite
> what I'm looking for. I wonder if someone out there could help?
> The problem is this: Unless everyone in the room is fluent in that
> language, and they are set to speak in that language, then the system
> garbels the text. I could see that if they were not fluent in the
> language, but really... If someone actually knows a language, should it
> really matter if they are speaking in it? Just because I'm speaking englih
> doesn't mean I couldn't understand another language I knew if I heard
> someone speak it. How would you accompilsh that? Here's the do_say routine
> as I have hacked it to work:


here is my lang stuff..i use the lang snippet but its just slightly
you should be able to make sense of it no prob tho.

#define SPEAKING(ch)            ((ch)->player_specials->saved.speaking)
#define GET_LANG(ch, i)          ((ch)->player_specials->saved.langs[i])
//for stock circle i think you would want something like..
#define GET_LANG(ch, i)         ((ch)->player_specials->saved.spells[i +
//or something like that.


   extern char *pc_lang_types[];
   char ibuf[MAX_INPUT_LENGTH];
   char obuf[MAX_INPUT_LENGTH];
   int dir;
   CHAR *tch, *lch, *lch_next;

   if(!CAN_PERFORM_CMD(ch, cmd_number, PRIV_MORTAL)) {
     send_to_char("Sorry, you do not have permission to use this
command.\n\r", ch);
     return; }

   MOBTrigger = FALSE;

   if(!*argument) {
     send_to_char("Say what?\r\n", ch);
     return;   }

   if(IS_NPC(ch) || (IS_IMMORTAL(ch))) {
     sprintf(buf, "$n says, '%s'", argument);
     act(buf, FALSE, ch, 0, 0, TO_ROOM);
        send_to_char(OK, ch);
     else {
        sprintf(buf, "You say, \"%s\"\n\r", argument);
        send_to_char(buf, ch);
     MOBTrigger = TRUE;
     mprog_speech_trigger(argument, ch);
   } else {
     strcpy(ibuf, argument);
     garble_text(ibuf, GET_LANG(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);
           garble_text(obuf, GET_LANG(tch, SPEAKING(ch)));
           //we garble it twice for more confusion. :)
           if (IS_NPC(tch) || IS_IMMORTAL(tch))
             sprintf(buf, "$n says, '%s'\n\r", argument);
           else if ((GET_LANG(tch, SPEAKING(ch)) <= 33) || //33 is an
arbitrary number which
              (GET_LANG(ch, SPEAKING(ch)) <= 33))          //seemed to
make the most sense
             sprintf(buf, "$n says, '%s'\n\r", obuf);
             sprintf(buf, "$n says in %s, '%s'\n\r",
                pc_lang_types[(SPEAKING(ch))], ibuf);  //ibuf is less
garbled than obuf
           act(buf, TRUE, ch, 0, tch, TO_VICT);
        send_to_char(OK, ch);
       else {
        sprintf(buf, "You %ssay in %s, '%s'\n\r",
                GET_LANG(ch, SPEAKING(ch) > 33) ? "" : "attempt to ",
        send_to_char(buf, ch);}

     MOBTrigger = TRUE;
     mprog_speech_trigger(argument, ch);
  // let people in other rooms hear voices from this room
  // if the room is small enough.
  if(ROOM_SIZE(ch->in_room) <= RSIZE_SMALL) {
    for(dir=0;dir <NUM_OF_DIRS; dir++)
      if(CAN_GO(ch,dir) || CAN_HEAR(ch,dir))
        for(lch=world[EXIT(ch, dir)->to_room].people; lch;
          lch_next = lch->next_in_room;
          send_to_charf(lch, "You hear voices coming from %s%s.\n\r",
                  ((dir==8) ? "above" :
                   (dir==9) ? "below" : "the "),
                  ((dir==8 || dir==9) ? "" : dir_types[dir].l_dir));

void garble_text(char *string, int percent)
  char letters[] = "abcdefghijklmnopqrstuvwxyz";
  int i;

  for (i = 0; i < strlen(string); ++i)
    if (isalpha(string[i]) && number(1, 100) > percent)
      string[i] = letters[number(0, 25)];

Weather forecast for today: Sunny & Mild
Weather forecast for tomorrow : Sunny & Mild :

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 12/15/00 PST